SVF
|
#include <TypeBasedHeapCloning.h>
Public Member Functions | |
virtual | ~TypeBasedHeapCloning () |
Static Public Member Functions | |
static const MDNode * | getRawCTirMetadata (const Value *) |
Returns raw ctir metadata of a Value. Returns null if it doesn't exist. More... | |
Protected Member Functions | |
TypeBasedHeapCloning (BVDataPTAImpl *pta) | |
Constructor. pta is the pointer analysis using this object (i.e. that which is extending). More... | |
virtual void | backPropagate (NodeID clone)=0 |
void | setDCHG (DCHGraph *dchg) |
DCHG must be set by extending class once the DCHG is available. More... | |
void | setPAG (PAG *pag) |
PAG must be set by extending class once the PAG is available. More... | |
bool | isBlkObjOrConstantObj (NodeID o) const |
bool | isBase (const DIType *a, const DIType *b) const |
bool | isClone (NodeID o) const |
Returns true if o is a clone. More... | |
void | setType (NodeID o, const DIType *t) |
Sets the type (in objToType) of o. More... | |
const DIType * | getType (NodeID o) const |
Returns the type (from objToType) of o. Asserts existence. More... | |
void | setAllocationSite (NodeID o, NodeID site) |
Sets the allocation site (in objToAllocation) of o. More... | |
NodeID | getAllocationSite (NodeID o) const |
Returns the allocation site (from objToAllocation) of o. Asserts existence. More... | |
const NodeBS | getObjsWithClones (void) |
Returns objects that have clones (any key in objToClones). More... | |
void | addClone (NodeID o, NodeID c) |
Add a clone c to object o. More... | |
const NodeBS & | getClones (NodeID o) |
Returns all the clones of o. More... | |
void | setOriginalObj (NodeID c, NodeID o) |
NodeID | getOriginalObj (NodeID c) const |
Returns the original object c is cloned from. If c is not a clone, returns itself. More... | |
PointsTo & | getFilterSet (NodeID loc) |
Returns the filter set of a location. Not const; could create empty PointsTo. More... | |
void | addGepToObj (NodeID gep, NodeID base, unsigned offset) |
Associates gep with base (through objToGeps and memObjToGeps). More... | |
const NodeBS & | getGepObjsFromMemObj (const MemObj *memObj, unsigned offset) |
const NodeBS & | getGepObjs (NodeID base) |
const NodeBS | getGepObjClones (NodeID base, unsigned offset) |
bool | init (NodeID loc, NodeID p, const DIType *tildet, bool reuse, bool gep=false) |
NodeID | cloneObject (NodeID o, const DIType *type, bool reuse) |
NodeID | addCloneDummyObjNode (const MemObj *mem) |
Add clone dummy object node to PAG. More... | |
NodeID | addCloneGepObjNode (const MemObj *mem, const LocationSet &l) |
Add clone GEP object node to PAG. More... | |
NodeID | addCloneFIObjNode (const MemObj *mem) |
Add clone FI object node to PAG. More... | |
const DIType * | getTypeFromCTirMetadata (const Value *) |
void | validateTBHCTests (SVFModule *svfMod) |
void | dumpStats (void) |
Dump some statistics we tracked. More... | |
Protected Attributes | |
DCHGraph * | dchg = nullptr |
Static Protected Attributes | |
static const DIType * | undefType = nullptr |
The undefined type (•); void. More... | |
static const std::string | derefFnName = "deref" |
deref function for TBHC alias tests. More... | |
static const std::string | mangledDerefFnName = "_Z5derefv" |
deref function (mangled) for TBHC alias tests. More... | |
Private Member Functions | |
bool | isGep (const PAGNode *n) const |
Test whether object is a GEP object. For convenience. More... | |
Private Attributes | |
BVDataPTAImpl * | pta |
PTA extending this class. More... | |
PAG * | ppag = nullptr |
PAG the PTA uses. Just a shortcut for getPAG(). More... | |
Map< NodeID, const DIType * > | objToType |
Object -> its type. More... | |
Map< NodeID, NodeID > | objToAllocation |
Map< NodeID, NodeBS > | objToClones |
(Original) object -> set of its clones. More... | |
Map< NodeID, NodeID > | cloneToOriginalObj |
(Clone) object -> original object (opposite of objToclones). More... | |
Map< NodeID, PointsTo > | locToFilterSet |
Maps nodes (a location like a PAG node or SVFG node) to their filter set. More... | |
Map< NodeID, NodeBS > | objToGeps |
Maps objects to the GEP nodes beneath them. More... | |
Map< const MemObj *, Map< unsigned, NodeBS > > | memObjToGeps |
Maps memory objects to their GEP objects. (memobj -> (fieldidx -> geps)) More... | |
unsigned | numInit = 0 |
unsigned | numTBWU = 0 |
unsigned | numTBSSU = 0 |
unsigned | numTBSU = 0 |
unsigned | numReuse = 0 |
unsigned | numAgg = 0 |
unsigned | numSGInit = 0 |
unsigned | numSGTBWU = 0 |
unsigned | numSGTBSSU = 0 |
unsigned | numSGTBSU = 0 |
unsigned | numSGReuse = 0 |
unsigned | numSGAgg = 0 |
Definition at line 21 of file TypeBasedHeapCloning.h.
|
inlinevirtual |
Definition at line 27 of file TypeBasedHeapCloning.h.
|
protected |
Constructor. pta is the pointer analysis using this object (i.e. that which is extending).
Definition at line 21 of file TypeBasedHeapCloning.cpp.
Add a clone c to object o.
Definition at line 86 of file TypeBasedHeapCloning.cpp.
Add clone dummy object node to PAG.
Definition at line 501 of file TypeBasedHeapCloning.cpp.
Add clone FI object node to PAG.
Definition at line 513 of file TypeBasedHeapCloning.cpp.
|
inlineprotected |
Add clone GEP object node to PAG.
Definition at line 507 of file TypeBasedHeapCloning.cpp.
Associates gep with base (through objToGeps and memObjToGeps).
Definition at line 118 of file TypeBasedHeapCloning.cpp.
|
protectedpure virtual |
Required by user. Handles back-propagation of newly created clone after all metadata has been set. Used by cloneObject.
Implemented in SVF::FlowSensitiveTBHC.
Returns a clone of o with type type. reuse indicates whether we are cloning as a result of reuse.
Definition at line 411 of file TypeBasedHeapCloning.cpp.
|
protected |
Dump some statistics we tracked.
Definition at line 731 of file TypeBasedHeapCloning.cpp.
Returns the allocation site (from objToAllocation) of o. Asserts existence.
Definition at line 69 of file TypeBasedHeapCloning.cpp.
Returns all the clones of o.
Definition at line 91 of file TypeBasedHeapCloning.cpp.
Returns the filter set of a location. Not const; could create empty PointsTo.
Definition at line 113 of file TypeBasedHeapCloning.cpp.
Returns the GEP object node(s) of base for ls. This may include clones. If there are no GEP objects, then getGepObjNode is called on the PAG (through base's getGepObjNode) which will create one.
Definition at line 142 of file TypeBasedHeapCloning.cpp.
Returns all gep objects under an object. Not const; could create empty set.
Definition at line 137 of file TypeBasedHeapCloning.cpp.
|
protected |
Returns all gep objects at a particular offset for memory object. Not const; could create empty set.
Definition at line 132 of file TypeBasedHeapCloning.cpp.
|
protected |
Returns objects that have clones (any key in objToClones).
Definition at line 75 of file TypeBasedHeapCloning.cpp.
Returns the original object c is cloned from. If c is not a clone, returns itself.
Definition at line 101 of file TypeBasedHeapCloning.cpp.
Returns raw ctir metadata of a Value. Returns null if it doesn't exist.
Definition at line 483 of file TypeBasedHeapCloning.cpp.
Returns the type (from objToType) of o. Asserts existence.
Definition at line 58 of file TypeBasedHeapCloning.cpp.
Returns the ctir type attached to the value, nullptr if non-existant. Not static because it needs the DCHG to return the canonical type. Not static because we need dchg's getCanonicalType.
Definition at line 519 of file TypeBasedHeapCloning.cpp.
|
protected |
Initialise the pointees of p at loc (which is type tildet *). reuse indicates whether reuse is a possibility for this initialisation. Returns whether p changed.
Definition at line 271 of file TypeBasedHeapCloning.cpp.
Wrapper around DCHGraph::isBase. Purpose is to keep our conditions clean by only passing two parameters like the rules.
Definition at line 42 of file TypeBasedHeapCloning.cpp.
|
protected |
Check if an object is a black hole obj or a constant object. Required since other implementations obviously do not account for clones.
Definition at line 36 of file TypeBasedHeapCloning.cpp.
|
protected |
Returns true if o is a clone.
Definition at line 48 of file TypeBasedHeapCloning.cpp.
|
private |
Test whether object is a GEP object. For convenience.
Definition at line 539 of file TypeBasedHeapCloning.cpp.
Sets the allocation site (in objToAllocation) of o.
Definition at line 64 of file TypeBasedHeapCloning.cpp.
|
protected |
DCHG must be set by extending class once the DCHG is available.
Definition at line 26 of file TypeBasedHeapCloning.cpp.
Definition at line 96 of file TypeBasedHeapCloning.cpp.
|
protected |
PAG must be set by extending class once the PAG is available.
Definition at line 31 of file TypeBasedHeapCloning.cpp.
Sets the type (in objToType) of o.
Definition at line 53 of file TypeBasedHeapCloning.cpp.
|
protected |
Runs tests on MAYALIAS, NOALIAS, etc. built from TBHC_MAYALIAS, TBHC_NOALIAS, etc. macros. TBHC_XALIAS macros produce: call XALIAS(...) %1 = load ... ... n = load p store ... n-1, ...* n !ctir !t1 call deref() n+1 = load ... ... n+n = load q store ... n+n-1, ...* n+n !ctir !t2 call deref() We want to test the points-to sets of n and n+n after filtering with !t1 and !t2 respectively.
Definition at line 562 of file TypeBasedHeapCloning.cpp.
(Clone) object -> original object (opposite of objToclones).
Definition at line 160 of file TypeBasedHeapCloning.h.
|
protected |
Class hierarchy graph built from debug information. Required, CHG from IR is insufficient.
Definition at line 47 of file TypeBasedHeapCloning.h.
|
staticprotected |
deref function for TBHC alias tests.
Definition at line 34 of file TypeBasedHeapCloning.h.
Maps nodes (a location like a PAG node or SVFG node) to their filter set.
Definition at line 162 of file TypeBasedHeapCloning.h.
|
staticprotected |
deref function (mangled) for TBHC alias tests.
Definition at line 36 of file TypeBasedHeapCloning.h.
Maps memory objects to their GEP objects. (memobj -> (fieldidx -> geps))
Definition at line 166 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 177 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 172 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 176 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 185 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 180 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 184 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 182 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 183 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 181 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 174 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 175 of file TypeBasedHeapCloning.h.
|
private |
Definition at line 173 of file TypeBasedHeapCloning.h.
Object -> allocation site. The value NodeID depends on the pointer analysis (could be an SVFG node or PAG node for example).
Definition at line 156 of file TypeBasedHeapCloning.h.
(Original) object -> set of its clones.
Definition at line 158 of file TypeBasedHeapCloning.h.
Maps objects to the GEP nodes beneath them.
Definition at line 164 of file TypeBasedHeapCloning.h.
Object -> its type.
Definition at line 152 of file TypeBasedHeapCloning.h.
|
private |
PAG the PTA uses. Just a shortcut for getPAG().
Definition at line 149 of file TypeBasedHeapCloning.h.
|
private |
PTA extending this class.
Definition at line 147 of file TypeBasedHeapCloning.h.
|
staticprotected |
The undefined type (•); void.
Definition at line 27 of file TypeBasedHeapCloning.h.