summaryrefslogtreecommitdiff
path: root/src/theory/mkrewriter
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2019-12-09 11:19:10 -0800
committerGitHub <noreply@github.com>2019-12-09 11:19:10 -0800
commitb6ce0f23ce0aaa0552767e8067fe58dbceee11cb (patch)
tree0783321580ed511c7ecfa3f59363dadcee15acde /src/theory/mkrewriter
parentd06b46efade674023236da228601806daf06f1af (diff)
Make theory rewriters non-static (#3547)
This commit changes theory rewriters to be non-static. This refactoring is needed as a stepping stone to making our rewriter configurable: If we have multiple solver objects with different rewrite configurations, we cannot use `static` variables for the rewriter table in the BV rewriter for example. It is also in line with our goal of getting rid of singletons in general. Note that the `Rewriter` class is still a singleton, which will be changed in a future commit.
Diffstat (limited to 'src/theory/mkrewriter')
-rwxr-xr-xsrc/theory/mkrewriter15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/theory/mkrewriter b/src/theory/mkrewriter
index ea7deb270..dd5abd219 100755
--- a/src/theory/mkrewriter
+++ b/src/theory/mkrewriter
@@ -38,13 +38,10 @@ template=$1; shift
rewriter_includes=
rewrite_init=
-rewrite_shutdown=
-pre_rewrite_calls=
pre_rewrite_get_cache=
pre_rewrite_set_cache=
-post_rewrite_calls=
post_rewrite_get_cache=
post_rewrite_set_cache=
@@ -143,24 +140,18 @@ function rewriter {
rewriter_includes="${rewriter_includes}#include \"$header\"
"
- rewrite_init="${rewrite_init} ${class}::init();
-"
- rewrite_shutdown="${rewrite_shutdown} ${class}::shutdown();
+ rewrite_init="${rewrite_init} d_theoryRewriters[${theory_id}].reset(new ${class});
"
pre_rewrite_attribute_ids="${pre_rewrite_attribute_ids} preids.push_back(expr::attr::AttributeManager::getAttributeId(RewriteAttibute<${theory_id}>::pre_rewrite()));
"
post_rewrite_attribute_ids="${post_rewrite_attribute_ids} postids.push_back(expr::attr::AttributeManager::getAttributeId(RewriteAttibute<${theory_id}>::post_rewrite()));
"
- pre_rewrite_calls="${pre_rewrite_calls} case ${theory_id}: return ${class}::preRewrite(node);
-"
pre_rewrite_get_cache="${pre_rewrite_get_cache} case ${theory_id}: return RewriteAttibute<${theory_id}>::getPreRewriteCache(node);
"
pre_rewrite_set_cache="${pre_rewrite_set_cache} case ${theory_id}: return RewriteAttibute<${theory_id}>::setPreRewriteCache(node, cache);
"
- post_rewrite_calls="${post_rewrite_calls} case ${theory_id}: return ${class}::postRewrite(node);
-"
post_rewrite_get_cache="${post_rewrite_get_cache} case ${theory_id}: return RewriteAttibute<${theory_id}>::getPostRewriteCache(node);
"
post_rewrite_set_cache="${post_rewrite_set_cache} case ${theory_id}: return RewriteAttibute<${theory_id}>::setPostRewriteCache(node, cache);
@@ -262,13 +253,11 @@ nl -ba -s' ' "$template" | grep '^ *[0-9][0-9]* # *line' |
text=$(cat "$template")
for var in \
rewriter_includes \
- pre_rewrite_calls \
- post_rewrite_calls \
pre_rewrite_get_cache \
post_rewrite_get_cache \
pre_rewrite_set_cache \
post_rewrite_set_cache \
- rewrite_init rewrite_shutdown \
+ rewrite_init \
pre_rewrite_attribute_ids \
post_rewrite_attribute_ids \
template \
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback