summaryrefslogtreecommitdiff
path: root/src/preprocessing/passes/miplib_trick.cpp
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-10-01 10:06:38 -0700
committerGitHub <noreply@github.com>2018-10-01 10:06:38 -0700
commit48ea68aa581d492c48fe9e08b54e9ce26f3508b9 (patch)
treeda50b320545331f2b3f7b8e3304c9d16b40c6c13 /src/preprocessing/passes/miplib_trick.cpp
parent5a19b4d2d2fce73b0d29ff3d40d52c7ef1f4246b (diff)
Refactor preprocessing pass registration (#2468)
This commit refactors how preprocessing pass registration works, inspired by LLVM's approach [0]. The basic idea is that every preprocessing pass declares a static variable of type `RegisterPass` in its source file that registers the pass with the `PreprocessingPassRegistry` when starting the program. The registry is a singleton that keeps track of all the available passes and allows other code to create instances of the passes (note: previously the registry itself was owning the passes but this is no longer the case). One of the advantages of this solution is that we have a list of available passes directly at the beginning of the program, which is useful for example when parsing options. As a side effect, this commit also fixes the SortInference pass, which was expecting arguments other than the preprocessing pass context in its constructor. This commit is required for fixing dumping pre/post preprocessing passes. It is also the ground work for allowing the user to specify a preprocessing pipeline using command-line arguments. [0] https://llvm.org/docs/WritingAnLLVMPass.html
Diffstat (limited to 'src/preprocessing/passes/miplib_trick.cpp')
-rw-r--r--src/preprocessing/passes/miplib_trick.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/preprocessing/passes/miplib_trick.cpp b/src/preprocessing/passes/miplib_trick.cpp
index 616ecd969..c45c6266e 100644
--- a/src/preprocessing/passes/miplib_trick.cpp
+++ b/src/preprocessing/passes/miplib_trick.cpp
@@ -19,6 +19,7 @@
#include "expr/node_self_iterator.h"
#include "options/arith_options.h"
+#include "preprocessing/preprocessing_pass_registry.h"
#include "smt/smt_statistics_registry.h"
#include "smt_util/boolean_simplification.h"
#include "theory/booleans/circuit_propagator.h"
@@ -659,6 +660,8 @@ MipLibTrick::Statistics::~Statistics()
smtStatisticsRegistry()->unregisterStat(&d_numMiplibAssertionsRemoved);
}
+static RegisterPass<MipLibTrick> X("miplib-trick");
+
} // namespace passes
} // namespace preprocessing
} // namespace CVC4
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback