|
Static Value-Flow Analysis
|
#include <LLVMModule.h>
Public Member Functions | |
| ~LLVMModuleSet () | |
| u32_t | getModuleNum () const |
| const std::vector< std::reference_wrapper< Module > > & | getLLVMModules () const |
| Module * | getModule (u32_t idx) const |
| Module & | getModuleRef (u32_t idx) const |
| void | dumpModulesToFile (const std::string &suffix) |
| const BasicBlock * | getFunExitBB (const Function *fun) const |
| const Function * | getRealDefFun (const Function *fun) const |
| const FunctionSet & | getFunctionSet () const |
| u32_t | getValueNodeNum () const |
| u32_t | getObjNodeNum () const |
| ValueToIDMapTy & | valSyms () |
| ValueToIDMapTy & | objSyms () |
| NodeID | getValueNode (const Value *V) |
| bool | hasValueNode (const Value *V) |
| NodeID | getObjectNode (const Value *V) |
| void | dumpSymTable () |
| void | addBasicBlock (FunObjVar *fun, const BasicBlock *bb) |
| void | addInstructionMap (const Instruction *inst, CallICFGNode *svfInst) |
| void | addInstructionMap (const Instruction *inst, RetICFGNode *svfInst) |
| void | addInstructionMap (const Instruction *inst, IntraICFGNode *svfInst) |
| bool | hasLLVMValue (const SVFValue *value) const |
| const Value * | getLLVMValue (const SVFValue *value) const |
| const FunObjVar * | getFunObjVar (const Function *fun) const |
| FunToIDMapTy & | retSyms () |
| FunToIDMapTy & | varargSyms () |
| NodeID | getReturnNode (const Function *func) const |
| NodeID | getVarargNode (const Function *func) const |
| SVFBasicBlock * | getSVFBasicBlock (const BasicBlock *bb) |
| const Function * | getFunction (const std::string &name) |
| Get the corresponding Function based on its name. | |
| const FunObjVar * | getFunObjVar (const std::string &name) |
| Get the corresponding Function based on its name. | |
| ICFGNode * | getICFGNode (const Instruction *inst) |
| Get a basic block ICFGNode. | |
| bool | hasICFGNode (const Instruction *inst) |
| CallICFGNode * | getCallICFGNode (const Instruction *cs) |
| get a call node | |
| RetICFGNode * | getRetICFGNode (const Instruction *cs) |
| get a return node | |
| IntraICFGNode * | getIntraICFGNode (const Instruction *inst) |
| get a intra node | |
| FunEntryICFGNode * | getFunEntryICFGNode (const Function *fun) |
| Add a function entry node. | |
| FunExitICFGNode * | getFunExitICFGNode (const Function *fun) |
| Add a function exit node. | |
| bool | hasGlobalRep (const GlobalVariable *val) const |
| Global to rep. | |
| GlobalVariable * | getGlobalRep (const GlobalVariable *val) const |
| Module * | getMainLLVMModule () const |
| TargetABI | getTargetABI () const |
| LLVMContext & | getContext () const |
| bool | empty () const |
| SVFType * | getSVFType (const Type *T) |
| Get or create SVFType and typeinfo. | |
| const Type * | getLLVMType (const SVFType *T) const |
| Get LLVM Type. | |
| ObjTypeInference * | getTypeInference () |
| DominatorTree & | getDomTree (const Function *fun) |
| std::string | getExtFuncAnnotation (const Function *fun, const std::string &funcAnnotation) |
| const std::vector< std::string > & | getExtFuncAnnotations (const Function *fun) |
| bool | hasExtFuncAnnotation (const Function *fun, const std::string &funcAnnotation) |
| bool | has_static (const Function *F) |
| bool | is_memcpy (const Function *F) |
| bool | is_memset (const Function *F) |
| bool | is_alloc (const Function *F) |
| bool | is_arg_alloc (const Function *F) |
| bool | is_alloc_stack_ret (const Function *F) |
| s32_t | get_alloc_arg_pos (const Function *F) |
| bool | is_realloc (const Function *F) |
| bool | is_ext (const Function *F) |
| void | setExtFuncAnnotations (const Function *fun, const std::vector< std::string > &funcAnnotations) |
Static Public Member Functions | |
| static LLVMModuleSet * | getLLVMModuleSet () |
| static void | releaseLLVMModuleSet () |
| static void | buildSVFModule (Module &mod) |
| static void | buildSVFModule (const std::vector< std::string > &moduleNameVec) |
| static void | preProcessBCs (std::vector< std::string > &moduleNameVec) |
Private Member Functions | |
| LLVMModuleSet () | |
| Constructor. | |
| void | build () |
| void | addFunctionSet (const Function *svfFunc) |
| void | setFunExitBB (const Function *fun, const BasicBlock *bb) |
| void | setFunRealDefFun (const Function *fun, const Function *realDefFun) |
| SVFType * | addSVFTypeInfo (const Type *t) |
| Create SVFTypes. | |
| StInfo * | collectTypeInfo (const Type *ty) |
| Collect a type info. | |
| StInfo * | collectStructInfo (const StructType *structTy, u32_t &numFields) |
| Collect the struct info and set the number of fields after flattening. | |
| StInfo * | collectArrayInfo (const ArrayType *T) |
| Collect the array info. | |
| StInfo * | collectSimpleTypeInfo (const Type *T) |
| Collect simple type (non-aggregate) info. | |
| std::vector< const Function * > | getLLVMGlobalFunctions (const GlobalVariable *global) |
| void | loadModules (const std::vector< std::string > &moduleNameVec) |
| void | loadExtAPIModules () |
| void | addSVFMain () |
| void | createSVFDataStructure () |
| void | addToSVFVar2LLVMValueMap (const Value *val, SVFValue *svfBaseNode) |
| void | buildFunToFunMap () |
| void | buildGlobalDefToRepMap () |
| void | prePassSchedule () |
| Invoke llvm passes to modify module. | |
| void | buildSymbolTable () const |
| void | collectExtFunAnnotations (const Module *mod) |
| CallICFGNode * | getCallBlock (const Instruction *cs) |
| Get/Add a call node. | |
| RetICFGNode * | getRetBlock (const Instruction *cs) |
| Get/Add a return node. | |
| IntraICFGNode * | getIntraBlock (const Instruction *inst) |
| FunEntryICFGNode * | getFunEntryBlock (const Function *fun) |
| Get/Add a function entry node. | |
| FunExitICFGNode * | getFunExitBlock (const Function *fun) |
| Get/Add a function exit node. | |
Static Private Attributes | |
| static LLVMModuleSet * | llvmModuleSet = nullptr |
| static bool | preProcessed = false |
Friends | |
| class | SVFIRBuilder |
| class | ICFGBuilder |
| class | SymbolTableBuilder |
Definition at line 47 of file LLVMModule.h.
| typedef Map<const Instruction*, CallICFGNode *> SVF::LLVMModuleSet::CSToCallNodeMapTy |
Definition at line 67 of file LLVMModule.h.
| typedef Map<const Instruction*, RetICFGNode *> SVF::LLVMModuleSet::CSToRetNodeMapTy |
Definition at line 68 of file LLVMModule.h.
| typedef Map<std::string, std::vector<std::string> > SVF::LLVMModuleSet::Fun2AnnoMap |
Definition at line 65 of file LLVMModule.h.
| typedef std::vector<const Function*> SVF::LLVMModuleSet::FunctionSet |
Definition at line 79 of file LLVMModule.h.
| typedef std::vector<const Function*> SVF::LLVMModuleSet::FunctionSetType |
Definition at line 55 of file LLVMModule.h.
| typedef Map<const Function*, const Function*> SVF::LLVMModuleSet::FunDeclToDefMapTy |
Definition at line 56 of file LLVMModule.h.
| typedef Map<const Function*, FunctionSetType> SVF::LLVMModuleSet::FunDefToDeclsMapTy |
Definition at line 57 of file LLVMModule.h.
| typedef Map<const Function*, const BasicBlock*> SVF::LLVMModuleSet::FunToExitBBMap |
Definition at line 80 of file LLVMModule.h.
| typedef Map<const Function*, FunEntryICFGNode *> SVF::LLVMModuleSet::FunToFunEntryNodeMapTy |
Definition at line 70 of file LLVMModule.h.
| typedef Map<const Function*, FunExitICFGNode *> SVF::LLVMModuleSet::FunToFunExitNodeMapTy |
Definition at line 71 of file LLVMModule.h.
| typedef OrderedMap<const Function*, NodeID> SVF::LLVMModuleSet::FunToIDMapTy |
Definition at line 77 of file LLVMModule.h.
| typedef Map<const Function*, const Function *> SVF::LLVMModuleSet::FunToRealDefFunMap |
Definition at line 81 of file LLVMModule.h.
| typedef Map<const GlobalVariable*, GlobalVariable*> SVF::LLVMModuleSet::GlobalDefToRepMapTy |
Definition at line 58 of file LLVMModule.h.
| typedef Map<const Instruction*, IntraICFGNode *> SVF::LLVMModuleSet::InstToBlockNodeMapTy |
Definition at line 69 of file LLVMModule.h.
| typedef Map<const BasicBlock*, SVFBasicBlock*> SVF::LLVMModuleSet::LLVMBB2SVFBBMap |
Definition at line 61 of file LLVMModule.h.
| typedef Map<const Function*, FunObjVar*> SVF::LLVMModuleSet::LLVMFun2FunObjVarMap |
Definition at line 60 of file LLVMModule.h.
| typedef Map<const Type*, SVFType*> SVF::LLVMModuleSet::LLVMType2SVFTypeMap |
Definition at line 63 of file LLVMModule.h.
| typedef Map<const SVFValue*, const Value*> SVF::LLVMModuleSet::SVFBaseNode2LLVMValueMap |
Definition at line 62 of file LLVMModule.h.
| typedef Map<const Type*, StInfo*> SVF::LLVMModuleSet::Type2TypeInfoMap |
Definition at line 64 of file LLVMModule.h.
| typedef OrderedMap<const Value*, NodeID> SVF::LLVMModuleSet::ValueToIDMapTy |
llvm value to sym id map local (%) and global (@) identifiers are pointer types which have a value node id.
Definition at line 75 of file LLVMModule.h.
|
private |
Constructor.
Definition at line 83 of file LLVMModule.cpp.
| LLVMModuleSet::~LLVMModuleSet | ( | ) |
Definition at line 88 of file LLVMModule.cpp.
|
inline |
Definition at line 239 of file LLVMModule.h.
|
inlineprivate |
Definition at line 452 of file LLVMModule.h.
|
inline |
Definition at line 246 of file LLVMModule.h.
|
inline |
Definition at line 256 of file LLVMModule.h.
|
inline |
Definition at line 251 of file LLVMModule.h.
|
private |
Definition at line 509 of file LLVMModule.cpp.
Create SVFTypes.
Definition at line 1288 of file LLVMModule.cpp.
Definition at line 1150 of file LLVMModule.cpp.
|
private |
Definition at line 163 of file LLVMModule.cpp.
|
private |
Keep svf_main() function and all the functions called in svf_main()
app functions
App Func decl -> SVF extern Func def
Overwrite App Func def -> SVF extern Func def
Definition at line 668 of file LLVMModule.cpp.
|
private |
Definition at line 1004 of file LLVMModule.cpp.
|
static |
Definition at line 125 of file LLVMModule.cpp.
|
static |
Definition at line 110 of file LLVMModule.cpp.
|
private |
building symbol table
Definition at line 148 of file LLVMModule.cpp.
Collect the array info.
Fill in StInfo for an array type.
array without any element (this is not true in C/C++ arrays) we assume there is an empty dummy element
Array's flatten field infor is the same as its element's flatten infor.
Flatten arrays, map each array element index i to flattened index (i * nfE * totalElemNum)/outArrayElemNum nfE>1 if the array element is a struct with more than one field.
Definition at line 1365 of file LLVMModule.cpp.
|
private |
Non-opaque pointer
Opaque pointer
Definition at line 600 of file LLVMModule.cpp.
Collect simple type (non-aggregate) info.
Collect simple type (non-aggregate) info
Only one field
Definition at line 1485 of file LLVMModule.cpp.
|
private |
Collect the struct info and set the number of fields after flattening.
Fill in struct_info for T. Given a Struct type, we recursively extend and record its fields and types.
The struct info should not be processed before
Definition at line 1428 of file LLVMModule.cpp.
Collect a type info.
Definition at line 1256 of file LLVMModule.cpp.
|
private |
set exit block: exit basic block must have no successors and have a return instruction
Definition at line 184 of file LLVMModule.cpp.
| void LLVMModuleSet::dumpModulesToFile | ( | const std::string & | suffix | ) |
Definition at line 1047 of file LLVMModule.cpp.
| void LLVMModuleSet::dumpSymTable | ( | ) |
Definition at line 1103 of file LLVMModule.cpp.
|
inline |
Definition at line 399 of file LLVMModule.h.
Definition at line 1569 of file LLVMModule.cpp.
|
inlineprivate |
Get/Add a call node.
Definition at line 495 of file LLVMModule.h.
| CallICFGNode * LLVMModuleSet::getCallICFGNode | ( | const Instruction * | cs | ) |
get a call node
Definition at line 1231 of file LLVMModule.cpp.
|
inline |
Definition at line 393 of file LLVMModule.h.
| DominatorTree & LLVMModuleSet::getDomTree | ( | const Function * | fun | ) |
Definition at line 101 of file LLVMModule.cpp.
| std::string LLVMModuleSet::getExtFuncAnnotation | ( | const Function * | fun, |
| const std::string & | funcAnnotation ) |
Definition at line 1518 of file LLVMModule.cpp.
| const std::vector< std::string > & LLVMModuleSet::getExtFuncAnnotations | ( | const Function * | fun | ) |
Definition at line 1531 of file LLVMModule.cpp.
|
inline |
Get the corresponding Function based on its name.
Definition at line 313 of file LLVMModule.h.
|
inline |
Definition at line 199 of file LLVMModule.h.
|
inlineprivate |
Get/Add a function entry node.
Definition at line 521 of file LLVMModule.h.
|
inline |
Add a function entry node.
Definition at line 344 of file LLVMModule.h.
|
inline |
Definition at line 185 of file LLVMModule.h.
|
inlineprivate |
Get/Add a function exit node.
Definition at line 530 of file LLVMModule.h.
|
inline |
Add a function exit node.
Definition at line 351 of file LLVMModule.h.
Definition at line 274 of file LLVMModule.h.
| const FunObjVar * LLVMModuleSet::getFunObjVar | ( | const std::string & | name | ) |
Get the corresponding Function based on its name.
Definition at line 1158 of file LLVMModule.cpp.
|
inline |
Definition at line 366 of file LLVMModule.h.
| ICFGNode * LLVMModuleSet::getICFGNode | ( | const Instruction * | inst | ) |
Get a basic block ICFGNode.
Definition at line 1204 of file LLVMModule.cpp.
|
inlineprivate |
Definition at line 512 of file LLVMModule.h.
| IntraICFGNode * LLVMModuleSet::getIntraICFGNode | ( | const Instruction * | inst | ) |
get a intra node
Definition at line 1249 of file LLVMModule.cpp.
|
private |
Definition at line 421 of file LLVMModule.cpp.
|
inline |
Definition at line 164 of file LLVMModule.h.
|
inlinestatic |
Definition at line 137 of file LLVMModule.h.
Get LLVM Type.
Definition at line 1175 of file LLVMModule.cpp.
Definition at line 267 of file LLVMModule.h.
|
inline |
Definition at line 373 of file LLVMModule.h.
Definition at line 169 of file LLVMModule.h.
|
inline |
Definition at line 159 of file LLVMModule.h.
Definition at line 174 of file LLVMModule.h.
getObject - Return the obj node id refer to the memory object for the specified global, heap or alloca instruction according to llvm value.
Definition at line 1093 of file LLVMModule.cpp.
|
inline |
Definition at line 209 of file LLVMModule.h.
Definition at line 192 of file LLVMModule.h.
|
inlineprivate |
Get/Add a return node.
Definition at line 504 of file LLVMModule.h.
| RetICFGNode * LLVMModuleSet::getRetICFGNode | ( | const Instruction * | cs | ) |
get a return node
Definition at line 1240 of file LLVMModule.cpp.
Definition at line 291 of file LLVMModule.h.
|
inline |
Definition at line 305 of file LLVMModule.h.
Get or create SVFType and typeinfo.
Get or create SVFType and typeinfo
Definition at line 1189 of file LLVMModule.cpp.
|
inline |
Definition at line 388 of file LLVMModule.h.
| ObjTypeInference * LLVMModuleSet::getTypeInference | ( | ) |
Definition at line 96 of file LLVMModule.cpp.
Get SVFIR Node according to LLVM value getNode - Return the node corresponding to the specified pointer.
Definition at line 1066 of file LLVMModule.cpp.
|
inline |
Definition at line 204 of file LLVMModule.h.
Definition at line 298 of file LLVMModule.h.
| bool SVF::LLVMModuleSet::has_static | ( | const Function * | F | ) |
| bool LLVMModuleSet::hasExtFuncAnnotation | ( | const Function * | fun, |
| const std::string & | funcAnnotation ) |
Definition at line 1505 of file LLVMModule.cpp.
|
inline |
Global to rep.
Definition at line 360 of file LLVMModule.h.
| bool LLVMModuleSet::hasICFGNode | ( | const Instruction * | inst | ) |
Definition at line 1218 of file LLVMModule.cpp.
|
inline |
Definition at line 262 of file LLVMModule.h.
| bool LLVMModuleSet::hasValueNode | ( | const Value * | V | ) |
Definition at line 1085 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_alloc | ( | const Function * | F | ) |
Definition at line 1552 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_alloc_stack_ret | ( | const Function * | F | ) |
Definition at line 1563 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_arg_alloc | ( | const Function * | F | ) |
Definition at line 1558 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_ext | ( | const Function * | F | ) |
Definition at line 1593 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_memcpy | ( | const Function * | F | ) |
Definition at line 1540 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_memset | ( | const Function * | F | ) |
Definition at line 1547 of file LLVMModule.cpp.
| bool LLVMModuleSet::is_realloc | ( | const Function * | F | ) |
Definition at line 1585 of file LLVMModule.cpp.
|
private |
Definition at line 382 of file LLVMModule.cpp.
|
private |
Definition at line 316 of file LLVMModule.cpp.
|
inline |
Definition at line 219 of file LLVMModule.h.
|
private |
Invoke llvm passes to modify module.
Invoke llvm passes to modify module
BreakConstantGEPs Pass
MergeFunctionRets Pass
Definition at line 259 of file LLVMModule.cpp.
|
static |
Definition at line 295 of file LLVMModule.cpp.
|
inlinestatic |
Definition at line 144 of file LLVMModule.h.
|
inline |
Definition at line 281 of file LLVMModule.h.
| void LLVMModuleSet::setExtFuncAnnotations | ( | const Function * | fun, |
| const std::vector< std::string > & | funcAnnotations ) |
Definition at line 1499 of file LLVMModule.cpp.
|
inlineprivate |
Definition at line 457 of file LLVMModule.h.
|
inlineprivate |
Definition at line 462 of file LLVMModule.h.
|
inline |
Definition at line 214 of file LLVMModule.h.
|
inline |
Definition at line 286 of file LLVMModule.h.
|
friend |
Definition at line 50 of file LLVMModule.h.
|
friend |
Definition at line 49 of file LLVMModule.h.
|
friend |
Definition at line 51 of file LLVMModule.h.
|
private |
map a callsite to its CallICFGNode
Definition at line 112 of file LLVMModule.h.
|
private |
map a callsite to its RetICFGNode
Definition at line 113 of file LLVMModule.h.
|
private |
Record annotations of function in extapi.bc.
Definition at line 97 of file LLVMModule.h.
|
private |
Record some "sse_" function declarations used in other ext function definition, e.g., svf_ext_foo(), and svf_ext_foo() used in app functions.
Definition at line 95 of file LLVMModule.h.
Definition at line 100 of file LLVMModule.h.
|
private |
Definition at line 125 of file LLVMModule.h.
|
private |
Definition at line 118 of file LLVMModule.h.
|
private |
Definition at line 126 of file LLVMModule.h.
|
private |
map a function to its FunExitICFGNode
Definition at line 115 of file LLVMModule.h.
|
private |
map a function to its FunEntryICFGNode
Definition at line 116 of file LLVMModule.h.
|
private |
Definition at line 127 of file LLVMModule.h.
|
private |
Global definition to a rep definition map.
Definition at line 103 of file LLVMModule.h.
|
private |
map a basic block to its ICFGNode
Definition at line 114 of file LLVMModule.h.
|
private |
Definition at line 106 of file LLVMModule.h.
|
private |
Map an LLVM Function to an SVF Funobjvar.
Definition at line 105 of file LLVMModule.h.
|
staticprivate |
Definition at line 84 of file LLVMModule.h.
|
private |
Definition at line 107 of file LLVMModule.h.
|
private |
Definition at line 89 of file LLVMModule.h.
|
private |
map a obj reference to its sym id
Definition at line 121 of file LLVMModule.h.
|
private |
Definition at line 87 of file LLVMModule.h.
|
private |
Definition at line 88 of file LLVMModule.h.
|
staticprivate |
Definition at line 85 of file LLVMModule.h.
|
private |
return map
Definition at line 122 of file LLVMModule.h.
|
private |
Definition at line 111 of file LLVMModule.h.
|
private |
Definition at line 86 of file LLVMModule.h.
|
private |
C++ ABI of the module being analyzed.
Definition at line 92 of file LLVMModule.h.
|
private |
Definition at line 108 of file LLVMModule.h.
|
private |
Definition at line 109 of file LLVMModule.h.
|
private |
map a value to its sym id
Definition at line 120 of file LLVMModule.h.
|
private |
vararg map
Definition at line 123 of file LLVMModule.h.