Make registration of preprocessing passes explicit (#2564)
authorAndres Noetzli <andres.noetzli@gmail.com>
Tue, 2 Oct 2018 21:55:21 +0000 (14:55 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Oct 2018 21:55:21 +0000 (14:55 -0700)
As it turns out, self-registering types are problematic with static
linkage [0]. Instead of fixing the issue with linker flags, which seems
possible but also brittle (e.g. the flags may be different for different
linkers), this commit adds an explicit registration of each
preprocessing pass.

[0] https://www.bfilipek.com/2018/02/static-vars-static-lib.html

32 files changed:
src/preprocessing/passes/apply_substs.cpp
src/preprocessing/passes/apply_to_const.cpp
src/preprocessing/passes/bool_to_bv.cpp
src/preprocessing/passes/bv_abstraction.cpp
src/preprocessing/passes/bv_ackermann.cpp
src/preprocessing/passes/bv_eager_atoms.cpp
src/preprocessing/passes/bv_gauss.cpp
src/preprocessing/passes/bv_intro_pow2.cpp
src/preprocessing/passes/bv_to_bool.cpp
src/preprocessing/passes/extended_rewriter_pass.cpp
src/preprocessing/passes/global_negate.cpp
src/preprocessing/passes/int_to_bv.cpp
src/preprocessing/passes/ite_removal.cpp
src/preprocessing/passes/ite_simp.cpp
src/preprocessing/passes/miplib_trick.cpp
src/preprocessing/passes/nl_ext_purify.cpp
src/preprocessing/passes/non_clausal_simp.cpp
src/preprocessing/passes/pseudo_boolean_processor.cpp
src/preprocessing/passes/quantifier_macros.cpp
src/preprocessing/passes/quantifiers_preprocess.cpp
src/preprocessing/passes/real_to_int.cpp
src/preprocessing/passes/rewrite.cpp
src/preprocessing/passes/sep_skolem_emp.cpp
src/preprocessing/passes/sort_infer.cpp
src/preprocessing/passes/static_learning.cpp
src/preprocessing/passes/sygus_inference.cpp
src/preprocessing/passes/symmetry_breaker.cpp
src/preprocessing/passes/synth_rew_rules.cpp
src/preprocessing/passes/theory_preprocess.cpp
src/preprocessing/passes/unconstrained_simplifier.cpp
src/preprocessing/preprocessing_pass_registry.cpp
src/preprocessing/preprocessing_pass_registry.h

index 59b628e3b1462b10ee2d830be39ee5eef99c0451..f5c3520d01545a386764dca6ee3f24dae0819004 100644 (file)
@@ -18,7 +18,6 @@
 #include "preprocessing/passes/apply_substs.h"
 
 #include "context/cdo.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 #include "theory/substitutions.h"
 
@@ -69,8 +68,6 @@ PreprocessingPassResult ApplySubsts::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<ApplySubsts> X("apply-substs");
-
 }  // namespace passes
 }  // namespace preprocessing
 }  // namespace CVC4
index 65bdf5c1f6ef89c7f26dd6cdbe45e11bdae506df..653a915d52ee83d87676573655fa6560d776cf47 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "preprocessing/passes/apply_to_const.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 
 namespace CVC4 {
@@ -104,7 +103,6 @@ PreprocessingPassResult ApplyToConst::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<ApplyToConst> X("apply-to-const");
 
 }  // namespace passes
 }  // namespace preprocessing
index 15b0ee67874e736452dca1089a62965044d3a4c5..c8a59bdc453a59bca8bb18f36c5246ff66a8c977 100644 (file)
@@ -20,7 +20,6 @@
 #include <vector>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_statistics_registry.h"
 #include "theory/rewriter.h"
 #include "theory/theory.h"
@@ -210,7 +209,6 @@ BoolToBV::Statistics::~Statistics()
   smtStatisticsRegistry()->unregisterStat(&d_numTermsForcedLowered);
 }
 
-static RegisterPass<BoolToBV> X("bool-to-bv");
 
 }  // namespace passes
 }  // namespace preprocessing
index addee305dd37dc8f69fd14d689012ccfb2a24b0d..27648b45d6180d7ff56145041c486229f78274d1 100644 (file)
@@ -26,7 +26,6 @@
 #include <vector>
 
 #include "options/bv_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/bv/theory_bv.h"
 #include "theory/rewriter.h"
 
@@ -61,7 +60,6 @@ PreprocessingPassResult BvAbstraction::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<BvAbstraction> X("bv-abstraction");
 
 }  // namespace passes
 }  // namespace preprocessing
index 01fa70b6148c195ffeb48bf8e948eead772d1296..2ec49b9859371ace6cb621844bc4c6e1dcb80435 100644 (file)
@@ -24,7 +24,6 @@
 #include "preprocessing/passes/bv_ackermann.h"
 
 #include "options/bv_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/bv/theory_bv_utils.h"
 
 using namespace CVC4;
@@ -214,7 +213,6 @@ PreprocessingPassResult BVAckermann::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<BVAckermann> X("bv-ackermann");
 
 /* -------------------------------------------------------------------------- */
 
index 6b80a4e65a0723d8dfa9ea01c945d87e0998eb4d..8ee46829a364a7763dffe47ed3b1ef88ca905456 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "preprocessing/passes/bv_eager_atoms.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/theory_model.h"
 
 namespace CVC4 {
@@ -43,7 +42,6 @@ PreprocessingPassResult BvEagerAtoms::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<BvEagerAtoms> X("bv-eager-atoms");
 
 }  // namespace passes
 }  // namespace preprocessing
index ffecc868291f76a72624dc7c4fbc7f1e7cee642a..58e5f93bf52aec08ca313ee37026e96824a82c06 100644 (file)
@@ -18,7 +18,6 @@
 #include "preprocessing/passes/bv_gauss.h"
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/bv/theory_bv_rewrite_rules_normalization.h"
 #include "theory/bv/theory_bv_utils.h"
 #include "theory/rewriter.h"
@@ -819,7 +818,6 @@ PreprocessingPassResult BVGauss::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<BVGauss> X("bv-gauss");
 
 }  // namespace passes
 }  // namespace preprocessing
index 82781b8485699fea35dd7ded7258e96861d48d66..fb9ceac718891516ccc796529c016a1145db7ca0 100644 (file)
@@ -20,7 +20,6 @@
 
 #include <unordered_map>
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/bv/theory_bv_rewrite_rules_simplification.h"
 #include "theory/rewriter.h"
 
@@ -99,7 +98,6 @@ PreprocessingPassResult BvIntroPow2::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<BvIntroPow2> X("bv-intro-pow2");
 
 }/* CVC4::theory::bv namespace */
 }/* CVC4::theory namespace */
index c6d98705c454309d6066d0d95291a8893bcd86c1..811fe9251aa8fb9df1eddaea6b5d835287a5ca84 100644 (file)
@@ -21,7 +21,6 @@
 #include <vector>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_statistics_registry.h"
 #include "smt_util/node_visitor.h"
 #include "theory/rewriter.h"
@@ -304,7 +303,6 @@ BVToBool::Statistics::~Statistics()
   smtStatisticsRegistry()->unregisterStat(&d_numTermsForcedLifted);
 }
 
-static RegisterPass<BVToBool> X("bv-to-bool");
 
 }  // passes
 }  // Preprocessing
index 8ca0a82ab1c37da69d60cb6d69599034559be200..261a5f2aeef072a8a4e369eff7303413d1ee95f5 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "preprocessing/passes/extended_rewriter_pass.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/quantifiers/extended_rewrite.h"
 
 namespace CVC4 {
@@ -38,7 +37,6 @@ PreprocessingPassResult ExtRewPre::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<ExtRewPre> X("ext-rew-pre");
 
 }  // namespace passes
 }  // namespace preprocessing
index be4f087171d7cf84542438d11e3accd2cb57625b..428360e8de4dcdb95e0a6048bb63f6a4b5ebefa2 100644 (file)
@@ -17,7 +17,6 @@
 #include <vector>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 
 using namespace std;
@@ -120,7 +119,6 @@ PreprocessingPassResult GlobalNegate::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<GlobalNegate> X("global-negate");
 
 }  // namespace passes
 }  // namespace preprocessing
index f4aa1cfe90adc3792ea3964c471bdfcee7a27de0..cc95bd1f2fea722edae9bbfc16188cbae00acc46 100644 (file)
@@ -23,7 +23,6 @@
 #include <vector>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 #include "theory/theory.h"
 
@@ -335,7 +334,6 @@ PreprocessingPassResult IntToBV::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<IntToBV> X("int-to-bv");
 
 }  // namespace passes
 }  // namespace preprocessing
index bbc09b89c853e5a2e27cd93c2c6953698a149984..b70d2460d0f6a37738d4a9181fda2728ff229107 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "preprocessing/passes/ite_removal.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 
 namespace CVC4 {
@@ -46,7 +45,6 @@ PreprocessingPassResult IteRemoval::applyInternal(AssertionPipeline* assertions)
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<IteRemoval> X("ite-removal");
 
 }  // namespace passes
 }  // namespace preprocessing
index fbc22597d1d06a54b09bc6875ea35fc70003848c..02f14f508a98f5bf8a014be4d357a55b3e2ff438 100644 (file)
@@ -17,7 +17,6 @@
 #include <vector>
 
 #include "options/proof_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_statistics_registry.h"
 #include "smt_util/nary_builder.h"
 #include "theory/arith/arith_ite_utils.h"
@@ -257,7 +256,6 @@ PreprocessingPassResult ITESimp::applyInternal(
               : PreprocessingPassResult::CONFLICT;
 }
 
-static RegisterPass<ITESimp> X("ite-simp");
 
 /* -------------------------------------------------------------------------- */
 
index c45c6266e468cee1707b03452d782741616c2626..9a2dcca1f6f5b66c3e06f79567e91a744f821d76 100644 (file)
@@ -19,7 +19,6 @@
 
 #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"
@@ -660,7 +659,6 @@ MipLibTrick::Statistics::~Statistics()
   smtStatisticsRegistry()->unregisterStat(&d_numMiplibAssertionsRemoved);
 }
 
-static RegisterPass<MipLibTrick> X("miplib-trick");
 
 }  // namespace passes
 }  // namespace preprocessing
index 630f35c140f1e364838a62058edede5eb4455a8b..744bd8ad808d25a9a7d4e0040024db97f5eb9bd0 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "preprocessing/passes/nl_ext_purify.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 
 namespace CVC4 {
 namespace preprocessing {
@@ -127,7 +126,6 @@ PreprocessingPassResult NlExtPurify::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<NlExtPurify> X("nl-ext-purify");
 
 }  // namespace passes
 }  // namespace preprocessing
index d061434417ab523f782bf0265438e0253d5d1d5b..d8e1b3d66ac9f06b15b10a2042316c50d512fe63 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "context/cdo.h"
 #include "options/proof_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_statistics_registry.h"
 #include "theory/theory_model.h"
 
@@ -453,7 +452,6 @@ PreprocessingPassResult NonClausalSimp::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }  // namespace passes
 
-static RegisterPass<NonClausalSimp> X("non-clausal-simp");
 
 /* -------------------------------------------------------------------------- */
 
index 3d448ddf17a93b9fef5f204511f0b43aa60deb31..624b98ec1c7269314a209afaae4735d9f818d90a 100644 (file)
@@ -18,7 +18,6 @@
 #include "preprocessing/passes/pseudo_boolean_processor.h"
 
 #include "base/output.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/arith/arith_utilities.h"
 #include "theory/arith/normal_form.h"
 #include "theory/rewriter.h"
@@ -414,7 +413,6 @@ void PseudoBooleanProcessor::clear()
   d_neg.clear();
 }
 
-static RegisterPass<PseudoBooleanProcessor> X("pseudo-boolean-processor");
 
 }  // namespace passes
 }  // namespace preprocessing
index 01416016a521c12ed3f8225d12be1fc4ac99603a..6bd94a3f08b719d51ece16f7b41da39ceba7a033 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "options/quantifiers_modes.h"
 #include "options/quantifiers_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "proof/proof_manager.h"
 #include "smt/smt_engine.h"
 #include "smt/smt_engine_scope.h"
@@ -546,7 +545,6 @@ void QuantifierMacros::addMacro( Node op, Node n, std::vector< Node >& opc ) {
   }
 }
 
-static RegisterPass<QuantifierMacros> X("quantifier-macros");
 
 }  // passes
 }  // preprocessing
index 5217bc8072d7db94c2ad5ff88f60aba9c3181c8c..cfc4a8103632a09567894b735bf3224bedbf081e 100644 (file)
@@ -20,7 +20,6 @@
 #include "preprocessing/passes/quantifiers_preprocess.h"
 
 #include "base/output.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/quantifiers/quantifiers_rewriter.h"
 #include "theory/rewriter.h"
 
@@ -53,7 +52,6 @@ PreprocessingPassResult QuantifiersPreprocess::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<QuantifiersPreprocess> X("quantifiers-preprocess");
 
 }  // namespace passes
 }  // namespace preprocessing
index d15a1991296d722ffc6f3466a72aa35c0f17c486..4b1fc06ebbd7df691c0f332c1057bbdaa2de0836 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <string>
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/arith/arith_msum.h"
 #include "theory/rewriter.h"
 #include "theory/theory_model.h"
@@ -198,7 +197,6 @@ PreprocessingPassResult RealToInt::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<RealToInt> X("real-to-int");
 
 }  // namespace passes
 }  // namespace preprocessing
index 8d0f76c389ce13350df450ea9ad049f1c7b02e70..4a5eccd4b5faa0ec46438bdbd7daeaad8de281c2 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "preprocessing/passes/rewrite.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 
 namespace CVC4 {
@@ -40,7 +39,6 @@ PreprocessingPassResult Rewrite::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<Rewrite> X("rewrite");
 
 }  // namespace passes
 }  // namespace preprocessing
index 55ce1c5d15ac8dce92a9b350bba02d61a5bf08c5..95a7995ce004a2514aa4efb9962e2c909eb24baa 100644 (file)
@@ -20,7 +20,6 @@
 #include <vector>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/quantifiers/quant_util.h"
 #include "theory/rewriter.h"
 #include "theory/theory.h"
@@ -120,7 +119,6 @@ PreprocessingPassResult SepSkolemEmp::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<SepSkolemEmp> X("sep-skolem-emp");
 
 }  // namespace passes
 }  // namespace preprocessing
index f8faab9bcfb3ca0e1674721c48a7c666a5dbd01d..807048696328bbd0a09dcc2036ef319512925c08 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "options/smt_options.h"
 #include "options/uf_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 #include "theory/sort_inference.h"
 
@@ -83,7 +82,6 @@ PreprocessingPassResult SortInferencePass::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<SortInferencePass> X("sort-inference");
 
 }  // namespace passes
 }  // namespace preprocessing
index df116166d54a2ac6439c16af11dd0338faf0a2f7..26327fd5b4fd4374e14e81083c239a7ec64ca83e 100644 (file)
@@ -18,7 +18,6 @@
 #include <string>
 
 #include "expr/node.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 
 namespace CVC4 {
 namespace preprocessing {
@@ -51,7 +50,6 @@ PreprocessingPassResult StaticLearning::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<StaticLearning> X("static-learning");
 
 }  // namespace passes
 }  // namespace preprocessing
index 09db93cbcce1b36ef035ecc4fc907d8b016a9799..b0c374ff98d26417014584da553750cc9bc35b4e 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "preprocessing/passes/sygus_inference.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_engine.h"
 #include "smt/smt_engine_scope.h"
 #include "smt/smt_statistics_registry.h"
@@ -317,7 +316,6 @@ bool SygusInference::solveSygus(std::vector<Node>& assertions,
   return true;
 }
 
-static RegisterPass<SygusInference> X("sygus-infer");
 
 }  // namespace passes
 }  // namespace preprocessing
index 92065b2a0af1ef92f26a4e980350e42c95ceba8b..44fdd2c791724bc5a0383a120de985d0d9e0e224 100644 (file)
@@ -15,7 +15,6 @@
 #include "preprocessing/passes/symmetry_breaker.h"
 
 #include "preprocessing/passes/symmetry_detect.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 
 using namespace std;
 using namespace CVC4::kind;
@@ -177,7 +176,6 @@ PreprocessingPassResult SymBreakerPass::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<SymBreakerPass> X("sym-break");
 
 }  // namespace passes
 }  // namespace preprocessing
index 47c24bb5eafae530b8f357b7ab4efb75d8bda90c..2ff52528532af13ed4b41287605da20a1213f0de 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "options/base_options.h"
 #include "options/quantifiers_options.h"
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "printer/printer.h"
 #include "theory/quantifiers/candidate_rewrite_database.h"
 
@@ -155,7 +154,6 @@ PreprocessingPassResult SynthRewRulesPass::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<SynthRewRulesPass> X("synth-rr");
 
 }  // namespace passes
 }  // namespace preprocessing
index a5d054c8b620e9351c6ae12c0be51066d96ee994..3a5213f435e015587e057a2e15ab9e83fb393913 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "preprocessing/passes/theory_preprocess.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "theory/rewriter.h"
 #include "theory/theory_engine.h"
 
@@ -45,7 +44,6 @@ PreprocessingPassResult TheoryPreprocess::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<TheoryPreprocess> X("theory-preprocess");
 
 }  // namespace passes
 }  // namespace preprocessing
index 52d37830563503818fbbaeb9d855131acb906f17..f58f1a44b0e033de9162f3c1b41c183ae0cd7ee8 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "preprocessing/passes/unconstrained_simplifier.h"
 
-#include "preprocessing/preprocessing_pass_registry.h"
 #include "smt/smt_statistics_registry.h"
 #include "theory/logic_info.h"
 #include "theory/rewriter.h"
@@ -843,7 +842,6 @@ PreprocessingPassResult UnconstrainedSimplifier::applyInternal(
   return PreprocessingPassResult::NO_CONFLICT;
 }
 
-static RegisterPass<UnconstrainedSimplifier> X("unconstrained-simplifier");
 
 }  // namespace passes
 }  // namespace preprocessing
index a50cd2541e0c9f8ba2e02bfcc6ae876015270593..f2e7c860380c6f4c3fa9d7609167b5c66c64f3ea 100644 (file)
@@ -12,8 +12,7 @@
  ** \brief The preprocessing pass registry
  **
  ** This file defines the classes PreprocessingPassRegistry, which keeps track
- ** of the available preprocessing passes, and RegisterPass, which registers a
- ** preprocessing pass with the registry.
+ ** of the available preprocessing passes.
  **/
 
 #include "preprocessing/preprocessing_pass_registry.h"
 #include <utility>
 
 #include "base/cvc4_assert.h"
+#include "base/map_util.h"
 #include "base/output.h"
+#include "preprocessing/passes/apply_substs.h"
+#include "preprocessing/passes/apply_to_const.h"
+#include "preprocessing/passes/bool_to_bv.h"
+#include "preprocessing/passes/bv_abstraction.h"
+#include "preprocessing/passes/bv_ackermann.h"
+#include "preprocessing/passes/bv_eager_atoms.h"
+#include "preprocessing/passes/bv_gauss.h"
+#include "preprocessing/passes/bv_intro_pow2.h"
+#include "preprocessing/passes/bv_to_bool.h"
+#include "preprocessing/passes/extended_rewriter_pass.h"
+#include "preprocessing/passes/global_negate.h"
+#include "preprocessing/passes/int_to_bv.h"
+#include "preprocessing/passes/ite_removal.h"
+#include "preprocessing/passes/ite_simp.h"
+#include "preprocessing/passes/miplib_trick.h"
+#include "preprocessing/passes/nl_ext_purify.h"
+#include "preprocessing/passes/non_clausal_simp.h"
+#include "preprocessing/passes/pseudo_boolean_processor.h"
+#include "preprocessing/passes/quantifier_macros.h"
+#include "preprocessing/passes/quantifiers_preprocess.h"
+#include "preprocessing/passes/real_to_int.h"
+#include "preprocessing/passes/rewrite.h"
+#include "preprocessing/passes/sep_skolem_emp.h"
+#include "preprocessing/passes/sort_infer.h"
+#include "preprocessing/passes/static_learning.h"
+#include "preprocessing/passes/sygus_inference.h"
+#include "preprocessing/passes/symmetry_breaker.h"
+#include "preprocessing/passes/symmetry_detect.h"
+#include "preprocessing/passes/synth_rew_rules.h"
+#include "preprocessing/passes/theory_preprocess.h"
+#include "preprocessing/passes/unconstrained_simplifier.h"
 #include "preprocessing/preprocessing_pass.h"
 
 namespace CVC4 {
 namespace preprocessing {
 
+using namespace CVC4::preprocessing::passes;
+
 PreprocessingPassRegistry& PreprocessingPassRegistry::getInstance()
 {
   static PreprocessingPassRegistry* ppReg = new PreprocessingPassRegistry();
@@ -38,6 +71,7 @@ void PreprocessingPassRegistry::registerPassInfo(
     const std::string& name,
     std::function<PreprocessingPass*(PreprocessingPassContext*)> ctor)
 {
+  AlwaysAssert(!ContainsKey(d_ppInfo, name));
   d_ppInfo[name] = ctor;
 }
 
@@ -63,5 +97,58 @@ bool PreprocessingPassRegistry::hasPass(const std::string& name)
   return d_ppInfo.find(name) != d_ppInfo.end();
 }
 
+namespace {
+
+/**
+ * This method is stored by the `PreprocessingPassRegistry` and used to create
+ * a new instance of the preprocessing pass T.
+ *
+ * @param ppCtx The preprocessing pass context passed to the constructor of
+ *              the preprocessing pass
+ */
+template <class T>
+PreprocessingPass* callCtor(PreprocessingPassContext* ppCtx)
+{
+  return new T(ppCtx);
+}
+
+}  // namespace
+
+PreprocessingPassRegistry::PreprocessingPassRegistry()
+{
+  registerPassInfo("apply-substs", callCtor<ApplySubsts>);
+  registerPassInfo("bv-gauss", callCtor<BVGauss>);
+  registerPassInfo("static-learning", callCtor<StaticLearning>);
+  registerPassInfo("ite-simp", callCtor<ITESimp>);
+  registerPassInfo("apply-to-const", callCtor<ApplyToConst>);
+  registerPassInfo("global-negate", callCtor<GlobalNegate>);
+  registerPassInfo("int-to-bv", callCtor<IntToBV>);
+  registerPassInfo("synth-rr", callCtor<SynthRewRulesPass>);
+  registerPassInfo("real-to-int", callCtor<RealToInt>);
+  registerPassInfo("sygus-infer", callCtor<SygusInference>);
+  registerPassInfo("bv-to-bool", callCtor<BVToBool>);
+  registerPassInfo("bv-intro-pow2", callCtor<BvIntroPow2>);
+  registerPassInfo("sort-inference", callCtor<SortInferencePass>);
+  registerPassInfo("sep-skolem-emp", callCtor<SepSkolemEmp>);
+  registerPassInfo("rewrite", callCtor<Rewrite>);
+  registerPassInfo("bv-abstraction", callCtor<BvAbstraction>);
+  registerPassInfo("bv-eager-atoms", callCtor<BvEagerAtoms>);
+  registerPassInfo("pseudo-boolean-processor",
+                   callCtor<PseudoBooleanProcessor>);
+  registerPassInfo("unconstrained-simplifier",
+                   callCtor<UnconstrainedSimplifier>);
+  registerPassInfo("quantifiers-preprocess", callCtor<QuantifiersPreprocess>);
+  registerPassInfo("ite-removal", callCtor<IteRemoval>);
+  registerPassInfo("miplib-trick", callCtor<MipLibTrick>);
+  registerPassInfo("non-clausal-simp", callCtor<NonClausalSimp>);
+  registerPassInfo("bv-ackermann", callCtor<BVAckermann>);
+  registerPassInfo("sym-break", callCtor<SymBreakerPass>);
+  registerPassInfo("ext-rew-pre", callCtor<ExtRewPre>);
+  registerPassInfo("theory-preprocess", callCtor<TheoryPreprocess>);
+  registerPassInfo("quantifier-macros", callCtor<QuantifierMacros>);
+  registerPassInfo("nl-ext-purify", callCtor<NlExtPurify>);
+  registerPassInfo("bool-to-bv", callCtor<BoolToBV>);
+}
+
 }  // namespace preprocessing
 }  // namespace CVC4
index 44e9b4e6eb52c0bb3d79eed224448a6b6d0d620e..e6c98c1f91793cdc37edb0cb6c8d5db007e008f7 100644 (file)
@@ -12,8 +12,7 @@
  ** \brief The preprocessing pass registry
  **
  ** This file defines the classes PreprocessingPassRegistry, which keeps track
- ** of the available preprocessing passes, and RegisterPass, which registers a
- ** preprocessing pass with the registry.
+ ** of the available preprocessing passes.
  **/
 #include "cvc4_private.h"
 
@@ -79,6 +78,12 @@ class PreprocessingPassRegistry {
   bool hasPass(const std::string& name);
 
  private:
+  /**
+   * Private constructor for the preprocessing pass registry. The
+   * registry is a singleton and no other instance should be created.
+   */
+  PreprocessingPassRegistry();
+
   /**
    * Map of available preprocessing passes, mapping from preprocessing pass
    * name to a function that constructs a corresponding instance.
@@ -89,42 +94,6 @@ class PreprocessingPassRegistry {
       d_ppInfo;
 };  // class PreprocessingPassRegistry
 
-/**
- * Class used to register a preprocessing pass. In the source file of a given
- * pass, create a static instance of this class, e.g.:
- *
- * static RegisterPass<MyPass> X("my-pass");
- *
- * where `MyPass` is the class of your pass and "my-pass" is its name. This
- * registers the pass with the `PreprocessingPassRegistry`.
- */
-template <class T>
-class RegisterPass
-{
- public:
-  /**
-   * Creates a new preprocessing pass registration.
-   *
-   * @param name The name that should be associated with the preprocessing pass
-   */
-  RegisterPass(const std::string& name)
-  {
-    PreprocessingPassRegistry::getInstance().registerPassInfo(name, callCtor);
-  }
-
-  /**
-   * This method is used by the `PreprocessingPassRegistry` to create a new
-   * instance of the preprocessing pass T.
-   *
-   * @param ppCtx The preprocessing pass context passed to the constructor of
-   *              the preprocessing pass
-   */
-  static PreprocessingPass* callCtor(PreprocessingPassContext* ppCtx)
-  {
-    return new T(ppCtx);
-  }
-};  // class RegisterPass
-
 }  // namespace preprocessing
 }  // namespace CVC4