klee
klee::KModule Class Reference

#include <KModule.h>

Public Member Functions

KConstantgetKConstant (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< InstructionInfoTableinfos
 
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)
 

Detailed Description

Definition at line 83 of file KModule.h.

Constructor & Destructor Documentation

◆ KModule()

klee::KModule::KModule ( )
default

Member Function Documentation

◆ addInternalFunction()

void KModule::addInternalFunction ( const char *  functionName)
private

Definition at line 199 of file KModule.cpp.

References internalFunctions, klee::klee_message(), klee::klee_warning(), and module.

Referenced by optimiseAndPrepare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkModule()

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.

Here is the call graph for this function:

◆ getConstantID()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKConstant()

KConstant * KModule::getKConstant ( const llvm::Constant *  c)

Definition at line 378 of file KModule.cpp.

References constantMap.

Referenced by getConstantID().

Here is the caller graph for this function:

◆ instrument()

◆ link()

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

Parameters
moduleslist of modules to be linked together
entryPointname of the function which acts as the program's entry point
Returns
true if at least one module has been linked in, false if nothing changed

Definition at line 210 of file KModule.cpp.

References klee::klee_error(), klee::linkModules(), module, and targetData.

Here is the call graph for this function:

◆ manifest()

void KModule::manifest ( InterpreterHandler ih,
bool  forceSourceOutput 
)

Manifest the generated module (e.g. assembly.ll, output.bc) and prepares KModule

Parameters
ih
forceSourceOutputtrue 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().

Here is the call graph for this function:

◆ optimiseAndPrepare()

void KModule::optimiseAndPrepare ( const Interpreter::ModuleOptions opts,
llvm::ArrayRef< const char * >  preservedFunctions 
)

Member Data Documentation

◆ constantMap

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().

◆ constants

std::vector<llvm::Constant*> klee::KModule::constants

Definition at line 98 of file KModule.h.

Referenced by getConstantID().

◆ constantTable

std::unique_ptr<Cell[]> klee::KModule::constantTable

Definition at line 102 of file KModule.h.

◆ escapingFunctions

std::set<llvm::Function*> klee::KModule::escapingFunctions

Definition at line 94 of file KModule.h.

Referenced by klee::StatsTracker::computeReachableUncovered(), and manifest().

◆ functionMap

std::map<llvm::Function*, KFunction*> klee::KModule::functionMap

Definition at line 90 of file KModule.h.

Referenced by manifest().

◆ functions

std::vector<std::unique_ptr<KFunction> > klee::KModule::functions

Definition at line 89 of file KModule.h.

Referenced by manifest(), and klee::StatsTracker::StatsTracker().

◆ infos

std::unique_ptr<InstructionInfoTable> klee::KModule::infos

◆ internalFunctions

std::set<const llvm::Function*> klee::KModule::internalFunctions

Definition at line 105 of file KModule.h.

Referenced by addInternalFunction().

◆ module

std::unique_ptr<llvm::Module> klee::KModule::module

◆ targetData

std::unique_ptr<llvm::DataLayout> klee::KModule::targetData

Definition at line 86 of file KModule.h.

Referenced by instrument(), link(), and optimiseAndPrepare().


The documentation for this class was generated from the following files: