00001 #ifndef Rose_SMTSolver_H 00002 #define Rose_SMTSolver_H 00003 00004 #include "InsnSemanticsExpr.h" 00005 00011 class SMTSolver { 00012 public: 00013 struct Exception { 00014 Exception(const std::string &mesg): mesg(mesg) {} 00015 friend std::ostream& operator<<(std::ostream&, const SMTSolver::Exception&); 00016 std::string mesg; 00017 }; 00018 00019 typedef std::set<uint64_t> Definitions; 00021 SMTSolver(): debug(NULL) {} 00022 00023 virtual ~SMTSolver() {} 00024 00026 virtual bool satisfiable(const InsnSemanticsExpr::TreeNodePtr &expr); 00027 00030 virtual bool satisfiable(const std::vector<InsnSemanticsExpr::TreeNodePtr> &exprs); 00031 00035 virtual InsnSemanticsExpr::TreeNodePtr get_definition(uint64_t varno) { 00036 return InsnSemanticsExpr::TreeNodePtr(); 00037 } 00038 virtual InsnSemanticsExpr::TreeNodePtr get_definition(const InsnSemanticsExpr::LeafNodePtr &var) { 00039 assert(var!=NULL && !var->is_known()); 00040 return get_definition(var->get_name()); 00041 } 00045 void set_debug(FILE *f) { debug = f; } 00046 00048 FILE *get_debug() const { return debug; } 00049 00052 static size_t get_ncalls() { return total_calls; } 00053 00054 protected: 00058 virtual void generate_file(std::ostream&, const std::vector<InsnSemanticsExpr::TreeNodePtr> &exprs, 00059 Definitions*) = 0; 00060 00063 virtual std::string get_command(const std::string &config_name) = 0; 00064 00067 virtual void parse_evidence() {}; 00068 00070 std::vector<std::string> output_text; 00071 00073 static size_t total_calls; 00074 00075 private: 00076 FILE *debug; 00077 }; 00078 00079 #endif
1.4.7