svf-lib 1.0.848 → 1.0.852
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/MemoryModel/SVFIR.h +5 -37
- package/SVF-linux/include/MemoryModel/SVFVariables.h +4 -21
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +8 -24
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +34 -35
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +9 -2
- package/SVF-linux/include/Util/Options.h +1 -0
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/MemoryModel/SVFIR.h +4 -36
- package/SVF-osx/include/MemoryModel/SVFVariables.h +2 -13
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +6 -18
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +8 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -292,20 +292,7 @@ public:
|
|
|
292
292
|
//@}
|
|
293
293
|
|
|
294
294
|
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
295
|
-
|
|
296
|
-
{
|
|
297
|
-
GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
|
|
298
|
-
if(iter==GepValObjMap.end()){
|
|
299
|
-
return UINT_MAX;
|
|
300
|
-
}
|
|
301
|
-
else{
|
|
302
|
-
NodeLocationSetMap::const_iterator lit = iter->second.find(std::make_pair(base, ls));
|
|
303
|
-
if(lit==iter->second.end())
|
|
304
|
-
return UINT_MAX;
|
|
305
|
-
else
|
|
306
|
-
return lit->second;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
295
|
+
NodeID getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const;
|
|
309
296
|
|
|
310
297
|
/// Add/get indirect callsites
|
|
311
298
|
//@{
|
|
@@ -411,27 +398,8 @@ public:
|
|
|
411
398
|
assert(obj && "not an object node?");
|
|
412
399
|
return SymbolTableInfo::isConstantObj(id) || obj->isConstDataOrConstGlobal();
|
|
413
400
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
SVFVar* node = getGNode(id);
|
|
417
|
-
if (FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
418
|
-
{
|
|
419
|
-
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
420
|
-
}
|
|
421
|
-
else if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
422
|
-
{
|
|
423
|
-
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
424
|
-
}
|
|
425
|
-
else if (SVFUtil::isa<DummyObjVar>(node))
|
|
426
|
-
{
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
else
|
|
430
|
-
{
|
|
431
|
-
assert(false && "expecting a object node");
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
401
|
+
/// Whether an object can point to any other object or any of its fields is a pointer type.
|
|
402
|
+
bool isNonPointerObj(NodeID id) const;
|
|
435
403
|
//@}
|
|
436
404
|
|
|
437
405
|
/// Base and Offset methods for Value and Object node
|
|
@@ -462,7 +430,7 @@ public:
|
|
|
462
430
|
{
|
|
463
431
|
return addDummyValNode(NodeIDAllocator::get()->allocateValueId());
|
|
464
432
|
}
|
|
465
|
-
inline NodeID addDummyObjNode(const Type* type
|
|
433
|
+
inline NodeID addDummyObjNode(const Type* type)
|
|
466
434
|
{
|
|
467
435
|
return addDummyObjNode(NodeIDAllocator::get()->allocateObjectId(), type);
|
|
468
436
|
}
|
|
@@ -553,7 +521,7 @@ private:
|
|
|
553
521
|
}
|
|
554
522
|
|
|
555
523
|
/// Add a temp field value node, this method can only invoked by getGepValVar
|
|
556
|
-
NodeID addGepValNode(const Value* curInst,const Value* val, const LocationSet& ls, NodeID i, const Type *type
|
|
524
|
+
NodeID addGepValNode(const Value* curInst,const Value* val, const LocationSet& ls, NodeID i, const Type *type);
|
|
557
525
|
/// Add a field obj node, this method can only invoked by getGepObjVar
|
|
558
526
|
NodeID addGepObjNode(const MemObj* obj, const LocationSet& ls);
|
|
559
527
|
/// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
|
|
@@ -81,8 +81,7 @@ protected:
|
|
|
81
81
|
const Value* value; ///< value of this SVFIR node
|
|
82
82
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
83
83
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
84
|
-
bool
|
|
85
|
-
bool isATPointer; /// address-taken pointer
|
|
84
|
+
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
86
85
|
|
|
87
86
|
public:
|
|
88
87
|
/// Constructor
|
|
@@ -117,17 +116,7 @@ public:
|
|
|
117
116
|
/// Whether it is a pointer
|
|
118
117
|
virtual inline bool isPointer() const
|
|
119
118
|
{
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
/// Whether it is a top-level pointer
|
|
123
|
-
inline bool isTopLevelPtr() const
|
|
124
|
-
{
|
|
125
|
-
return isTLPointer;
|
|
126
|
-
}
|
|
127
|
-
/// Whether it is an address-taken pointer
|
|
128
|
-
inline bool isAddressTakenPtr() const
|
|
129
|
-
{
|
|
130
|
-
return isATPointer;
|
|
119
|
+
return isPtr;
|
|
131
120
|
}
|
|
132
121
|
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
133
122
|
/// or llvm's metadata, i.e., metadata !4087
|
|
@@ -395,7 +384,6 @@ class GepValVar: public ValVar
|
|
|
395
384
|
private:
|
|
396
385
|
LocationSet ls; // LocationSet
|
|
397
386
|
const Type *gepValType;
|
|
398
|
-
u32_t fieldIdx;
|
|
399
387
|
|
|
400
388
|
public:
|
|
401
389
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -419,8 +407,8 @@ public:
|
|
|
419
407
|
//@}
|
|
420
408
|
|
|
421
409
|
/// Constructor
|
|
422
|
-
GepValVar(const Value* val, NodeID i, const LocationSet& l, const Type *ty
|
|
423
|
-
ValVar(val, i, GepValNode), ls(l), gepValType(ty)
|
|
410
|
+
GepValVar(const Value* val, NodeID i, const LocationSet& l, const Type *ty) :
|
|
411
|
+
ValVar(val, i, GepValNode), ls(l), gepValType(ty)
|
|
424
412
|
{
|
|
425
413
|
}
|
|
426
414
|
|
|
@@ -443,11 +431,6 @@ public:
|
|
|
443
431
|
return gepValType;
|
|
444
432
|
}
|
|
445
433
|
|
|
446
|
-
u32_t getFieldIdx() const
|
|
447
|
-
{
|
|
448
|
-
return fieldIdx;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
434
|
virtual const std::string toString() const;
|
|
452
435
|
};
|
|
453
436
|
|
|
@@ -354,13 +354,9 @@ public:
|
|
|
354
354
|
|
|
355
355
|
///Get a reference to the components of struct_info.
|
|
356
356
|
/// Number of flattenned elements of an array or struct
|
|
357
|
-
|
|
358
|
-
/// Number of flattenned fields of a struct
|
|
359
|
-
const u32_t getNumOfFlattenFields(const StructType *T);
|
|
357
|
+
u32_t getNumOfFlattenElements(const Type *T);
|
|
360
358
|
/// Flatterned element idx of an array or struct by considering stride
|
|
361
|
-
|
|
362
|
-
/// Flatterned field index information of a struct ignoring any array field
|
|
363
|
-
const std::vector<u32_t>& getFlattenedFieldIdxVec(const Type *T);
|
|
359
|
+
u32_t getFlattenedElemIdx(const Type *T, s64_t origId);
|
|
364
360
|
|
|
365
361
|
const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
|
|
366
362
|
|
|
@@ -393,7 +389,7 @@ protected:
|
|
|
393
389
|
virtual void collectSimpleTypeInfo(const Type* T);
|
|
394
390
|
|
|
395
391
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
396
|
-
ObjTypeInfo* createObjTypeInfo(const Type *type
|
|
392
|
+
ObjTypeInfo* createObjTypeInfo(const Type *type);
|
|
397
393
|
|
|
398
394
|
/// Every type T is mapped to StInfo
|
|
399
395
|
/// which contains size (fsize) , offset(foffset)
|
|
@@ -596,7 +592,7 @@ public:
|
|
|
596
592
|
*/
|
|
597
593
|
class ObjTypeInfo
|
|
598
594
|
{
|
|
599
|
-
|
|
595
|
+
friend class SymbolTableBuilder;
|
|
600
596
|
public:
|
|
601
597
|
typedef enum
|
|
602
598
|
{
|
|
@@ -623,30 +619,18 @@ private:
|
|
|
623
619
|
/// maximum number of field object can be created
|
|
624
620
|
/// minimum number is 0 (field insensitive analysis)
|
|
625
621
|
u32_t maxOffsetLimit;
|
|
622
|
+
|
|
623
|
+
void resetTypeForHeapStaticObj(const Type* type);
|
|
626
624
|
public:
|
|
627
625
|
|
|
628
626
|
/// Constructors
|
|
629
|
-
ObjTypeInfo(const
|
|
630
|
-
type(t), flags(0), maxOffsetLimit(max)
|
|
631
|
-
{
|
|
632
|
-
}
|
|
633
|
-
/// Constructor
|
|
634
|
-
ObjTypeInfo(u32_t max, const Type* t) : type(t), flags(0), maxOffsetLimit(max)
|
|
635
|
-
{
|
|
627
|
+
ObjTypeInfo(const Type* t, u32_t max);
|
|
636
628
|
|
|
637
|
-
}
|
|
638
629
|
/// Destructor
|
|
639
630
|
virtual ~ObjTypeInfo()
|
|
640
631
|
{
|
|
641
|
-
|
|
642
632
|
}
|
|
643
|
-
|
|
644
|
-
/// Analyse types of heap and static objects
|
|
645
|
-
void analyzeHeapObjType(const Type* type);
|
|
646
|
-
|
|
647
|
-
/// Analyse types of heap and static objects
|
|
648
|
-
void analyzeStaticObjType(const Type* type);
|
|
649
|
-
|
|
633
|
+
|
|
650
634
|
/// Get LLVM type
|
|
651
635
|
inline const Type* getType() const
|
|
652
636
|
{
|
|
@@ -109,41 +109,9 @@ public:
|
|
|
109
109
|
return pag->getVarargNode(func);
|
|
110
110
|
}
|
|
111
111
|
//@}
|
|
112
|
-
|
|
113
|
-
/// Handle globals including (global variable and functions)
|
|
114
|
-
//@{
|
|
115
|
-
void visitGlobal(SVFModule* svfModule);
|
|
116
|
-
void InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
117
|
-
u32_t offset);
|
|
118
|
-
NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset);
|
|
119
|
-
//@}
|
|
120
|
-
|
|
121
|
-
/// Process constant expression
|
|
122
|
-
void processCE(const Value *val);
|
|
123
|
-
|
|
124
|
-
/// Infer field index from byteoffset.
|
|
125
|
-
u32_t inferFieldIdxFromByteOffset(const llvm::GEPOperator* gepOp, DataLayout *dl, LocationSet& ls, s64_t idx);
|
|
126
|
-
|
|
127
|
-
/// Compute offset of a gep instruction or gep constant expression
|
|
128
|
-
bool computeGepOffset(const User *V, LocationSet& ls);
|
|
129
|
-
|
|
130
|
-
/// Get the base type and max offset
|
|
131
|
-
const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields, const Value* sz);
|
|
132
|
-
|
|
133
|
-
/// Handle direct call
|
|
134
|
-
void handleDirectCall(CallSite cs, const SVFFunction *F);
|
|
135
|
-
|
|
136
|
-
/// Handle indirect call
|
|
137
|
-
void handleIndCall(CallSite cs);
|
|
138
|
-
|
|
139
112
|
/// Update SVFIR given a call graph (creating new CallPE and RetPE for resolved indirect calls)
|
|
140
113
|
void updateCallGraph(PTACallGraph* callgraph);
|
|
141
114
|
|
|
142
|
-
/// Handle external call
|
|
143
|
-
//@{
|
|
144
|
-
virtual void handleExtCall(CallSite cs, const SVFFunction *F);
|
|
145
|
-
void addComplexConsForExt(Value *D, Value *S, const Value* sz);
|
|
146
|
-
//@}
|
|
147
115
|
|
|
148
116
|
/// Our visit overrides.
|
|
149
117
|
//@{
|
|
@@ -238,6 +206,39 @@ public:
|
|
|
238
206
|
}
|
|
239
207
|
//}@
|
|
240
208
|
|
|
209
|
+
protected:
|
|
210
|
+
/// Handle globals including (global variable and functions)
|
|
211
|
+
//@{
|
|
212
|
+
void visitGlobal(SVFModule* svfModule);
|
|
213
|
+
void InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
214
|
+
u32_t offset);
|
|
215
|
+
NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset);
|
|
216
|
+
//@}
|
|
217
|
+
|
|
218
|
+
/// Process constant expression
|
|
219
|
+
void processCE(const Value *val);
|
|
220
|
+
|
|
221
|
+
/// Infer field index from byteoffset.
|
|
222
|
+
u32_t inferFieldIdxFromByteOffset(const llvm::GEPOperator* gepOp, DataLayout *dl, LocationSet& ls, s64_t idx);
|
|
223
|
+
|
|
224
|
+
/// Compute offset of a gep instruction or gep constant expression
|
|
225
|
+
bool computeGepOffset(const User *V, LocationSet& ls);
|
|
226
|
+
|
|
227
|
+
/// Get the base type and max offset
|
|
228
|
+
const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields, const Value* sz);
|
|
229
|
+
|
|
230
|
+
/// Handle direct call
|
|
231
|
+
void handleDirectCall(CallSite cs, const SVFFunction *F);
|
|
232
|
+
|
|
233
|
+
/// Handle indirect call
|
|
234
|
+
void handleIndCall(CallSite cs);
|
|
235
|
+
|
|
236
|
+
/// Handle external call
|
|
237
|
+
//@{
|
|
238
|
+
virtual void handleExtCall(CallSite cs, const SVFFunction *F);
|
|
239
|
+
void addComplexConsForExt(Value *D, Value *S, const Value* sz);
|
|
240
|
+
//@}
|
|
241
|
+
|
|
241
242
|
/// Set current basic block in order to keep track of control flow information
|
|
242
243
|
inline void setCurrentLocation(const Value* val, const BasicBlock* bb)
|
|
243
244
|
{
|
|
@@ -275,9 +276,7 @@ public:
|
|
|
275
276
|
return nullPtr;
|
|
276
277
|
}
|
|
277
278
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
NodeID getGepValVar(const Value* val, const LocationSet& ls, const Type *baseType, u32_t fieldidx);
|
|
279
|
+
NodeID getGepValVar(const Value* val, const LocationSet& ls, const Type *baseType);
|
|
281
280
|
|
|
282
281
|
void setCurrentBBAndValueForPAGEdge(PAGEdge* edge);
|
|
283
282
|
|
|
@@ -69,7 +69,7 @@ public:
|
|
|
69
69
|
/// Handle constant expression
|
|
70
70
|
// @{
|
|
71
71
|
void handleGlobalCE(const GlobalVariable *G);
|
|
72
|
-
void handleGlobalInitializerCE(const Constant *C
|
|
72
|
+
void handleGlobalInitializerCE(const Constant *C);
|
|
73
73
|
void handleCE(const Value *val);
|
|
74
74
|
// @}
|
|
75
75
|
|
|
@@ -79,7 +79,14 @@ public:
|
|
|
79
79
|
/// Initialize TypeInfo based on LLVM Value
|
|
80
80
|
void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
|
|
81
81
|
/// Analyse types of all flattened fields of this object
|
|
82
|
-
void
|
|
82
|
+
void analyzeObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
83
|
+
/// Analyse types of heap and static objects
|
|
84
|
+
void analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
85
|
+
/// Analyse types of heap and static objects
|
|
86
|
+
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
87
|
+
/// Return the bitcast instruction which is val's only use site, otherwise return nullptr
|
|
88
|
+
const Value* getUniqueUseViaCastInst(const Value* val);
|
|
89
|
+
|
|
83
90
|
/// Return size of this object based on LLVM value
|
|
84
91
|
u32_t getObjSize(const Value* val);
|
|
85
92
|
};
|
|
@@ -211,6 +211,7 @@ public:
|
|
|
211
211
|
// SymbolTableInfo.cpp
|
|
212
212
|
static const llvm::cl::opt<bool> LocMemModel;
|
|
213
213
|
static const llvm::cl::opt<bool> ModelConsts;
|
|
214
|
+
static const llvm::cl::opt<bool> ModelArrays;
|
|
214
215
|
static const llvm::cl::opt<bool> SymTabPrint;
|
|
215
216
|
|
|
216
217
|
// Conditions.cpp
|
|
Binary file
|
|
Binary file
|
|
@@ -292,20 +292,7 @@ public:
|
|
|
292
292
|
//@}
|
|
293
293
|
|
|
294
294
|
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
295
|
-
|
|
296
|
-
{
|
|
297
|
-
GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
|
|
298
|
-
if(iter==GepValObjMap.end()){
|
|
299
|
-
return UINT_MAX;
|
|
300
|
-
}
|
|
301
|
-
else{
|
|
302
|
-
NodeLocationSetMap::const_iterator lit = iter->second.find(std::make_pair(base, ls));
|
|
303
|
-
if(lit==iter->second.end())
|
|
304
|
-
return UINT_MAX;
|
|
305
|
-
else
|
|
306
|
-
return lit->second;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
295
|
+
NodeID getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const;
|
|
309
296
|
|
|
310
297
|
/// Add/get indirect callsites
|
|
311
298
|
//@{
|
|
@@ -411,27 +398,8 @@ public:
|
|
|
411
398
|
assert(obj && "not an object node?");
|
|
412
399
|
return SymbolTableInfo::isConstantObj(id) || obj->isConstDataOrConstGlobal();
|
|
413
400
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
SVFVar* node = getGNode(id);
|
|
417
|
-
if (FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
418
|
-
{
|
|
419
|
-
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
420
|
-
}
|
|
421
|
-
else if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
422
|
-
{
|
|
423
|
-
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
424
|
-
}
|
|
425
|
-
else if (SVFUtil::isa<DummyObjVar>(node))
|
|
426
|
-
{
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
else
|
|
430
|
-
{
|
|
431
|
-
assert(false && "expecting a object node");
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
401
|
+
/// Whether an object can point to any other object or any of its fields is a pointer type.
|
|
402
|
+
bool isNonPointerObj(NodeID id) const;
|
|
435
403
|
//@}
|
|
436
404
|
|
|
437
405
|
/// Base and Offset methods for Value and Object node
|
|
@@ -462,7 +430,7 @@ public:
|
|
|
462
430
|
{
|
|
463
431
|
return addDummyValNode(NodeIDAllocator::get()->allocateValueId());
|
|
464
432
|
}
|
|
465
|
-
inline NodeID addDummyObjNode(const Type* type
|
|
433
|
+
inline NodeID addDummyObjNode(const Type* type)
|
|
466
434
|
{
|
|
467
435
|
return addDummyObjNode(NodeIDAllocator::get()->allocateObjectId(), type);
|
|
468
436
|
}
|
|
@@ -81,8 +81,7 @@ protected:
|
|
|
81
81
|
const Value* value; ///< value of this SVFIR node
|
|
82
82
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
83
83
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
84
|
-
bool
|
|
85
|
-
bool isATPointer; /// address-taken pointer
|
|
84
|
+
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
86
85
|
|
|
87
86
|
public:
|
|
88
87
|
/// Constructor
|
|
@@ -117,17 +116,7 @@ public:
|
|
|
117
116
|
/// Whether it is a pointer
|
|
118
117
|
virtual inline bool isPointer() const
|
|
119
118
|
{
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
/// Whether it is a top-level pointer
|
|
123
|
-
inline bool isTopLevelPtr() const
|
|
124
|
-
{
|
|
125
|
-
return isTLPointer;
|
|
126
|
-
}
|
|
127
|
-
/// Whether it is an address-taken pointer
|
|
128
|
-
inline bool isAddressTakenPtr() const
|
|
129
|
-
{
|
|
130
|
-
return isATPointer;
|
|
119
|
+
return isPtr;
|
|
131
120
|
}
|
|
132
121
|
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
133
122
|
/// or llvm's metadata, i.e., metadata !4087
|
|
@@ -389,7 +389,7 @@ protected:
|
|
|
389
389
|
virtual void collectSimpleTypeInfo(const Type* T);
|
|
390
390
|
|
|
391
391
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
392
|
-
ObjTypeInfo* createObjTypeInfo(const Type *type
|
|
392
|
+
ObjTypeInfo* createObjTypeInfo(const Type *type);
|
|
393
393
|
|
|
394
394
|
/// Every type T is mapped to StInfo
|
|
395
395
|
/// which contains size (fsize) , offset(foffset)
|
|
@@ -592,7 +592,7 @@ public:
|
|
|
592
592
|
*/
|
|
593
593
|
class ObjTypeInfo
|
|
594
594
|
{
|
|
595
|
-
|
|
595
|
+
friend class SymbolTableBuilder;
|
|
596
596
|
public:
|
|
597
597
|
typedef enum
|
|
598
598
|
{
|
|
@@ -619,30 +619,18 @@ private:
|
|
|
619
619
|
/// maximum number of field object can be created
|
|
620
620
|
/// minimum number is 0 (field insensitive analysis)
|
|
621
621
|
u32_t maxOffsetLimit;
|
|
622
|
+
|
|
623
|
+
void resetTypeForHeapStaticObj(const Type* type);
|
|
622
624
|
public:
|
|
623
625
|
|
|
624
626
|
/// Constructors
|
|
625
|
-
ObjTypeInfo(const
|
|
626
|
-
type(t), flags(0), maxOffsetLimit(max)
|
|
627
|
-
{
|
|
628
|
-
}
|
|
629
|
-
/// Constructor
|
|
630
|
-
ObjTypeInfo(u32_t max, const Type* t) : type(t), flags(0), maxOffsetLimit(max)
|
|
631
|
-
{
|
|
627
|
+
ObjTypeInfo(const Type* t, u32_t max);
|
|
632
628
|
|
|
633
|
-
}
|
|
634
629
|
/// Destructor
|
|
635
630
|
virtual ~ObjTypeInfo()
|
|
636
631
|
{
|
|
637
|
-
|
|
638
632
|
}
|
|
639
|
-
|
|
640
|
-
/// Analyse types of heap and static objects
|
|
641
|
-
void analyzeHeapObjType(const Type* type);
|
|
642
|
-
|
|
643
|
-
/// Analyse types of heap and static objects
|
|
644
|
-
void analyzeStaticObjType(const Type* type);
|
|
645
|
-
|
|
633
|
+
|
|
646
634
|
/// Get LLVM type
|
|
647
635
|
inline const Type* getType() const
|
|
648
636
|
{
|
|
@@ -79,7 +79,14 @@ public:
|
|
|
79
79
|
/// Initialize TypeInfo based on LLVM Value
|
|
80
80
|
void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
|
|
81
81
|
/// Analyse types of all flattened fields of this object
|
|
82
|
-
void
|
|
82
|
+
void analyzeObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
83
|
+
/// Analyse types of heap and static objects
|
|
84
|
+
void analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
85
|
+
/// Analyse types of heap and static objects
|
|
86
|
+
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
87
|
+
/// Return the bitcast instruction which is val's only use site, otherwise return nullptr
|
|
88
|
+
const Value* getUniqueUseViaCastInst(const Value* val);
|
|
89
|
+
|
|
83
90
|
/// Return size of this object based on LLVM value
|
|
84
91
|
u32_t getObjSize(const Value* val);
|
|
85
92
|
};
|