klee
|
#include <KModule.h>
Public Member Functions | |
KConstant * | getKConstant (const llvm::Constant *c) |
KModule ()=default | |
void | optimiseAndPrepare (const Interpreter::ModuleOptions &opts, llvm::ArrayRef< const char * >) |
Optimise and prepare module such that KLEE can execute it. More... | |
void | manifest (InterpreterHandler *ih, bool forceSourceOutput) |
bool | link (std::vector< std::unique_ptr< llvm::Module > > &modules, const std::string &entryPoint) |
void | instrument (const Interpreter::ModuleOptions &opts) |
unsigned | getConstantID (llvm::Constant *c, KInstruction *ki) |
Return an id for the given constant, creating a new one if necessary. More... | |
void | checkModule () |
Public Attributes | |
std::unique_ptr< llvm::Module > | module |
std::unique_ptr< llvm::DataLayout > | targetData |
std::vector< std::unique_ptr< KFunction > > | functions |
std::map< llvm::Function *, KFunction * > | functionMap |
std::set< llvm::Function * > | escapingFunctions |
std::unique_ptr< InstructionInfoTable > | infos |
std::vector< llvm::Constant * > | constants |
std::map< const llvm::Constant *, std::unique_ptr< KConstant > > | constantMap |
std::unique_ptr< Cell[]> | constantTable |
std::set< const llvm::Function * > | internalFunctions |
Private Member Functions | |
void | addInternalFunction (const char *functionName) |
|
default |
|
private |
Definition at line 199 of file KModule.cpp.
References internalFunctions, klee::klee_message(), klee::klee_warning(), and module.
Referenced by optimiseAndPrepare().
void KModule::checkModule | ( | ) |
Run passes that check if module is valid LLVM IR and if invariants expected by KLEE's Executor hold.
Definition at line 360 of file KModule.cpp.
References klee::InstructionOperandTypeCheckPass::checkPassed(), klee::klee_error(), and module.
unsigned KModule::getConstantID | ( | llvm::Constant * | c, |
KInstruction * | ki | ||
) |
Return an id for the given constant, creating a new one if necessary.
Definition at line 385 of file KModule.cpp.
References constantMap, constants, and getKConstant().
Referenced by getOperandNum().
KConstant * KModule::getKConstant | ( | const llvm::Constant * | c | ) |
Definition at line 378 of file KModule.cpp.
References constantMap.
Referenced by getConstantID().
void KModule::instrument | ( | const Interpreter::ModuleOptions & | opts | ) |
Definition at line 227 of file KModule.cpp.
References klee::Interpreter::ModuleOptions::CheckDivZero, klee::Interpreter::ModuleOptions::CheckOvershift, module, and targetData.
bool KModule::link | ( | std::vector< std::unique_ptr< llvm::Module > > & | modules, |
const std::string & | entryPoint | ||
) |
Link the provided modules together as one KLEE module.
If the entry point is empty, all modules are linked together. If the entry point is not empty, all modules are linked which resolve the dependencies of the module containing entryPoint
modules | list of modules to be linked together |
entryPoint | name of the function which acts as the program's entry point |
Definition at line 210 of file KModule.cpp.
References klee::klee_error(), klee::linkModules(), module, and targetData.
void KModule::manifest | ( | InterpreterHandler * | ih, |
bool | forceSourceOutput | ||
) |
Manifest the generated module (e.g. assembly.ll, output.bc) and prepares KModule
ih | |
forceSourceOutput | true if assembly.ll should be created |
Definition at line 297 of file KModule.cpp.
References escapingFunctions, klee::functionEscapes(), functionMap, functions, klee::KInstruction::info, infos, klee::KInstruction::inst, module, and klee::InterpreterHandler::openOutputFile().
void KModule::optimiseAndPrepare | ( | const Interpreter::ModuleOptions & | opts, |
llvm::ArrayRef< const char * > | preservedFunctions | ||
) |
Optimise and prepare module such that KLEE can execute it.
Definition at line 252 of file KModule.cpp.
References addInternalFunction(), klee::Interpreter::ModuleOptions::CheckDivZero, klee::Interpreter::ModuleOptions::CheckOvershift, klee::Interpreter::ModuleOptions::EntryPoint, injectStaticConstructorsAndDestructors(), klee::klee_error(), module, klee::Interpreter::ModuleOptions::Optimize, llvm::Optimize(), and targetData.
std::map<const llvm::Constant *, std::unique_ptr<KConstant> > klee::KModule::constantMap |
Definition at line 99 of file KModule.h.
Referenced by getConstantID(), and getKConstant().
std::vector<llvm::Constant*> klee::KModule::constants |
Definition at line 98 of file KModule.h.
Referenced by getConstantID().
std::set<llvm::Function*> klee::KModule::escapingFunctions |
Definition at line 94 of file KModule.h.
Referenced by klee::StatsTracker::computeReachableUncovered(), and manifest().
std::map<llvm::Function*, KFunction*> klee::KModule::functionMap |
Definition at line 90 of file KModule.h.
Referenced by manifest().
std::vector<std::unique_ptr<KFunction> > klee::KModule::functions |
Definition at line 89 of file KModule.h.
Referenced by manifest(), and klee::StatsTracker::StatsTracker().
std::unique_ptr<InstructionInfoTable> klee::KModule::infos |
Definition at line 96 of file KModule.h.
Referenced by klee::StatsTracker::computeReachableUncovered(), manifest(), and klee::StatsTracker::StatsTracker().
std::set<const llvm::Function*> klee::KModule::internalFunctions |
Definition at line 105 of file KModule.h.
Referenced by addInternalFunction().
std::unique_ptr<llvm::Module> klee::KModule::module |
Definition at line 85 of file KModule.h.
Referenced by addInternalFunction(), checkModule(), klee::StatsTracker::computeReachableUncovered(), instrument(), link(), manifest(), and optimiseAndPrepare().
std::unique_ptr<llvm::DataLayout> klee::KModule::targetData |
Definition at line 86 of file KModule.h.
Referenced by instrument(), link(), and optimiseAndPrepare().