void setOriginalObj(NodeID c, NodeID o)
virtual void backPropagate(NodeID clone)=0
static const std::string derefFnName
deref function for TBHC alias tests.
TypeBasedHeapCloning(BVDataPTAImpl *pta)
Constructor. pta is the pointer analysis using this object (i.e. that which is extending).
const NodeBS & getGepObjs(NodeID base)
Map< NodeID, const DIType * > objToType
Object -> its type.
Map< NodeID, PointsTo > locToFilterSet
Maps nodes (a location like a PAG node or SVFG node) to their filter set.
void setType(NodeID o, const DIType *t)
Sets the type (in objToType) of o.
Map< NodeID, NodeBS > objToGeps
Maps objects to the GEP nodes beneath them.
NodeID addCloneFIObjNode(const MemObj *mem)
Add clone FI object node to PAG.
bool isBlkObjOrConstantObj(NodeID o) const
NodeID addCloneGepObjNode(const MemObj *mem, const LocationSet &l)
Add clone GEP object node to PAG.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
static const DIType * undefType
The undefined type (•); void.
BVDataPTAImpl * pta
PTA extending this class.
Map< NodeID, NodeID > objToAllocation
PAG * ppag
PAG the PTA uses. Just a shortcut for getPAG().
const NodeBS getObjsWithClones(void)
Returns objects that have clones (any key in objToClones).
void setPAG(PAG *pag)
PAG must be set by extending class once the PAG is available.
static const std::string mangledDerefFnName
deref function (mangled) for TBHC alias tests.
NodeID cloneObject(NodeID o, const DIType *type, bool reuse)
void setDCHG(DCHGraph *dchg)
DCHG must be set by extending class once the DCHG is available.
void dumpStats(void)
Dump some statistics we tracked.
void validateTBHCTests(SVFModule *svfMod)
const NodeBS & getGepObjsFromMemObj(const MemObj *memObj, unsigned offset)
NodeID getAllocationSite(NodeID o) const
Returns the allocation site (from objToAllocation) of o. Asserts existence.
static const MDNode * getRawCTirMetadata(const Value *)
Returns raw ctir metadata of a Value. Returns null if it doesn't exist.
bool isBase(const DIType *a, const DIType *b) const
const DIType * getType(NodeID o) const
Returns the type (from objToType) of o. Asserts existence.
void setAllocationSite(NodeID o, NodeID site)
Sets the allocation site (in objToAllocation) of o.
Map< NodeID, NodeID > cloneToOriginalObj
(Clone) object -> original object (opposite of objToclones).
bool isClone(NodeID o) const
Returns true if o is a clone.
llvm::SparseBitVector NodeBS
const NodeBS & getClones(NodeID o)
Returns all the clones of o.
PointsTo & getFilterSet(NodeID loc)
Returns the filter set of a location. Not const; could create empty PointsTo.
bool isGep(const PAGNode *n) const
Test whether object is a GEP object. For convenience.
NodeID addCloneDummyObjNode(const MemObj *mem)
Add clone dummy object node to PAG.
const DIType * getTypeFromCTirMetadata(const Value *)
virtual ~TypeBasedHeapCloning()
Map< NodeID, NodeBS > objToClones
(Original) object -> set of its clones.
const NodeBS getGepObjClones(NodeID base, unsigned offset)
Map< const MemObj *, Map< unsigned, NodeBS > > memObjToGeps
Maps memory objects to their GEP objects. (memobj -> (fieldidx -> geps))
void addClone(NodeID o, NodeID c)
Add a clone c to object o.
bool init(NodeID loc, NodeID p, const DIType *tildet, bool reuse, bool gep=false)
NodeID getOriginalObj(NodeID c) const
Returns the original object c is cloned from. If c is not a clone, returns itself.
void addGepToObj(NodeID gep, NodeID base, unsigned offset)
Associates gep with base (through objToGeps and memObjToGeps).