Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SVF::CondPTAImpl< Cond > Class Template Referenceabstract

#include <PointerAnalysisImpl.h>

Inheritance diagram for SVF::CondPTAImpl< Cond >:
SVF::PointerAnalysis

Public Types

typedef CondVar< CondCVar
 
typedef CondStdSet< CVarCPtSet
 
typedef PTData< CVar, Set< CVar >, CVar, CPtSetPTDataTy
 
typedef MutablePTData< CVar, Set< CVar >, CVar, CPtSetMutPTDataTy
 
typedef Map< NodeID, PointsToPtrToBVPtsMap
 
typedef Map< NodeID, NodeSetPtrToNSMap
 map a pointer to its BitVector points-to representation
 
typedef Map< NodeID, CPtSetPtrToCPtsMap
 
- Public Types inherited from SVF::PointerAnalysis
typedef Set< const CallICFGNode * > CallSiteSet
 Indirect call edges type, map a callsite to a set of callees.
 
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
 
typedef Set< const FunObjVar * > FunctionSet
 
typedef OrderedMap< const CallICFGNode *, FunctionSetCallEdgeMap
 
typedef SCCDetection< CallGraph * > CallGraphSCC
 
typedef Set< const GlobalObjVar * > VTableSet
 
typedef Set< const FunObjVar * > VFunSet
 

Public Member Functions

 CondPTAImpl (SVFIR *pag, PTATY type)
 map a pointer to its conditional points-to set
 
virtual ~CondPTAImpl ()
 Destructor.
 
void destroy ()
 Release memory.
 
PTDataTygetPTDataTy () const
 Get points-to data.
 
MutPTDataTygetMutPTDataTy () const
 
bool hasPtsMap (void) const
 
const MutPTDataTy::PtsMapgetPtsMap () const
 
- Public Member Functions inherited from SVF::PointerAnalysis
ICFGgetICFG () const
 Get ICFG.
 
u32_t getNumOfResolvedIndCallEdge () const
 Return number of resolved indirect call edges.
 
CallGraphgetCallGraph () const
 Return call graph.
 
CallGraphSCCgetCallGraphSCC () const
 Return call graph SCC.
 
 PointerAnalysis (SVFIR *pag, PTATY ty=PTATY::Default_PTA, bool alias_check=true)
 Constructor.
 
PTATY getAnalysisTy () const
 Type of pointer analysis.
 
PTAImplTy getImplTy () const
 Return implementation type of the pointer analysis.
 
bool printStat ()
 Whether print statistics.
 
void disablePrintStat ()
 Whether print statistics.
 
CallEdgeMapgetIndCallMap ()
 Get callees from an indirect callsite.
 
bool hasIndCSCallees (const CallICFGNode *cs) const
 
const FunctionSetgetIndCSCallees (const CallICFGNode *cs) const
 
virtual void resolveIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
 Resolve indirect call edges.
 
void callGraphSCCDetection ()
 PTACallGraph SCC related methods.
 
NodeID getCallGraphSCCRepNode (NodeID id) const
 Get SCC rep node of a SVFG node.
 
bool inSameCallGraphSCC (const FunObjVar *fun1, const FunObjVar *fun2)
 Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
 
bool isInRecursion (const FunObjVar *fun) const
 
bool isLocalVarInRecursiveFun (NodeID id) const
 Whether a local variable is in function recursions.
 
virtual const std::string PTAName () const
 Return PTA name.
 
CommonCHGraphgetCHGraph () const
 get CHGraph
 
void getVFnsFromCHA (const CallICFGNode *cs, VFunSet &vfns)
 
void getVFnsFromPts (const CallICFGNode *cs, const PointsTo &target, VFunSet &vfns)
 
void connectVCallToVFns (const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges)
 
virtual void resolveCPPIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
 Resolve cpp indirect call edges.
 
SVFIRgetPAG () const
 
PTAStatgetStat () const
 Get PTA stat.
 
OrderedNodeSetgetAllValidPtrs ()
 Get all Valid Pointers for resolution.
 
virtual void initialize ()
 Initialization of a pointer analysis, including building symbol table and SVFIR etc.
 
virtual void analyze ()=0
 Start Analysis here (main part of pointer analysis). It needs to be implemented in child class.
 
virtual void computeDDAPts (NodeID)
 Compute points-to results on-demand, overridden by derived classes.
 
bool mayAlias (const SVFVar *V1, const SVFVar *V2)
 Convenience bool wrappers: return true if the two operands may/must/partial alias.
 
bool mayAlias (NodeID node1, NodeID node2)
 
void printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets)
 Print targets of a function pointer.
 
virtual void dumpAllPts ()
 
virtual void dumpPts (NodeID ptr, const PointsTo &pts)
 
void printIndCSTargets ()
 
void dumpAllTypes ()
 
void dumpStat ()
 Dump the statistics.
 
bool containBlackHoleNode (const PointsTo &pts)
 Determine whether a points-to contains a black hole or constant node.
 
bool containConstantNode (const PointsTo &pts)
 
virtual bool isBlkObjOrConstantObj (NodeID ptd) const
 
bool isHeapMemObj (NodeID id) const
 Whether this object is heap or array.
 
bool isArrayMemObj (NodeID id) const
 
bool isFIObjNode (NodeID id) const
 
NodeID getBaseObjVarID (NodeID id)
 
NodeID getFIObjVar (NodeID id)
 
NodeID getGepObjVar (NodeID id, const APOffset &ap)
 
virtual const NodeBSgetAllFieldsObjVars (NodeID id)
 
void setObjFieldInsensitive (NodeID id)
 
bool isFieldInsensitive (NodeID id) const
 

Static Public Member Functions

static bool classof (const PointerAnalysis *pta)
 
PTDataTyptD
 Points-to data.
 
bool normalized
 Normalized flag.
 
PtrToBVPtsMap ptrToBVPtsMap
 Normal points-to representation (without conditions)
 
PtrToNSMap objToNSRevPtsMap
 Normal points-to representation (without conditions)
 
PtrToCPtsMap ptrToCPtsMap
 Conditional points-to representation (with conditions)
 
virtual const CPtSetgetPts (CVar id)
 
virtual const Set< CVar > & getRevPts (CVar nodeId)
 
virtual void clearPts ()
 Clear all data.
 
bool overlap (const CPtSet &cpts1, const CPtSet &cpts2) const
 Whether cpts1 and cpts2 have overlap points-to targets.
 
void expandFIObjs (const CPtSet &cpts, CPtSet &expandedCpts)
 Expand all fields of an aggregate in all points-to sets.
 
virtual void dumpCPts ()
 Print out conditional pts.
 
virtual PointsTo getBVPointsTo (const CPtSet &cpts) const
 Given a conditional pts return its bit vector points-to.
 
virtual PointsTogetPts (NodeID ptr)
 Given a pointer return its bit vector points-to.
 
virtual const CPtSetgetCondPointsTo (NodeID ptr)
 Given a pointer return its conditional points-to.
 
virtual NodeSetgetRevPts (NodeID obj)
 Given an object return all pointers points to this object.
 
virtual AliasResult alias (const SVFVar *V1, const SVFVar *V2)
 Interface expose to users of our pointer analysis, given Value infos.
 
virtual AliasResult alias (NodeID node1, NodeID node2)
 Interface expose to users of our pointer analysis, given two pointers.
 
virtual AliasResult alias (const CVar &var1, const CVar &var2)
 Interface expose to users of our pointer analysis, given conditional variables.
 
virtual AliasResult alias (const CPtSet &pts1, const CPtSet &pts2)
 Interface expose to users of our pointer analysis, given two conditional points-to sets.
 
bool containBlackHoleNode (const CPtSet &cpts)
 Test blk node for cpts.
 
bool containConstantNode (const CPtSet &cpts)
 Test constant node for cpts.
 
virtual bool isCondCompatible (const Cond &cxt1, const Cond &cxt2, bool singleton) const =0
 Whether two conditions are compatible (to be implemented by child class)
 
void dumpTopLevelPtsTo ()
 Dump points-to information of top-level pointers.
 
virtual void finalize ()
 Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
 
virtual bool unionPts (CVar id, const CPtSet &target)
 
virtual bool unionPts (CVar id, CVar ptd)
 
virtual bool addPts (CVar id, CVar ptd)
 
bool mustAlias (const CVar &var1, const CVar &var2)
 Internal interface to be used for conditional points-to set queries.
 
bool contains (const CPtSet &cpts1, const CPtSet &cpts2)
 
bool isSameVar (const CVar &var1, const CVar &var2) const
 Whether two pointers/objects are the same one by considering their conditions.
 
virtual void normalizePointsTo ()
 Normalize points-to information to BitVector/conditional representation.
 

Additional Inherited Members

- Static Public Attributes inherited from SVF::PointerAnalysis
static const std::string aliasTestMayAlias = "MAYALIAS"
 
static const std::string aliasTestMayAliasMangled = "_Z8MAYALIASPvS_"
 
static const std::string aliasTestNoAlias = "NOALIAS"
 
static const std::string aliasTestNoAliasMangled = "_Z7NOALIASPvS_"
 
static const std::string aliasTestPartialAlias = "PARTIALALIAS"
 
static const std::string aliasTestPartialAliasMangled = "_Z12PARTIALALIASPvS_"
 
static const std::string aliasTestMustAlias = "MUSTALIAS"
 
static const std::string aliasTestMustAliasMangled = "_Z9MUSTALIASPvS_"
 
static const std::string aliasTestFailMayAlias = "EXPECTEDFAIL_MAYALIAS"
 
static const std::string aliasTestFailMayAliasMangled = "_Z21EXPECTEDFAIL_MAYALIASPvS_"
 
static const std::string aliasTestFailNoAlias = "EXPECTEDFAIL_NOALIAS"
 
static const std::string aliasTestFailNoAliasMangled = "_Z20EXPECTEDFAIL_NOALIASPvS_"
 
- Protected Member Functions inherited from SVF::PointerAnalysis
const CallSiteToFunPtrMapgetIndirectCallsites () const
 Return all indirect callsites.
 
NodeID getFunPtr (const CallICFGNode *cs) const
 Return function pointer PAGNode at a callsite cs.
 
virtual void validateTests ()
 Alias check functions to verify correctness of pointer analysis.
 
virtual void validateSuccessTests (std::string fun)
 
virtual void validateExpectedFailureTests (std::string fun)
 
void resetObjFieldSensitive ()
 Reset all object node as field-sensitive.
 
- Protected Attributes inherited from SVF::PointerAnalysis
bool print_stat
 User input flags.
 
bool alias_validation
 Flag for validating points-to/alias results.
 
u32_t OnTheFlyIterBudgetForStat
 Flag for iteration budget for on-the-fly statistics.
 
PTATY ptaTy
 Pointer analysis Type.
 
PTAImplTy ptaImplTy
 PTA implementation type.
 
PTAStatstat
 Statistics.
 
CallGraphcallgraph
 Call graph used for pointer analysis.
 
CallGraphSCCcallGraphSCC
 SCC for PTACallGraph.
 
ICFGicfg
 Interprocedural control-flow graph.
 
CommonCHGraphchgraph
 CHGraph.
 
- Static Protected Attributes inherited from SVF::PointerAnalysis
static SVFIRpag = nullptr
 SVFIR.
 

Detailed Description

template<class Cond>
class SVF::CondPTAImpl< Cond >

Pointer analysis implementation which uses conditional points-to map data structure (context/path sensitive analysis)

Definition at line 251 of file PointerAnalysisImpl.h.

Member Typedef Documentation

◆ CPtSet

Definition at line 256 of file PointerAnalysisImpl.h.

◆ CVar

Definition at line 255 of file PointerAnalysisImpl.h.

◆ MutPTDataTy

Definition at line 258 of file PointerAnalysisImpl.h.

◆ PTDataTy

Definition at line 257 of file PointerAnalysisImpl.h.

◆ PtrToBVPtsMap

template<class Cond >
typedef Map<NodeID,PointsTo> SVF::CondPTAImpl< Cond >::PtrToBVPtsMap

Definition at line 259 of file PointerAnalysisImpl.h.

◆ PtrToCPtsMap

template<class Cond >
typedef Map<NodeID,CPtSet> SVF::CondPTAImpl< Cond >::PtrToCPtsMap

Definition at line 261 of file PointerAnalysisImpl.h.

◆ PtrToNSMap

template<class Cond >
typedef Map<NodeID, NodeSet> SVF::CondPTAImpl< Cond >::PtrToNSMap

map a pointer to its BitVector points-to representation

Definition at line 260 of file PointerAnalysisImpl.h.

Constructor & Destructor Documentation

◆ CondPTAImpl()

template<class Cond >
SVF::CondPTAImpl< Cond >::CondPTAImpl ( SVFIR pag,
PTATY  type 
)
inline

map a pointer to its conditional points-to set

Constructor

Definition at line 264 of file PointerAnalysisImpl.h.

265 {
267 ptD = new MutPTDataTy();
268 else
269 assert(false && "no points-to data available");
270
272 }
newitem type
Definition cJSON.cpp:2739
bool normalized
Normalized flag.
MutablePTData< CVar, Set< CVar >, CVar, CPtSet > MutPTDataTy
PTDataTy * ptD
Points-to data.
PTAImplTy ptaImplTy
PTA implementation type.
PointerAnalysis(SVFIR *pag, PTATY ty=PTATY::Default_PTA, bool alias_check=true)
Constructor.
static SVFIR * pag
SVFIR.
@ CondImpl
Represents CondPTAImpl.
Definition PTATY.h:43
@ Cxt_DDA
context sensitive DDA
Definition PTATY.h:32
@ PathS_DDA
Guarded value-flow DDA.
Definition PTATY.h:31
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ ~CondPTAImpl()

template<class Cond >
virtual SVF::CondPTAImpl< Cond >::~CondPTAImpl ( )
inlinevirtual

Destructor.

Definition at line 275 of file PointerAnalysisImpl.h.

276 {
277 destroy();
278 }
void destroy()
Release memory.

Member Function Documentation

◆ addPts()

template<class Cond >
virtual bool SVF::CondPTAImpl< Cond >::addPts ( CVar  id,
CVar  ptd 
)
inlineprotectedvirtual

Definition at line 388 of file PointerAnalysisImpl.h.

389 {
390 return ptD->addPts(id,ptd);
391 }

◆ alias() [1/4]

template<class Cond >
virtual AliasResult SVF::CondPTAImpl< Cond >::alias ( const CPtSet pts1,
const CPtSet pts2 
)
inlinevirtual

Interface expose to users of our pointer analysis, given two conditional points-to sets.

Definition at line 526 of file PointerAnalysisImpl.h.

527 {
534 else if(this->getAnalysisTy() == PTATY::PathS_DDA && contains(cpts1,cpts2) && contains(cpts2,cpts1))
535 {
537 }
538 else if(overlap(cpts1,cpts2))
540 else
542 }
CondStdSet< CVar > CPtSet
bool contains(const CPtSet &cpts1, const CPtSet &cpts2)
void expandFIObjs(const CPtSet &cpts, CPtSet &expandedCpts)
Expand all fields of an aggregate in all points-to sets.
bool containBlackHoleNode(const CPtSet &cpts)
Test blk node for cpts.
bool overlap(const CPtSet &cpts1, const CPtSet &cpts2) const
Whether cpts1 and cpts2 have overlap points-to targets.
PTATY getAnalysisTy() const
Type of pointer analysis.
@ MustAlias
Definition SVFType.h:622
@ MayAlias
Definition SVFType.h:621
@ NoAlias
Definition SVFType.h:620

◆ alias() [2/4]

template<class Cond >
virtual AliasResult SVF::CondPTAImpl< Cond >::alias ( const CVar var1,
const CVar var2 
)
inlinevirtual

Interface expose to users of our pointer analysis, given conditional variables.

Definition at line 521 of file PointerAnalysisImpl.h.

522 {
523 return alias(getPts(var1),getPts(var2));
524 }
virtual AliasResult alias(const SVFVar *V1, const SVFVar *V2)
Interface expose to users of our pointer analysis, given Value infos.
virtual const CPtSet & getPts(CVar id)

◆ alias() [3/4]

template<class Cond >
virtual AliasResult SVF::CondPTAImpl< Cond >::alias ( const SVFVar V1,
const SVFVar V2 
)
inlinevirtual

Interface expose to users of our pointer analysis, given Value infos.

Implements SVF::PointerAnalysis.

Definition at line 511 of file PointerAnalysisImpl.h.

512 {
513 return alias(V1->getId(), V2->getId());
514 }

◆ alias() [4/4]

template<class Cond >
virtual AliasResult SVF::CondPTAImpl< Cond >::alias ( NodeID  node1,
NodeID  node2 
)
inlinevirtual

Interface expose to users of our pointer analysis, given two pointers.

Implements SVF::PointerAnalysis.

Definition at line 516 of file PointerAnalysisImpl.h.

517 {
519 }
virtual const CPtSet & getCondPointsTo(NodeID ptr)
Given a pointer return its conditional points-to.

◆ classof()

template<class Cond >
static bool SVF::CondPTAImpl< Cond >::classof ( const PointerAnalysis pta)
inlinestatic

Definition at line 280 of file PointerAnalysisImpl.h.

281 {
282 return pta->getImplTy() == PTAImplTy::CondImpl;
283 }

◆ clearPts()

template<class Cond >
virtual void SVF::CondPTAImpl< Cond >::clearPts ( )
inlinevirtual

Clear all data.

Definition at line 330 of file PointerAnalysisImpl.h.

331 {
332 ptD->clear();
333 }

◆ containBlackHoleNode()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::containBlackHoleNode ( const CPtSet cpts)
inline

Test blk node for cpts.

Definition at line 544 of file PointerAnalysisImpl.h.

545 {
546 for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
547 {
548 if(cit->get_id() == pag->getBlackHoleNode())
549 return true;
550 }
551 return false;
552 }
OrderedSet< Element >::const_iterator const_iterator
NodeID getBlackHoleNode() const
Definition IRGraph.h:246

◆ containConstantNode()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::containConstantNode ( const CPtSet cpts)
inline

Test constant node for cpts.

Definition at line 554 of file PointerAnalysisImpl.h.

555 {
556 for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
557 {
558 if(cit->get_id() == pag->getConstantNode())
559 return true;
560 }
561 return false;
562 }
NodeID getConstantNode() const
Definition IRGraph.h:250

◆ contains()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::contains ( const CPtSet cpts1,
const CPtSet cpts2 
)
inlineprotected

Definition at line 411 of file PointerAnalysisImpl.h.

412 {
413 if (cpts1.empty() || cpts2.empty())
414 return false;
415
416 for (typename CPtSet::const_iterator it2 = cpts2.begin(); it2 != cpts2.end(); ++it2)
417 {
418 bool hasObj = false;
419 for (typename CPtSet::const_iterator it1 = cpts1.begin(); it1 != cpts1.end(); ++it1)
420 {
421 if(isSameVar(*it1,*it2))
422 {
423 hasObj = true;
424 break;
425 }
426 }
427 if(hasObj == false)
428 return false;
429 }
430 return true;
431 }
bool isSameVar(const CVar &var1, const CVar &var2) const
Whether two pointers/objects are the same one by considering their conditions.

◆ destroy()

template<class Cond >
void SVF::CondPTAImpl< Cond >::destroy ( )
inline

Release memory.

Definition at line 286 of file PointerAnalysisImpl.h.

287 {
288 delete ptD;
289 ptD = nullptr;
290 }

◆ dumpCPts()

template<class Cond >
virtual void SVF::CondPTAImpl< Cond >::dumpCPts ( )
inlinevirtual

Print out conditional pts.

Reimplemented from SVF::PointerAnalysis.

Definition at line 479 of file PointerAnalysisImpl.h.

480 {
481 ptD->dumpPTData();
482 }

◆ dumpTopLevelPtsTo()

template<class Cond >
void SVF::CondPTAImpl< Cond >::dumpTopLevelPtsTo ( )
inlinevirtual

Dump points-to information of top-level pointers.

Reimplemented from SVF::PointerAnalysis.

Definition at line 567 of file PointerAnalysisImpl.h.

568 {
569 for (OrderedNodeSet::iterator nIter = this->getAllValidPtrs().begin(); nIter != this->getAllValidPtrs().end(); ++nIter)
570 {
571 const SVFVar* node = this->getPAG()->getSVFVar(*nIter);
572 if (this->getPAG()->isValidTopLevelPtr(node))
573 {
574 if (SVFUtil::isa<DummyObjVar>(node))
575 {
576 SVFUtil::outs() << "##<Blackhole or constant> id:" << node->getId();
577 }
578 else if (!SVFUtil::isa<DummyValVar>(node))
579 {
580 SVFUtil::outs() << "##<" << node->toString() << "> ";
581 //SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
582 }
583
584 const PointsTo& pts = getPts(node->getId());
585 SVFUtil::outs() << "\nNodeID " << node->getId() << " ";
586 if (pts.empty())
587 {
588 SVFUtil::outs() << "\t\tPointsTo: {empty}\n\n";
589 }
590 else
591 {
592 SVFUtil::outs() << "\t\tPointsTo: { ";
593 for (PointsTo::iterator it = pts.begin(), eit = pts.end(); it != eit; ++it)
594 SVFUtil::outs() << *it << " ";
595 SVFUtil::outs() << "}\n\n";
596 }
597 }
598 }
599
600 SVFUtil::outs().flush();
601 }
SVFIR * getPAG() const
OrderedNodeSet & getAllValidPtrs()
Get all Valid Pointers for resolution.
const_iterator iterator
Definition PointsTo.h:41
const SVFVar * getSVFVar(NodeID id) const
ObjVar/GepObjVar/BaseObjVar.
Definition SVFIR.h:135
NodeID getId() const
Get ID.
Definition SVFValue.h:160
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52

◆ expandFIObjs()

template<class Cond >
void SVF::CondPTAImpl< Cond >::expandFIObjs ( const CPtSet cpts,
CPtSet expandedCpts 
)
inline

Expand all fields of an aggregate in all points-to sets.

Definition at line 350 of file PointerAnalysisImpl.h.

351 {
352 expandedCpts = cpts;;
353 for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
354 {
355 if(pag->getBaseObjVarID(cit->get_id())==cit->get_id())
356 {
357 NodeBS& fields = pag->getAllFieldsObjVars(cit->get_id());
358 for(NodeBS::iterator it = fields.begin(), eit = fields.end(); it!=eit; ++it)
359 {
360 CVar cvar(cit->get_cond(),*it);
361 expandedCpts.set(cvar);
362 }
363 }
364 }
365 }
NodeID getBaseObjVarID(NodeID id) const
Base and Offset methods for Value and Object node.
Definition SVFIR.h:554
NodeBS & getAllFieldsObjVars(const BaseObjVar *obj)
Get all fields of an object.
Definition SVFIR.cpp:573
SparseBitVectorIterator iterator
SparseBitVector NodeBS
Definition GeneralType.h:82

◆ finalize()

template<class Cond >
virtual void SVF::CondPTAImpl< Cond >::finalize ( )
inlineprotectedvirtual

Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.

Reimplemented from SVF::PointerAnalysis.

Reimplemented in SVF::ContextDDA.

Definition at line 370 of file PointerAnalysisImpl.h.

371 {
374 }
virtual void normalizePointsTo()
Normalize points-to information to BitVector/conditional representation.
virtual void finalize()
Finalization of a pointer analysis, including checking alias correctness.

◆ getBVPointsTo()

template<class Cond >
virtual PointsTo SVF::CondPTAImpl< Cond >::getBVPointsTo ( const CPtSet cpts) const
inlinevirtual

Given a conditional pts return its bit vector points-to.

Definition at line 484 of file PointerAnalysisImpl.h.

485 {
486 PointsTo pts;
487 for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
488 pts.set(cit->get_id());
489 return pts;
490 }

◆ getCondPointsTo()

template<class Cond >
virtual const CPtSet & SVF::CondPTAImpl< Cond >::getCondPointsTo ( NodeID  ptr)
inlinevirtual

Given a pointer return its conditional points-to.

Definition at line 498 of file PointerAnalysisImpl.h.

499 {
500 assert(normalized && "Pts of all context-vars have to be merged/normalized. Want to use getPts(CVar cvar)??");
501 return ptrToCPtsMap[ptr];
502 }
PtrToCPtsMap ptrToCPtsMap
Conditional points-to representation (with conditions)

◆ getMutPTDataTy()

template<class Cond >
MutPTDataTy * SVF::CondPTAImpl< Cond >::getMutPTDataTy ( ) const
inline

Definition at line 298 of file PointerAnalysisImpl.h.

299 {
300 MutPTDataTy* mut = SVFUtil::dyn_cast<MutPTDataTy>(ptD);
301 assert(mut && "BVDataPTAImpl::getMutPTDataTy: not a MutPTDataTy!");
302 return mut;
303 }

◆ getPTDataTy()

template<class Cond >
PTDataTy * SVF::CondPTAImpl< Cond >::getPTDataTy ( ) const
inline

Get points-to data.

Definition at line 293 of file PointerAnalysisImpl.h.

294 {
295 return ptD;
296 }

◆ getPts() [1/2]

template<class Cond >
virtual const CPtSet & SVF::CondPTAImpl< Cond >::getPts ( CVar  id)
inlinevirtual

Get points-to and reverse points-to

Definition at line 319 of file PointerAnalysisImpl.h.

320 {
321 return ptD->getPts(id);
322 }

◆ getPts() [2/2]

template<class Cond >
virtual PointsTo & SVF::CondPTAImpl< Cond >::getPts ( NodeID  ptr)
inlinevirtual

Given a pointer return its bit vector points-to.

Implements SVF::PointerAnalysis.

Definition at line 492 of file PointerAnalysisImpl.h.

493 {
494 assert(normalized && "Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
495 return ptrToBVPtsMap[ptr];
496 }
PtrToBVPtsMap ptrToBVPtsMap
Normal points-to representation (without conditions)

◆ getPtsMap()

template<class Cond >
const MutPTDataTy::PtsMap & SVF::CondPTAImpl< Cond >::getPtsMap ( ) const
inline

Definition at line 310 of file PointerAnalysisImpl.h.

311 {
312 if (MutPTDataTy *m = SVFUtil::dyn_cast<MutPTDataTy>(ptD)) return m->getPtsMap();
313 assert(false && "CondPTAImpl::getPtsMap: not a PTData with a PtsMap!");
314 exit(1);
315 }

◆ getRevPts() [1/2]

template<class Cond >
virtual const Set< CVar > & SVF::CondPTAImpl< Cond >::getRevPts ( CVar  nodeId)
inlinevirtual

Definition at line 323 of file PointerAnalysisImpl.h.

324 {
325 return ptD->getRevPts(nodeId);
326 }

◆ getRevPts() [2/2]

template<class Cond >
virtual NodeSet & SVF::CondPTAImpl< Cond >::getRevPts ( NodeID  obj)
inlinevirtual

Given an object return all pointers points to this object.

Implements SVF::PointerAnalysis.

Definition at line 504 of file PointerAnalysisImpl.h.

505 {
506 assert(normalized && "Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
507 return objToNSRevPtsMap[obj];
508 }
PtrToNSMap objToNSRevPtsMap
Normal points-to representation (without conditions)

◆ hasPtsMap()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::hasPtsMap ( void  ) const
inline

Definition at line 305 of file PointerAnalysisImpl.h.

306 {
307 return SVFUtil::isa<MutPTDataTy>(ptD);
308 }

◆ isCondCompatible()

template<class Cond >
virtual bool SVF::CondPTAImpl< Cond >::isCondCompatible ( const Cond cxt1,
const Cond cxt2,
bool  singleton 
) const
pure virtual

Whether two conditions are compatible (to be implemented by child class)

Implemented in SVF::ContextDDA.

◆ isSameVar()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::isSameVar ( const CVar var1,
const CVar var2 
) const
inlineprotected

Whether two pointers/objects are the same one by considering their conditions.

we distinguish context sensitive memory allocation here

Definition at line 434 of file PointerAnalysisImpl.h.

435 {
436 if(var1.get_id() != var2.get_id())
437 return false;
438
440 bool singleton = !(isHeapMemObj(var1.get_id()) || isLocalVarInRecursiveFun(var1.get_id()));
441 return isCondCompatible(var1.get_cond(),var2.get_cond(),singleton);
442 }
virtual bool isCondCompatible(const Cond &cxt1, const Cond &cxt2, bool singleton) const =0
Whether two conditions are compatible (to be implemented by child class)
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.

◆ mustAlias()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::mustAlias ( const CVar var1,
const CVar var2 
)
inlineprotected

Internal interface to be used for conditional points-to set queries.

Definition at line 396 of file PointerAnalysisImpl.h.

397 {
398 if(isSameVar(var1,var2))
399 return true;
400
401 bool singleton = !(isHeapMemObj(var1.get_id()) || isLocalVarInRecursiveFun(var1.get_id()));
402 if(isCondCompatible(var1.get_cond(),var2.get_cond(),singleton) == false)
403 return false;
404
405 const CPtSet& cpts1 = getPts(var1);
406 const CPtSet& cpts2 = getPts(var2);
407 return (contains(cpts1,cpts2) && contains(cpts2,cpts1));
408 }

◆ normalizePointsTo()

template<class Cond >
virtual void SVF::CondPTAImpl< Cond >::normalizePointsTo ( )
inlineprotectedvirtual

Normalize points-to information to BitVector/conditional representation.

Definition at line 446 of file PointerAnalysisImpl.h.

447 {
448 normalized = true;
449 if (hasPtsMap())
450 {
451 const typename MutPTDataTy::PtsMap& ptsMap = getPtsMap();
452 for(typename MutPTDataTy::PtsMap::const_iterator it = ptsMap.begin(), eit=ptsMap.end(); it!=eit; ++it)
453 {
454 for(typename CPtSet::const_iterator cit = it->second.begin(), ecit=it->second.end(); cit!=ecit; ++cit)
455 {
456 ptrToBVPtsMap[(it->first).get_id()].set(cit->get_id());
457 objToNSRevPtsMap[cit->get_id()].insert((it->first).get_id());
458 ptrToCPtsMap[(it->first).get_id()].set(*cit);
459 }
460 }
461 }
462 else
463 {
464 assert(false && "CondPTAImpl::NormalizePointsTo: could not normalize points-to sets");
465 }
466 }
bool hasPtsMap(void) const
const MutPTDataTy::PtsMap & getPtsMap() const
Map< Key, DataSet > PtsMap

◆ overlap()

template<class Cond >
bool SVF::CondPTAImpl< Cond >::overlap ( const CPtSet cpts1,
const CPtSet cpts2 
) const
inline

Whether cpts1 and cpts2 have overlap points-to targets.

Definition at line 336 of file PointerAnalysisImpl.h.

337 {
338 for (typename CPtSet::const_iterator it1 = cpts1.begin(); it1 != cpts1.end(); ++it1)
339 {
340 for (typename CPtSet::const_iterator it2 = cpts2.begin(); it2 != cpts2.end(); ++it2)
341 {
342 if(isSameVar(*it1,*it2))
343 return true;
344 }
345 }
346 return false;
347 }

◆ unionPts() [1/2]

template<class Cond >
virtual bool SVF::CondPTAImpl< Cond >::unionPts ( CVar  id,
const CPtSet target 
)
inlineprotectedvirtual

Union/add points-to, and add the reverse points-to for node collapse purpose To be noted that adding reverse pts might incur 10% total overhead during solving

Definition at line 378 of file PointerAnalysisImpl.h.

379 {
380 return ptD->unionPts(id, target);
381 }

◆ unionPts() [2/2]

template<class Cond >
virtual bool SVF::CondPTAImpl< Cond >::unionPts ( CVar  id,
CVar  ptd 
)
inlineprotectedvirtual

Definition at line 383 of file PointerAnalysisImpl.h.

384 {
385 return ptD->unionPts(id,ptd);
386 }

Member Data Documentation

◆ normalized

template<class Cond >
bool SVF::CondPTAImpl< Cond >::normalized
protected

Normalized flag.

Definition at line 470 of file PointerAnalysisImpl.h.

◆ objToNSRevPtsMap

template<class Cond >
PtrToNSMap SVF::CondPTAImpl< Cond >::objToNSRevPtsMap
protected

Normal points-to representation (without conditions)

Definition at line 474 of file PointerAnalysisImpl.h.

◆ ptD

template<class Cond >
PTDataTy* SVF::CondPTAImpl< Cond >::ptD
protected

Points-to data.

Definition at line 468 of file PointerAnalysisImpl.h.

◆ ptrToBVPtsMap

template<class Cond >
PtrToBVPtsMap SVF::CondPTAImpl< Cond >::ptrToBVPtsMap
protected

Normal points-to representation (without conditions)

Definition at line 472 of file PointerAnalysisImpl.h.

◆ ptrToCPtsMap

template<class Cond >
PtrToCPtsMap SVF::CondPTAImpl< Cond >::ptrToCPtsMap
protected

Conditional points-to representation (with conditions)

Definition at line 476 of file PointerAnalysisImpl.h.


The documentation for this class was generated from the following file: