30 #ifndef OBJECTANDSYMBOL_H_ 31 #define OBJECTANDSYMBOL_H_ 85 maxFieldLimit = limit;
97 return fldIdx2TypeMap[fldIdx];
101 return offset2TypeMap[offset];
120 fldIdxVec.push_back(fldIdx);
121 foffset.push_back(offset);
122 fldIdx2TypeMap[fldIdx] = type;
123 offset2TypeMap[offset] = type;
141 VAR_STRUCT_OBJ = 0x20,
142 VAR_ARRAY_OBJ = 0x40,
143 CONST_STRUCT_OBJ = 0x80,
144 CONST_ARRAY_OBJ = 0x100,
162 type(t), flags(0), maxOffsetLimit(max)
176 void init(
const Value* value);
183 void analyzeGlobalStackObjType(
const Value* val);
186 void analyzeHeapStaticObjType(
const Value* val);
197 return maxOffsetLimit;
203 maxOffsetLimit = limit;
214 return (flags & mask) == mask;
222 return hasFlag(FUNCTION_OBJ);
226 return hasFlag(GLOBVAR_OBJ);
230 return hasFlag(STATIC_OBJ);
234 return hasFlag(STACK_OBJ);
238 return hasFlag(HEAP_OBJ);
247 return hasFlag(VAR_STRUCT_OBJ);
251 return hasFlag(CONST_STRUCT_OBJ);
255 return hasFlag(VAR_STRUCT_OBJ) || hasFlag(CONST_STRUCT_OBJ);
259 return hasFlag(VAR_ARRAY_OBJ);
263 return hasFlag(CONST_ARRAY_OBJ);
267 return hasFlag(VAR_ARRAY_OBJ) || hasFlag(CONST_ARRAY_OBJ);
271 return hasFlag(CONST_OBJ);
275 return hasFlag(HASPTR_OBJ);
277 virtual bool isNonPtrFieldObj(
const LocationSet& ls);
310 void init(
const Value *val);
313 void init(
const Type* type);
339 return getMaxFieldOffsetLimit() == 0;
349 void setFieldSensitive();
352 bool isBlackHoleObj()
const;
374 return typeInfo->
isHeap();
ObjTypeInfo * typeInfo
Type information of this object.
bool hasFlag(MEMTYPE mask)
std::vector< u32_t > fldIdxVec
flattened field indices of a struct
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.
Map< u32_t, const llvm::Type * > fldIdx2TypeMap
Types of all fields of a struct.
bool isFunction() const
object attributes methods
const llvm::Type * getFieldTypeWithByteOffset(u32_t offset)
bool isFunction()
Object attributes.
bool isFieldInsensitive() const
Return true if its field limit is 0.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
ObjTypeInfo(const Value *, const Type *t, u32_t max)
Constructors.
bool isNonPtrFieldObj(const LocationSet &ls) const
Map< u32_t, const llvm::Type * > offset2TypeMap
Types of all fields of a struct.
u32_t getMaxFieldOffsetLimit()
Get max field offset limit.
std::vector< u32_t > & getFieldIdxVec()
void addFldWithType(u32_t fldIdx, u32_t offset, const llvm::Type *type)
Add field (index and offset) with its corresponding type.
static void setMaxFieldLimit(u32_t limit)
void setFieldInsensitive()
Set the memory object to be field insensitive.
ObjTypeInfo(u32_t max, const Type *t)
Constructor.
void setFlag(MEMTYPE mask)
Flag for this object type.
std::vector< u32_t > & getFieldOffsetVec()
const Value * getRefVal() const
Get the reference value to this object.
std::vector< FieldInfo > & getFlattenFieldInfoVec()
const Type * getType() const
Get LLVM type.
static u32_t getMaxFieldLimit()
std::vector< u32_t > foffset
flattened field offsets of of a struct
std::vector< FieldInfo > finfo
All field infos after flattening a struct.
virtual ~ObjTypeInfo()
Destructor.
SymID getSymId() const
Get the memory object id.
static u32_t maxFieldLimit
Max field limit.
bool operator==(const MemObj &mem) const
Operator overloading.
const Type * type
LLVM type.
const Value * refVal
The unique pointer value refer this object.
virtual bool isNonPtrFieldObj(const LocationSet &ls)
const llvm::Type * getFieldTypeWithFldIdx(u32_t fldIdx)
Get method for fields of a struct.
SymID GSymID
The unique id in the graph.
bool isConstArray() const
Size_t getMaxFieldOffsetLimit() const
Get max field offset limit.
bool isConstStruct() const