KModule.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef KLEE_KMODULE_H
00011 #define KLEE_KMODULE_H
00012
00013 #include "klee/Interpreter.h"
00014
00015 #include <map>
00016 #include <set>
00017 #include <vector>
00018
00019 namespace llvm {
00020 class BasicBlock;
00021 class Constant;
00022 class Function;
00023 class Instruction;
00024 class Module;
00025 class TargetData;
00026 }
00027
00028 namespace klee {
00029 class Cell;
00030 class Executor;
00031 class Expr;
00032 class InterpreterHandler;
00033 class InstructionInfoTable;
00034 class KInstruction;
00035 class KModule;
00036 template<class T> class ref;
00037
00038 struct KFunction {
00039 llvm::Function *function;
00040
00041 unsigned numArgs, numRegisters;
00042
00043 unsigned numInstructions;
00044 KInstruction **instructions;
00045
00046 std::map<llvm::BasicBlock*, unsigned> basicBlockEntry;
00047
00050 bool trackCoverage;
00051
00052 private:
00053 KFunction(const KFunction&);
00054 KFunction &operator=(const KFunction&);
00055
00056 public:
00057 explicit KFunction(llvm::Function*, KModule *);
00058 ~KFunction();
00059
00060 unsigned getArgRegister(unsigned index) { return index; }
00061 };
00062
00063
00064 class KConstant {
00065 public:
00067 llvm::Constant* ct;
00068
00070 unsigned id;
00071
00074 KInstruction *ki;
00075
00076 KConstant(llvm::Constant*, unsigned, KInstruction*);
00077 };
00078
00079
00080 class KModule {
00081 public:
00082 llvm::Module *module;
00083 llvm::TargetData *targetData;
00084
00085
00086 llvm::Function *dbgStopPointFn, *kleeMergeFn;
00087
00088
00089 std::vector<KFunction*> functions;
00090 std::map<llvm::Function*, KFunction*> functionMap;
00091
00092
00093
00094 std::set<llvm::Function*> escapingFunctions;
00095
00096 InstructionInfoTable *infos;
00097
00098 std::vector<llvm::Constant*> constants;
00099 std::map<llvm::Constant*, KConstant*> constantMap;
00100 KConstant* getKConstant(llvm::Constant *c);
00101
00102 Cell *constantTable;
00103
00104 public:
00105 KModule(llvm::Module *_module);
00106 ~KModule();
00107
00109
00110
00111 void prepare(const Interpreter::ModuleOptions &opts,
00112 InterpreterHandler *ihandler);
00113
00115 unsigned getConstantID(llvm::Constant *c, KInstruction* ki);
00116 };
00117 }
00118
00119 #endif