Static Value-Flow Analysis
|
#include <SymbolTableInfo.h>
Public Types | |
enum | SYMTYPE { NullPtr , BlkPtr , BlackHole , ConstantObj , ValSymbol , ObjSymbol , RetSymbol , VarargSymbol } |
Symbol types. More... | |
typedef OrderedMap< const SVFValue *, SymID > | ValueToIDMapTy |
various maps defined | |
typedef OrderedMap< SymID, MemObj * > | IDToMemMapTy |
sym id to memory object map | |
typedef OrderedMap< const SVFFunction *, SymID > | FunToIDMapTy |
function to sym id map | |
typedef Set< const SVFType * > | SVFTypeSet |
struct type to struct info map | |
Static Public Member Functions | |
static SymbolTableInfo * | SymbolInfo () |
Singleton design here to make sure we only have one instance during any analysis. | |
static void | releaseSymbolInfo () |
static bool | isBlkPtr (NodeID id) |
special value | |
static bool | isNullPtr (NodeID id) |
static bool | isBlkObj (NodeID id) |
static bool | isConstantObj (NodeID id) |
static bool | isBlkObjOrConstantObj (NodeID id) |
static std::string | toString (SYMTYPE symtype) |
Public Attributes | |
const SVFType * | maxStruct |
The struct type with the most fields. | |
u32_t | maxStSize |
The number of fields in max_struct. | |
Protected Member Functions | |
SymbolTableInfo (void) | |
Constructor. | |
const std::vector< const SVFType * > & | getFlattenFieldTypes (const SVFStructType *T) |
Return the flattened field type for struct type only. | |
ObjTypeInfo * | createObjTypeInfo (const SVFType *type) |
Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object) | |
Protected Attributes | |
SVFTypeSet | svfTypes |
Set< const StInfo * > | stInfos |
(owned) All StInfo | |
Private Member Functions | |
void | destroy () |
Clean up memory. | |
Private Attributes | |
ValueToIDMapTy | valSymMap |
map a value to its sym id | |
ValueToIDMapTy | objSymMap |
map a obj reference to its sym id | |
FunToIDMapTy | returnSymMap |
return map | |
FunToIDMapTy | varargSymMap |
vararg map | |
IDToMemMapTy | objMap |
map a memory sym id to its obj | |
SVFModule * | mod |
Module. | |
bool | modelConstants |
Whether to model constants. | |
SymID | totalSymNum |
total number of symbols | |
Static Private Attributes | |
static SymbolTableInfo * | symInfo = nullptr |
Friends | |
class | SymbolTableBuilder |
class | SVFIRWriter |
class | SVFIRReader |
Symbol table of the memory model for analysis
Definition at line 47 of file SymbolTableInfo.h.
function to sym id map
Definition at line 76 of file SymbolTableInfo.h.
sym id to memory object map
Definition at line 74 of file SymbolTableInfo.h.
struct type to struct info map
Definition at line 78 of file SymbolTableInfo.h.
various maps defined
llvm value to sym id map local (%) and global (@) identifiers are pointer types which have a value node id.
Definition at line 72 of file SymbolTableInfo.h.
Symbol types.
Enumerator | |
---|---|
NullPtr | |
BlkPtr | |
BlackHole | |
ConstantObj | |
ValSymbol | |
ObjSymbol | |
RetSymbol | |
VarargSymbol |
Definition at line 56 of file SymbolTableInfo.h.
|
inlineprotected |
Constructor.
Definition at line 105 of file SymbolTableInfo.h.
|
inlinevirtual |
Definition at line 122 of file SymbolTableInfo.h.
|
inline |
Definition at line 352 of file SymbolTableInfo.h.
Definition at line 345 of file SymbolTableInfo.h.
|
inline |
Definition at line 198 of file SymbolTableInfo.h.
|
inline |
Definition at line 183 of file SymbolTableInfo.h.
|
inline |
Definition at line 193 of file SymbolTableInfo.h.
Can only be invoked by SVFIR::addDummyNode() when creating SVFIR from file.
Definition at line 163 of file SymbolTableInfo.cpp.
|
protected |
Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
Definition at line 68 of file SymbolTableInfo.cpp.
|
private |
Clean up memory.
Destroy the memory for this symbol table after use
Definition at line 143 of file SymbolTableInfo.cpp.
|
virtual |
Another debug method.
Definition at line 326 of file SymbolTableInfo.cpp.
|
inline |
Definition at line 174 of file SymbolTableInfo.h.
|
inline |
Definition at line 178 of file SymbolTableInfo.h.
Flattened element idx of an array or struct by considering stride.
Flattened offset information of a struct or an array including its array fields.
When Options::ModelArrays is disabled, any element index Array is modeled as the base
Definition at line 181 of file SymbolTableInfo.cpp.
|
protected |
Return the flattened field type for struct type only.
Definition at line 229 of file SymbolTableInfo.cpp.
const SVFType * SymbolTableInfo::getFlatternedElemType | ( | const SVFType * | baseType, |
u32_t | flatten_idx | ||
) |
Return the type of a flattened element given a flattened index.
Definition at line 212 of file SymbolTableInfo.cpp.
|
inline |
Definition at line 252 of file SymbolTableInfo.h.
|
inline |
Definition at line 134 of file SymbolTableInfo.h.
|
inline |
|
virtual |
Given an offset from a Gep Instruction, return it modulus offset by considering memory layout.
Get modulus offset given the type information
if the offset is negative, it's possible that we're looking for an obj node out of range of current struct. Make the offset positive so we can still get a node within current struct to represent this obj.
@offset: the index allocated to the newly generated field node; @Options::MaxFieldLimit(): preset upper bound of field number; @maxOffset: the max field number of the base object;
E.g., offset == 260, maxOffset == 270, Options::MaxFieldLimit() == 256 ==> offset = 4
E.g., offset == 100, maxOffset == 98, Options::MaxFieldLimit() == 256 ==> offset = 2
E.g., offset == 100, maxOffset == 98, Options::MaxFieldLimit() == 256 ==> offset = 97
Definition at line 94 of file SymbolTableInfo.cpp.
Number of flattened elements of an array or struct.
Get a reference to the components of struct_info. Number of flattened elements of an array or struct
Definition at line 172 of file SymbolTableInfo.cpp.
Definition at line 213 of file SymbolTableInfo.h.
const SVFType * SymbolTableInfo::getOriginalElemType | ( | const SVFType * | baseType, |
u32_t | origId | ||
) | const |
struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b; OriginalElemType of b with field_idx 1 : Struct A FlatternedElemType of b with field_idx 1 : int
Definition at line 206 of file SymbolTableInfo.cpp.
|
inline |
Definition at line 230 of file SymbolTableInfo.h.
Definition at line 299 of file SymbolTableInfo.h.
|
inline |
Constant reader that won't change the state of the symbol table.
Definition at line 294 of file SymbolTableInfo.h.
|
inline |
Get different kinds of syms.
Definition at line 523 of file SymbolTableInfo.cpp.
|
inline |
Definition at line 237 of file SymbolTableInfo.h.
Definition at line 309 of file SymbolTableInfo.h.
|
inline |
Definition at line 270 of file SymbolTableInfo.h.
|
inline |
Definition at line 275 of file SymbolTableInfo.h.
Definition at line 161 of file SymbolTableInfo.h.
Definition at line 169 of file SymbolTableInfo.h.
special value
Definition at line 153 of file SymbolTableInfo.h.
Definition at line 165 of file SymbolTableInfo.h.
Definition at line 157 of file SymbolTableInfo.h.
|
inline |
Definition at line 188 of file SymbolTableInfo.h.
|
inline |
Definition at line 265 of file SymbolTableInfo.h.
Debug method.
All rest types are scalar type?
Definition at line 237 of file SymbolTableInfo.cpp.
|
inlinestatic |
Definition at line 117 of file SymbolTableInfo.h.
|
inline |
Definition at line 280 of file SymbolTableInfo.h.
|
inline |
Set / Get modelConstants.
Definition at line 130 of file SymbolTableInfo.h.
|
inline |
|
static |
Singleton design here to make sure we only have one instance during any analysis.
Get the symbol table instance
Definition at line 81 of file SymbolTableInfo.cpp.
|
static |
Definition at line 283 of file SymbolTableInfo.cpp.
|
inline |
Get different kinds of syms maps.
Definition at line 260 of file SymbolTableInfo.h.
|
inline |
Definition at line 285 of file SymbolTableInfo.h.
|
friend |
Definition at line 51 of file SymbolTableInfo.h.
|
friend |
Definition at line 50 of file SymbolTableInfo.h.
|
friend |
Definition at line 49 of file SymbolTableInfo.h.
The struct type with the most fields.
Definition at line 340 of file SymbolTableInfo.h.
u32_t SVF::SymbolTableInfo::maxStSize |
The number of fields in max_struct.
Definition at line 343 of file SymbolTableInfo.h.
|
private |
Module.
Definition at line 92 of file SymbolTableInfo.h.
|
private |
Whether to model constants.
Definition at line 98 of file SymbolTableInfo.h.
|
private |
map a memory sym id to its obj
Definition at line 86 of file SymbolTableInfo.h.
|
private |
map a obj reference to its sym id
Definition at line 83 of file SymbolTableInfo.h.
|
private |
return map
Definition at line 84 of file SymbolTableInfo.h.
(owned) All StInfo
Definition at line 373 of file SymbolTableInfo.h.
|
protected |
(owned) All SVF Types Every type T is mapped to StInfo which contains size (fsize) , offset(foffset) fsize[i] is the number of fields in the largest such struct, else fsize[i] = 1. fsize[0] is always the size of the expanded struct.
Definition at line 370 of file SymbolTableInfo.h.
|
staticprivate |
Definition at line 89 of file SymbolTableInfo.h.
|
private |
total number of symbols
Definition at line 101 of file SymbolTableInfo.h.
|
private |
map a value to its sym id
Definition at line 82 of file SymbolTableInfo.h.
|
private |
vararg map
Definition at line 85 of file SymbolTableInfo.h.