30#ifndef INCLUDE_SVF_FE_LLVMMODULE_H_
31#define INCLUDE_SVF_FE_LLVMMODULE_H_
42class ObjTypeInference;
83 std::vector<std::reference_wrapper<Module>>
modules;
213 if (
auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(
glob);
290 if (
auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(
g);
297 assert(SVFUtil::isa<SVFGlobalValue>(
it->second) &&
"not a SVFGlobal type!");
298 return SVFUtil::cast<SVFGlobalValue>(
it->second);
314 fun = mod->getFunction(
name);
338 assert(
b &&
"Function entry not created?");
345 assert(
b &&
"Function exit not created?");
369 Module&
module = getModuleRef(i);
375 assert(
false &&
"no main module found!");
std::string getExtBcPath()
static ExtAPI * getExtAPI()
void addOtherValueMap(const Value *ov, SVFOtherValue *svfov)
void createSVFFunction(const Function *func)
IntraICFGNode * getIntraBlock(const Instruction *inst)
Map< const Instruction *, SVFInstruction * > LLVMInst2SVFInstMap
LLVMType2SVFTypeMap LLVMType2SVFType
std::vector< const Function * > getLLVMGlobalFunctions(const GlobalVariable *global)
bool hasGlobalRep(const GlobalVariable *val) const
Global to rep.
SVFOtherValue * getSVFOtherValue(const Value *ov)
LLVMBB2SVFBBMap LLVMBB2SVFBB
const SVFFunction * getSVFFunction(const std::string &name)
Get the corresponding Function based on its name.
FunExitICFGNode * getFunExitBlock(const Function *fun)
Get/Add a function exit node.
void buildSymbolTable() const
std::vector< const Function * > FunctionSetType
void addInstructionMap(const Instruction *inst, SVFInstruction *svfInst)
Module * getMainLLVMModule() const
LLVMFun2CallGraphNodeMap LLVMFunc2CallGraphNode
Map an LLVM Function to an CallGraph Node.
StInfo * collectTypeInfo(const Type *ty)
Collect a type info.
void initSVFBasicBlock(const Function *func)
Map< const Value *, SVFOtherValue * > LLVMValue2SVFOtherValueMap
InstToBlockNodeMapTy InstToBlockNodeMap
map a basic block to its ICFGNode
static LLVMModuleSet * getLLVMModuleSet()
GlobalVariable * getGlobalRep(const GlobalVariable *val) const
SVFConstantData * getSVFConstantData(const ConstantData *cd)
Map< const Function *, FunEntryICFGNode * > FunToFunEntryNodeMapTy
void loadModules(const std::vector< std::string > &moduleNameVec)
ObjTypeInference * typeInference
static void releaseLLVMModuleSet()
static void preProcessBCs(std::vector< std::string > &moduleNameVec)
Module & getModuleRef(u32_t idx) const
FunEntryICFGNode * getFunEntryICFGNode(const Function *fun)
Add a function entry node.
void addInstructionMap(const Instruction *inst, CallICFGNode *svfInst)
Map< const Type *, StInfo * > Type2TypeInfoMap
void addInstructionMap(const Instruction *inst, RetICFGNode *svfInst)
void addToLLVMVal2SVFVarMap(const Value *val, SVFBaseNode *svfBaseNode)
void addBasicBlockMap(const BasicBlock *bb, SVFBasicBlock *svfBB)
Map< const BasicBlock *, SVFBasicBlock * > LLVMBB2SVFBBMap
DominatorTree & getDomTree(const Function *fun)
LLVMInst2SVFInstMap LLVMInst2SVFInst
SVFModule * svfModule
Borrowed from singleton SVFModule::svfModule.
RetICFGNode * getRetBlock(const Instruction *cs)
Get/Add a return node.
std::unique_ptr< LLVMContext > owned_ctx
LLVMConst2SVFConstMap LLVMConst2SVFConst
void createSVFDataStructure()
Map< const GlobalVariable *, GlobalVariable * > GlobalDefToRepMapTy
StInfo * collectSimpleTypeInfo(const Type *T)
Collect simple type (non-aggregate) info.
SymbolTableInfo * symInfo
CallGraphNode * getCallGraphNode(const Function *fun) const
void addArgumentMap(const Argument *arg, SVFArgument *svfArg)
Map< const Instruction *, RetICFGNode * > CSToRetNodeMapTy
Map< const Instruction *, IntraICFGNode * > InstToBlockNodeMapTy
const Value * getLLVMValue(const SVFValue *value) const
void addOtherConstantMap(const Constant *cons, SVFConstant *svfcons)
SVFType * getSVFType(const Type *T)
Get or create SVFType and typeinfo.
const Type * getLLVMType(const SVFType *T) const
Get LLVM Type.
Map< const Function *, FunExitICFGNode * > FunToFunExitNodeMapTy
bool hasICFGNode(const Instruction *inst)
CallICFGNode * getCallBlock(const Instruction *cs)
Get/Add a call node.
ICFGNode * getICFGNode(const Instruction *inst)
Get a basic block ICFGNode.
SVFBasicBlock * getSVFBasicBlock(const BasicBlock *bb) const
SVFConstant * getOtherSVFConstant(const Constant *oc)
SVFArgument * getSVFArgument(const Argument *arg) const
CallICFGNode * getCallICFGNode(const Instruction *cs)
get a call node
Fun2AnnoMap ExtFun2Annotations
Record annotations of function in extapi.bc.
void setValueAttr(const Value *val, SVFValue *value)
void addGlobalValueMap(const GlobalValue *glob, SVFGlobalValue *svfglob)
SVFValue2LLVMValueMap SVFValue2LLVMValue
LLVMArgument2SVFArgumentMap LLVMArgument2SVFArgument
Module * getModule(u32_t idx) const
RetICFGNode * getRetICFGNode(const Instruction *cs)
get a return node
void prePassSchedule()
Invoke llvm passes to modify module.
void initDomTree(SVFFunction *func, const Function *f)
StInfo * collectStructInfo(const StructType *structTy, u32_t &numFields)
Collect the struct info and set the number of fields after flattening.
CSToCallNodeMapTy CSToCallNodeMap
map a callsite to its CallICFGNode
SVFFunction * getSVFFunction(const Function *fun) const
const std::vector< std::reference_wrapper< Module > > & getLLVMModules() const
LLVMContext & getContext() const
Map< const Function *, DominatorTree > FunToDominatorTree
CSToRetNodeMapTy CSToRetNodeMap
map a callsite to its RetICFGNode
LLVMFun2SVFFunMap LLVMFunc2SVFFunc
Map an LLVM Function to an SVF Function.
SVFBaseNode2LLVMValueMap SVFBaseNode2LLVMValue
FunExitICFGNode * getFunExitICFGNode(const Function *fun)
Add a function exit node.
Map< const SVFValue *, const Value * > SVFValue2LLVMValueMap
StInfo * collectArrayInfo(const ArrayType *T)
Collect the array info.
LLVMModuleSet()
Constructor.
void buildGlobalDefToRepMap()
SVFType * addSVFTypeInfo(const Type *t)
Create SVFTypes.
SVFGlobalValue * getSVFGlobalValue(const GlobalValue *g) const
FunEntryICFGNode * getFunEntryBlock(const Function *fun)
Get/Add a function entry node.
void addFunctionMap(const Function *func, SVFFunction *svfFunc)
Map< const Instruction *, CallICFGNode * > CSToCallNodeMapTy
void addInstructionMap(const Instruction *inst, IntraICFGNode *svfInst)
FunctionSetType ExtFuncsVec
Record some "sse_" function declarations used in other ext function definition, e....
Map< const Argument *, SVFArgument * > LLVMArgument2SVFArgumentMap
FunToFunEntryNodeMapTy FunToFunEntryNodeMap
map a function to its FunExitICFGNode
const Value * getLLVMValue(const SVFBaseNode *value) const
Map< const Constant *, SVFConstant * > LLVMConst2SVFConstMap
SVFModule * getSVFModule()
LLVMValue2SVFOtherValueMap LLVMValue2SVFOtherValue
static LLVMModuleSet * llvmModuleSet
IntraICFGNode * getIntraICFGNode(const Instruction *inst)
get a intra node
Map< const SVFBaseNode *, const Value * > SVFBaseNode2LLVMValueMap
std::vector< std::reference_wrapper< Module > > modules
Map< const Function *, const Function * > FunDeclToDefMapTy
Map< const Function *, SVFFunction * > LLVMFun2SVFFunMap
FunToFunExitNodeMapTy FunToFunExitNodeMap
map a function to its FunEntryICFGNode
SVFInstruction * getSVFInstruction(const Instruction *inst) const
Map< std::string, std::vector< std::string > > Fun2AnnoMap
u32_t getModuleNum() const
GlobalDefToRepMapTy GlobalDefToRepMap
Global definition to a rep definition map.
std::vector< std::unique_ptr< Module > > owned_modules
static SVFModule * buildSVFModule(Module &mod)
Map< const Function *, CallGraphNode * > LLVMFun2CallGraphNodeMap
Map< const Type *, SVFType * > LLVMType2SVFTypeMap
Type2TypeInfoMap Type2TypeInfo
Map< const Function *, FunctionSetType > FunDefToDeclsMapTy
void dumpModulesToFile(const std::string &suffix)
void addConstantDataMap(const ConstantData *cd, SVFConstantData *svfcd)
void collectExtFunAnnotations(const Module *mod)
ObjTypeInference * getTypeInference()
SVFValue * getSVFValue(const Value *value)
llvm::GlobalVariable GlobalVariable
llvm::ArrayType ArrayType
llvm::BasicBlock BasicBlock
llvm::StructType StructType
LLVM types.
llvm::GlobalValue GlobalValue
llvm::ConstantData ConstantData
llvm::Instruction Instruction
llvm::Value Value
LLVM Basic classes.
llvm::IRBuilder IRBuilder
llvm::DominatorTree DominatorTree
LLVM Dominators.
llvm::LLVMContext LLVMContext