40using namespace SVFUtil;
47 assert(t &&
"no type information for this object?");
61 assert(
it !=
svfTypes.end() &&
"type info not found? collect them first during SVFIR Building");
62 return (*it)->getTypeInfo();
104 writeWrnMsg(
"try to create a gep node with negative offset.");
186 assert ((
unsigned)
origId <
so.size() && !
so.empty() &&
"element index out of bounds, can't get flattened index!");
191 if(SVFUtil::isa<SVFStructType>(
T))
194 assert ((
unsigned)
origId <
so.size() && !
so.empty() &&
"Struct index out of bounds, can't get flattened index!");
200 assert(SVFUtil::isa<SVFArrayType>(
T) &&
"Only accept struct or array type if Options::ModelArrays is disabled!");
217 assert (
flatten_idx <
so.size() && !
so.empty() &&
"element index out of bounds or struct opaque type, can't get element type!");
223 assert (
flatten_idx <
so.size() && !
so.empty() &&
"element index out of bounds or struct opaque type, can't get element type!");
242 outs() <<
" {Type: " << *
at <<
"}\n"
249 outs() <<
" {Type: " << *
st <<
"}\n";
255 <<
", field type: " << *
type <<
"\n";
261 outs() << *pt <<
"\n";
264 SVFUtil::dyn_cast<SVFFunctionType>(
type))
266 outs() <<
" {Type: " << *
fu <<
"}\n\n";
270 outs() <<
" {Type: "<< *
ot <<
"(SVFOtherType)}\n\n";
274 assert(
type->isSingleValueType() &&
"not a single value type, then what else!!");
277 outs() <<
" {Type: " << *
type <<
"}\n"
278 <<
"\t [object size = " <<
eSize <<
"]\n"
293 return "ConstantObj";
321 return "Invalid SYMTYPE";
357 outs() <<
"{SymbolTableInfo \n";
360 outs() <<
iter.first <<
" " <<
iter.second->toString() <<
"\n";
378 typeInfo(
ti), refVal(
val), symId(id), gNode(node)
528 else if (
val->isblackHole())
540 if (
val->isNullPtr() ||
val->isblackHole())
bool isConstantStruct() const
const SVFType * getType() const
Get obj type.
bool isConstDataOrConstGlobal() const
void destroy()
Clean up memory.
bool isConstDataOrAggData() const
SymID getId() const
Get the memory object id.
bool isFieldInsensitive() const
Return true if its field limit is 0.
MemObj(SymID id, ObjTypeInfo *ti, const SVFValue *val=nullptr, const SVFBaseNode *node=nullptr)
Constructor.
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.
virtual const std::string toString() const
ObjTypeInfo * typeInfo
Type information of this object.
bool isBlackHoleObj() const
Whether it is a black hole object.
bool isConstantArray() const
const SVFValue * getValue() const
Get the reference value to this object.
void setNumOfElements(u32_t num)
Set the number of elements of this object.
void setFieldSensitive()
Set the memory object to be field sensitive (up to max field limit)
u32_t getNumOfElements() const
Get the number of elements of this object.
void setFieldInsensitive()
Set the memory object to be field insensitive.
u32_t getByteSizeOfObj() const
Get the byte size of this object.
bool isFunction() const
object attributes methods
bool isConstantByteSize() const
Check if byte size is a const value.
const SVFType * type
SVF type.
ObjTypeInfo(const SVFType *t, u32_t max)
Constructors.
bool isConstDataOrAggData()
u32_t getMaxFieldOffsetLimit()
Get max field offset limit.
bool isConstDataOrConstGlobal()
u32_t getNumOfElements() const
Get the number of elements of this object.
const SVFType * getType() const
Get LLVM type.
bool isConstantByteSize() const
Check if byte size is a const value.
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.
bool isFunction()
Object attributes.
u32_t getByteSizeOfObj() const
Get the byte size of this object.
void setFlag(MEMTYPE mask)
Flag for this object type.
void resetTypeForHeapStaticObj(const SVFType *type)
void setNumOfElements(u32_t num)
Set the number of elements of this object.
static const Option< bool > ModelConsts
static const Option< bool > CyclicFldIdx
static const Option< bool > ModelArrays
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
std::string toString() const
Needs to be implemented by a SVF front end.
const SVFType * getOriginalElemType(u32_t fldIdx) const
std::vector< const SVFType * > & getFlattenElementTypes()
std::vector< u32_t > & getFlattenedElemIdxVec()
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements)
std::vector< const SVFType * > & getFlattenFieldTypes()
std::vector< u32_t > & getFlattenedFieldIdxVec()
u32_t getNumOfFlattenFields() const
Return the number of fields after flattening (ignoring array elements)
SymID blkPtrSymID() const
void printFlattenFields(const SVFType *type)
Debug method.
const std::vector< const SVFType * > & getFlattenFieldTypes(const SVFStructType *T)
Return the flattened field type for struct type only.
u32_t getFlattenedElemIdx(const SVFType *T, u32_t origId)
Flattened element idx of an array or struct by considering stride.
static SymbolTableInfo * SymbolInfo()
Singleton design here to make sure we only have one instance during any analysis.
ObjTypeInfo * createObjTypeInfo(const SVFType *type)
Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy ...
const SVFType * getOriginalElemType(const SVFType *baseType, u32_t origId) const
void setModelConstants(bool _modelConstants)
Set / Get modelConstants.
static SymbolTableInfo * symInfo
ValueToIDMapTy valSymMap
map a value to its sym id
virtual APOffset getModulusOffset(const MemObj *obj, const APOffset &apOffset)
Given an offset from a Gep Instruction, return it modulus offset by considering memory layout.
ValueToIDMapTy objSymMap
map a obj reference to its sym id
const StInfo * getTypeInfo(const SVFType *T) const
Get struct info.
SymID getValSym(const SVFValue *val)
Get different kinds of syms.
static std::string toString(SYMTYPE symtype)
const SVFType * getFlatternedElemType(const SVFType *baseType, u32_t flatten_idx)
Return the type of a flattened element given a flattened index.
u32_t getNumOfFlattenElements(const SVFType *T)
Number of flattened elements of an array or struct.
void destroy()
Clean up memory.
FunToIDMapTy varargSymMap
vararg map
Set< const StInfo * > stInfos
(owned) All StInfo
virtual void dump()
Another debug method.
static bool isBlkObj(NodeID id)
SymID nullPtrSymID() const
const MemObj * createDummyObj(SymID symId, const SVFType *type)
Can only be invoked by SVFIR::addDummyNode() when creating SVFIR from file.
FunToIDMapTy returnSymMap
return map
IDToMemMapTy objMap
map a memory sym id to its obj
bool hasValSym(const SVFValue *val)
SymbolTableInfo(void)
Constructor.
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder