Static Value-Flow Analysis
|
#include <LLVMModule.h>
Static Public Member Functions | |
static LLVMModuleSet * | getLLVMModuleSet () |
static void | releaseLLVMModuleSet () |
static SVFModule * | buildSVFModule (Module &mod) |
static SVFModule * | buildSVFModule (const std::vector< std::string > &moduleNameVec) |
static void | preProcessBCs (std::vector< std::string > &moduleNameVec) |
Private Member Functions | |
LLVMModuleSet () | |
Constructor. More... | |
void | build () |
SVFType * | addSVFTypeInfo (const Type *t) |
Create SVFTypes. More... | |
StInfo * | collectTypeInfo (const Type *ty) |
Collect a type info. More... | |
StInfo * | collectStructInfo (const StructType *structTy, u32_t &numFields) |
Collect the struct info and set the number of fields after flattening. More... | |
StInfo * | collectArrayInfo (const ArrayType *T) |
Collect the array info. More... | |
StInfo * | collectSimpleTypeInfo (const Type *T) |
Collect simple type (non-aggregate) info. More... | |
std::vector< const Function * > | getLLVMGlobalFunctions (const GlobalVariable *global) |
void | loadModules (const std::vector< std::string > &moduleNameVec) |
void | loadExtAPIModules () |
void | addSVFMain () |
void | createSVFDataStructure () |
void | createSVFFunction (const Function *func) |
void | initSVFFunction () |
void | initSVFBasicBlock (const Function *func) |
void | initDomTree (SVFFunction *func, const Function *f) |
void | setValueAttr (const Value *val, SVFValue *value) |
void | setValueAttr (const Value *val, SVFBaseNode *svfBaseNode) |
void | buildFunToFunMap () |
void | buildGlobalDefToRepMap () |
void | prePassSchedule () |
Invoke llvm passes to modify module. More... | |
void | buildSymbolTable () const |
void | collectExtFunAnnotations (const Module *mod) |
CallICFGNode * | getCallBlock (const Instruction *cs) |
Get/Add a call node. More... | |
RetICFGNode * | getRetBlock (const Instruction *cs) |
Get/Add a return node. More... | |
IntraICFGNode * | getIntraBlock (const Instruction *inst) |
FunEntryICFGNode * | getFunEntryBlock (const Function *fun) |
Get/Add a function entry node. More... | |
FunExitICFGNode * | getFunExitBlock (const Function *fun) |
Get/Add a function exit node. More... | |
Static Private Attributes | |
static LLVMModuleSet * | llvmModuleSet = nullptr |
static bool | preProcessed = false |
Friends | |
class | SVFIRBuilder |
class | ICFGBuilder |
Definition at line 44 of file LLVMModule.h.
typedef Map<const Instruction*, CallICFGNode *> SVF::LLVMModuleSet::CSToCallNodeMapTy |
Definition at line 68 of file LLVMModule.h.
typedef Map<const Instruction*, RetICFGNode *> SVF::LLVMModuleSet::CSToRetNodeMapTy |
Definition at line 69 of file LLVMModule.h.
typedef Map<std::string, std::vector<std::string> > SVF::LLVMModuleSet::Fun2AnnoMap |
Definition at line 66 of file LLVMModule.h.
typedef std::vector<const Function*> SVF::LLVMModuleSet::FunctionSetType |
Definition at line 51 of file LLVMModule.h.
typedef Map<const Function*, const Function*> SVF::LLVMModuleSet::FunDeclToDefMapTy |
Definition at line 52 of file LLVMModule.h.
typedef Map<const Function*, FunctionSetType> SVF::LLVMModuleSet::FunDefToDeclsMapTy |
Definition at line 53 of file LLVMModule.h.
typedef Map<const Function*, FunEntryICFGNode *> SVF::LLVMModuleSet::FunToFunEntryNodeMapTy |
Definition at line 71 of file LLVMModule.h.
typedef Map<const Function*, FunExitICFGNode *> SVF::LLVMModuleSet::FunToFunExitNodeMapTy |
Definition at line 72 of file LLVMModule.h.
typedef Map<const GlobalVariable*, GlobalVariable*> SVF::LLVMModuleSet::GlobalDefToRepMapTy |
Definition at line 54 of file LLVMModule.h.
typedef Map<const Instruction*, IntraICFGNode *> SVF::LLVMModuleSet::InstToBlockNodeMapTy |
Definition at line 70 of file LLVMModule.h.
typedef Map<const Argument*, SVFArgument*> SVF::LLVMModuleSet::LLVMArgument2SVFArgumentMap |
Definition at line 59 of file LLVMModule.h.
typedef Map<const BasicBlock*, SVFBasicBlock*> SVF::LLVMModuleSet::LLVMBB2SVFBBMap |
Definition at line 57 of file LLVMModule.h.
typedef Map<const Constant*, SVFConstant*> SVF::LLVMModuleSet::LLVMConst2SVFConstMap |
Definition at line 60 of file LLVMModule.h.
typedef Map<const Function*, SVFFunction*> SVF::LLVMModuleSet::LLVMFun2SVFFunMap |
Definition at line 56 of file LLVMModule.h.
typedef Map<const Instruction*, SVFInstruction*> SVF::LLVMModuleSet::LLVMInst2SVFInstMap |
Definition at line 58 of file LLVMModule.h.
typedef Map<const Type*, SVFType*> SVF::LLVMModuleSet::LLVMType2SVFTypeMap |
Definition at line 64 of file LLVMModule.h.
typedef Map<const Value*, SVFOtherValue*> SVF::LLVMModuleSet::LLVMValue2SVFOtherValueMap |
Definition at line 61 of file LLVMModule.h.
typedef Map<const SVFBaseNode*, const Value*> SVF::LLVMModuleSet::SVFBaseNode2LLVMValueMap |
Definition at line 63 of file LLVMModule.h.
typedef Map<const SVFValue*, const Value*> SVF::LLVMModuleSet::SVFValue2LLVMValueMap |
Definition at line 62 of file LLVMModule.h.
typedef Map<const Type*, StInfo*> SVF::LLVMModuleSet::Type2TypeInfoMap |
Definition at line 65 of file LLVMModule.h.
|
private |
Constructor.
Definition at line 80 of file LLVMModule.cpp.
LLVMModuleSet::~LLVMModuleSet | ( | ) |
Definition at line 86 of file LLVMModule.cpp.
|
inline |
Definition at line 183 of file LLVMModule.h.
|
inline |
Definition at line 173 of file LLVMModule.h.
|
inline |
Definition at line 198 of file LLVMModule.h.
|
inline |
Definition at line 168 of file LLVMModule.h.
|
inline |
Definition at line 188 of file LLVMModule.h.
|
inline |
Definition at line 178 of file LLVMModule.h.
|
inline |
Definition at line 203 of file LLVMModule.h.
|
inline |
Definition at line 208 of file LLVMModule.h.
|
private |
Definition at line 714 of file LLVMModule.cpp.
Create SVFTypes.
Definition at line 1483 of file LLVMModule.cpp.
|
private |
Definition at line 159 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 876 of file LLVMModule.cpp.
|
private |
Definition at line 1145 of file LLVMModule.cpp.
|
static |
Definition at line 119 of file LLVMModule.cpp.
Definition at line 102 of file LLVMModule.cpp.
|
private |
building symbol table
Definition at line 144 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 1545 of file LLVMModule.cpp.
|
private |
Non-opaque pointer
Opaque pointer
Definition at line 808 of file LLVMModule.cpp.
Collect simple type (non-aggregate) info.
Collect simple type (non-aggregate) info
Only one field
Definition at line 1665 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 1608 of file LLVMModule.cpp.
Collect a type info.
Definition at line 1451 of file LLVMModule.cpp.
|
private |
Function
then traverse candidate sets
GlobalVariable
GlobalAlias
GlobalIFunc
Definition at line 179 of file LLVMModule.cpp.
|
private |
Definition at line 252 of file LLVMModule.cpp.
void LLVMModuleSet::dumpModulesToFile | ( | const std::string & | suffix | ) |
Definition at line 1188 of file LLVMModule.cpp.
|
inline |
Definition at line 355 of file LLVMModule.h.
|
inlineprivate |
Get/Add a call node.
Definition at line 406 of file LLVMModule.h.
CallICFGNode * LLVMModuleSet::getCallICFGNode | ( | const Instruction * | cs | ) |
get a call node
Definition at line 1426 of file LLVMModule.cpp.
|
inline |
Definition at line 349 of file LLVMModule.h.
|
inlineprivate |
Get/Add a function entry node.
Definition at line 432 of file LLVMModule.h.
|
inline |
Add a function entry node.
Definition at line 305 of file LLVMModule.h.
|
inlineprivate |
Get/Add a function exit node.
Definition at line 441 of file LLVMModule.h.
|
inline |
Add a function exit node.
Definition at line 312 of file LLVMModule.h.
|
inline |
Definition at line 327 of file LLVMModule.h.
|
inline |
Definition at line 367 of file LLVMModule.h.
ICFGNode * LLVMModuleSet::getICFGNode | ( | const Instruction * | inst | ) |
Get a basic block ICFGNode.
Definition at line 1399 of file LLVMModule.cpp.
|
inlineprivate |
Definition at line 423 of file LLVMModule.h.
IntraICFGNode * LLVMModuleSet::getIntraICFGNode | ( | const Instruction * | inst | ) |
get a intra node
Definition at line 1444 of file LLVMModule.cpp.
|
private |
Definition at line 625 of file LLVMModule.cpp.
|
inline |
Definition at line 149 of file LLVMModule.h.
|
inlinestatic |
Definition at line 118 of file LLVMModule.h.
Get LLVM Type.
Definition at line 1370 of file LLVMModule.cpp.
|
inline |
Definition at line 223 of file LLVMModule.h.
Definition at line 216 of file LLVMModule.h.
|
inline |
Definition at line 334 of file LLVMModule.h.
Definition at line 154 of file LLVMModule.h.
|
inline |
Definition at line 144 of file LLVMModule.h.
Definition at line 159 of file LLVMModule.h.
SVFConstant * LLVMModuleSet::getOtherSVFConstant | ( | const Constant * | oc | ) |
Definition at line 1312 of file LLVMModule.cpp.
|
inlineprivate |
Get/Add a return node.
Definition at line 415 of file LLVMModule.h.
RetICFGNode * LLVMModuleSet::getRetICFGNode | ( | const Instruction * | cs | ) |
get a return node
Definition at line 1435 of file LLVMModule.cpp.
|
inline |
Definition at line 251 of file LLVMModule.h.
|
inline |
Definition at line 237 of file LLVMModule.h.
SVFConstantData * LLVMModuleSet::getSVFConstantData | ( | const ConstantData * | cd | ) |
bitwidth == 1 : cint has value from getZExtValue() because bool true
will be translated to -1 using sign extension (i.e., getSExtValue). bitwidth <=64 1 : cint has value from getSExtValue() bitwidth >64 1 : cint has value 0 because it represents an invalid int
Definition at line 1247 of file LLVMModule.cpp.
|
inline |
Definition at line 230 of file LLVMModule.h.
|
inline |
|
inline |
Definition at line 258 of file LLVMModule.h.
|
inline |
Definition at line 244 of file LLVMModule.h.
|
inline |
Definition at line 137 of file LLVMModule.h.
SVFOtherValue * LLVMModuleSet::getSVFOtherValue | ( | const Value * | ov | ) |
Definition at line 1328 of file LLVMModule.cpp.
Get or create SVFType and typeinfo.
Get or create SVFType and typeinfo
Definition at line 1384 of file LLVMModule.cpp.
Definition at line 1347 of file LLVMModule.cpp.
ObjTypeInference * LLVMModuleSet::getTypeInference | ( | ) |
Definition at line 97 of file LLVMModule.cpp.
|
inline |
bool LLVMModuleSet::hasICFGNode | ( | const Instruction * | inst | ) |
Definition at line 1413 of file LLVMModule.cpp.
|
private |
Definition at line 403 of file LLVMModule.cpp.
|
private |
set exit block: exit basic block must have no successors and have a return instruction
Definition at line 329 of file LLVMModule.cpp.
|
private |
Function
Definition at line 311 of file LLVMModule.cpp.
|
private |
Definition at line 586 of file LLVMModule.cpp.
|
private |
Definition at line 521 of file LLVMModule.cpp.
|
private |
Invoke llvm passes to modify module.
Invoke llvm passes to modify module
BreakConstantGEPs Pass
MergeFunctionRets Pass
Definition at line 476 of file LLVMModule.cpp.
|
static |
Definition at line 500 of file LLVMModule.cpp.
|
inlinestatic |
Definition at line 125 of file LLVMModule.h.
|
private |
Definition at line 1241 of file LLVMModule.cpp.
Definition at line 1213 of file LLVMModule.cpp.
|
friend |
Definition at line 47 of file LLVMModule.h.
|
friend |
Definition at line 46 of file LLVMModule.h.
|
private |
Definition at line 108 of file LLVMModule.h.
|
private |
map a callsite to its CallICFGNode
Definition at line 103 of file LLVMModule.h.
|
private |
map a callsite to its RetICFGNode
Definition at line 104 of file LLVMModule.h.
|
private |
Record annotations of function in extapi.bc.
Definition at line 87 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 85 of file LLVMModule.h.
|
private |
map a function to its FunExitICFGNode
Definition at line 106 of file LLVMModule.h.
|
private |
map a function to its FunEntryICFGNode
Definition at line 107 of file LLVMModule.h.
|
private |
Global definition to a rep definition map.
Definition at line 89 of file LLVMModule.h.
|
private |
Definition at line 79 of file LLVMModule.h.
|
private |
map a basic block to its ICFGNode
Definition at line 105 of file LLVMModule.h.
|
private |
Definition at line 94 of file LLVMModule.h.
|
private |
Definition at line 92 of file LLVMModule.h.
|
private |
Definition at line 95 of file LLVMModule.h.
|
private |
Map an LLVM Function to an SVF Function.
Definition at line 91 of file LLVMModule.h.
|
private |
Definition at line 93 of file LLVMModule.h.
|
staticprivate |
Definition at line 75 of file LLVMModule.h.
|
private |
Definition at line 98 of file LLVMModule.h.
|
private |
Definition at line 96 of file LLVMModule.h.
|
private |
Definition at line 82 of file LLVMModule.h.
|
private |
Definition at line 80 of file LLVMModule.h.
|
private |
Definition at line 81 of file LLVMModule.h.
|
staticprivate |
Definition at line 76 of file LLVMModule.h.
|
private |
Definition at line 102 of file LLVMModule.h.
|
private |
Borrowed from singleton SVFModule::svfModule.
Definition at line 78 of file LLVMModule.h.
|
private |
Definition at line 97 of file LLVMModule.h.
|
private |
Definition at line 77 of file LLVMModule.h.
|
private |
Definition at line 99 of file LLVMModule.h.
|
private |
Definition at line 100 of file LLVMModule.h.