Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
SVF::Steensgaard Class Reference

#include <Steensgaard.h>

Inheritance diagram for SVF::Steensgaard:
SVF::AndersenBase SVF::WPASolver< GraphType > SVF::BVDataPTAImpl SVF::PointerAnalysis

Public Types

typedef Map< NodeID, NodeIDNodeToEquivClassMap
 
typedef Map< NodeID, Set< NodeID > > NodeToSubsMap
 
- Public Types inherited from SVF::AndersenBase
typedef OrderedMap< const CallICFGNode *, NodeIDCallSite2DummyValPN
 
- Public Types inherited from SVF::WPASolver< GraphType >
typedef SVF::GenericGraphTraits< GraphType > GTraits
 Define the GTraits and node iterator for printing. More...
 
typedef GTraits::NodeRef GNODE
 
typedef GTraits::EdgeType GEDGE
 
typedef GTraits::ChildIteratorType child_iterator
 
typedef SCCDetection< GraphType > SCC
 
typedef FIFOWorkList< NodeIDWorkList
 
- Public Types inherited from SVF::BVDataPTAImpl
enum  PTBackingType { Mutable , Persistent }
 How the PTData used is implemented. More...
 
typedef PTData< NodeID, NodeSet, NodeID, PointsToPTDataTy
 
typedef DiffPTData< NodeID, NodeSet, NodeID, PointsToDiffPTDataTy
 
typedef DFPTData< NodeID, NodeSet, NodeID, PointsToDFPTDataTy
 
typedef VersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > VersionedPTDataTy
 
typedef MutablePTData< NodeID, NodeSet, NodeID, PointsToMutPTDataTy
 
typedef MutableDiffPTData< NodeID, NodeSet, NodeID, PointsToMutDiffPTDataTy
 
typedef MutableDFPTData< NodeID, NodeSet, NodeID, PointsToMutDFPTDataTy
 
typedef MutableIncDFPTData< NodeID, NodeSet, NodeID, PointsToMutIncDFPTDataTy
 
typedef MutableVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > MutVersionedPTDataTy
 
typedef PersistentPTData< NodeID, NodeSet, NodeID, PointsToPersPTDataTy
 
typedef PersistentDiffPTData< NodeID, NodeSet, NodeID, PointsToPersDiffPTDataTy
 
typedef PersistentDFPTData< NodeID, NodeSet, NodeID, PointsToPersDFPTDataTy
 
typedef PersistentIncDFPTData< NodeID, NodeSet, NodeID, PointsToPersIncDFPTDataTy
 
typedef PersistentVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > PersVersionedPTDataTy
 
- Public Types inherited from SVF::PointerAnalysis
enum  PTATY {
  Andersen_BASE , Andersen_WPA , AndersenSCD_WPA , AndersenSFR_WPA ,
  AndersenWaveDiff_WPA , Steensgaard_WPA , CSCallString_WPA , CSSummary_WPA ,
  FSDATAFLOW_WPA , FSSPARSE_WPA , VFS_WPA , FSCS_WPA ,
  CFLFICI_WPA , CFLFSCI_WPA , CFLFSCS_WPA , TypeCPP_WPA ,
  FieldS_DDA , FlowS_DDA , PathS_DDA , Cxt_DDA ,
  Default_PTA
}
 Pointer analysis type list. More...
 
enum  PTAImplTy { BaseImpl , BVDataImpl , CondImpl }
 Implementation type: BVDataPTAImpl or CondPTAImpl. More...
 
typedef Set< const CallICFGNode * > CallSiteSet
 Indirect call edges type, map a callsite to a set of callees. More...
 
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
 
typedef Set< const SVFFunction * > FunctionSet
 
typedef OrderedMap< const CallICFGNode *, FunctionSetCallEdgeMap
 
typedef SCCDetection< PTACallGraph * > CallGraphSCC
 
typedef Set< const SVFGlobalValue * > VTableSet
 
typedef Set< const SVFFunction * > VFunSet
 

Public Member Functions

 Steensgaard (SVFIR *_pag)
 Constructor. More...
 
virtual void solveWorklist () override
 
void processAllAddr ()
 
void ecUnion (NodeID id, NodeID ec)
 merge node into equiv class and merge node's pts into ec's pts More...
 
virtual const PointsTogetPts (NodeID id) override
 Operation of points-to set. More...
 
virtual bool unionPts (NodeID id, const PointsTo &target) override
 pts(id) = pts(id) U target More...
 
virtual bool unionPts (NodeID id, NodeID ptd) override
 pts(id) = pts(id) U pts(ptd) More...
 
NodeID getEC (NodeID id) const
 
NodeID sccRepNode (NodeID id) const override
 Return getEC(id) More...
 
void setEC (NodeID node, NodeID rep)
 
Set< NodeID > & getSubNodes (NodeID id)
 
void addSubNode (NodeID node, NodeID sub)
 
virtual bool addCopyEdge (NodeID src, NodeID dst) override
 Add copy edge on constraint graph. More...
 
- Public Member Functions inherited from SVF::AndersenBase
 AndersenBase (SVFIR *_pag, PTATY type=Andersen_BASE, bool alias_check=true)
 Constructor. More...
 
 ~AndersenBase () override
 Destructor. More...
 
virtual void analyze () override
 Andersen analysis. More...
 
virtual void solveAndwritePtsToFile (const std::string &filename)
 
virtual void readPtsFromFile (const std::string &filename)
 
virtual void solveConstraints ()
 
virtual void initialize () override
 Initialize analysis. More...
 
virtual void finalize () override
 Finalize analysis. More...
 
virtual bool updateCallGraph (const CallSiteToFunPtrMap &) override
 Update call graph. More...
 
virtual bool updateThreadCallGraph (const CallSiteToFunPtrMap &, NodePairSet &)
 Update thread call graph. More...
 
virtual void connectCaller2ForkedFunParams (const CallICFGNode *cs, const SVFFunction *F, NodePairSet &cpySrcNodes)
 Connect formal and actual parameters for indirect forksites. More...
 
virtual void connectCaller2CalleeParams (const CallICFGNode *cs, const SVFFunction *F, NodePairSet &cpySrcNodes)
 Connect formal and actual parameters for indirect callsites. More...
 
ConstraintGraphgetConstraintGraph ()
 Get constraint graph. More...
 
NodeBSsccSubNodes (NodeID repId)
 
void printStat ()
 dump statistics More...
 
virtual void normalizePointsTo () override
 
void cleanConsCG (NodeID id)
 remove redundant gepnodes in constraint graph More...
 
- Public Member Functions inherited from SVF::BVDataPTAImpl
 BVDataPTAImpl (SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true)
 Constructor. More...
 
 ~BVDataPTAImpl () override=default
 Destructor. More...
 
PersistentPointsToCache< PointsTo > & getPtCache ()
 
const NodeSetgetRevPts (NodeID nodeId) override
 
virtual void clearPts (NodeID id, NodeID element)
 Remove element from the points-to set of id. More...
 
virtual void clearFullPts (NodeID id)
 Clear points-to set of id. More...
 
virtual bool addPts (NodeID id, NodeID ptd)
 
virtual void clearAllPts ()
 Clear all data. More...
 
virtual void expandFIObjs (const PointsTo &pts, PointsTo &expandedPts)
 Expand FI objects. More...
 
virtual void expandFIObjs (const NodeBS &pts, NodeBS &expandedPts)
 TODO: remove repetition. More...
 
void remapPointsToSets (void)
 Remap all points-to sets to use the current mapping. More...
 
virtual void writeToFile (const std::string &filename)
 Interface for analysis result storage on filesystem. More...
 
virtual void writeObjVarToFile (const std::string &filename)
 
virtual void writePtsResultToFile (std::fstream &f)
 
virtual void writeGepObjVarMapToFile (std::fstream &f)
 
virtual bool readFromFile (const std::string &filename)
 
virtual void readPtsResultFromFile (std::ifstream &f)
 
virtual void readGepObjVarMapFromFile (std::ifstream &f)
 
virtual void readAndSetObjFieldSensitivity (std::ifstream &f, const std::string &delimiterStr)
 
AliasResult alias (const SVFValue *V1, const SVFValue *V2) override
 Interface expose to users of our pointer analysis, given Value infos. More...
 
AliasResult alias (NodeID node1, NodeID node2) override
 Interface expose to users of our pointer analysis, given PAGNodeID. More...
 
virtual AliasResult alias (const PointsTo &pts1, const PointsTo &pts2)
 Interface expose to users of our pointer analysis, given two pts. More...
 
void dumpCPts () override
 dump and debug, print out conditional pts More...
 
void dumpTopLevelPtsTo () override
 
void dumpAllPts () override
 
- Public Member Functions inherited from SVF::PointerAnalysis
ICFGgetICFG () const
 Get ICFG. More...
 
u32_t getNumOfResolvedIndCallEdge () const
 Return number of resolved indirect call edges. More...
 
PTACallGraphgetCallGraph () const
 Return call graph. More...
 
CallGraphSCCgetCallGraphSCC () const
 Return call graph SCC. More...
 
 PointerAnalysis (SVFIR *pag, PTATY ty=Default_PTA, bool alias_check=true)
 Constructor. More...
 
PTATY getAnalysisTy () const
 Type of pointer analysis. More...
 
PTAImplTy getImplTy () const
 Return implementation type of the pointer analysis. More...
 
bool printStat ()
 Whether print statistics. More...
 
void disablePrintStat ()
 Whether print statistics. More...
 
CallEdgeMapgetIndCallMap ()
 Get callees from an indirect callsite. More...
 
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. More...
 
void callGraphSCCDetection ()
 PTACallGraph SCC related methods. More...
 
NodeID getCallGraphSCCRepNode (NodeID id) const
 Get SCC rep node of a SVFG node. More...
 
bool inSameCallGraphSCC (const SVFFunction *fun1, const SVFFunction *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. More...
 
bool isInRecursion (const SVFFunction *fun) const
 
bool isLocalVarInRecursiveFun (NodeID id) const
 Whether a local variable is in function recursions. More...
 
virtual const std::string PTAName () const
 Return PTA name. More...
 
CommonCHGraphgetCHGraph () const
 get CHGraph More...
 
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. More...
 
SVFIRgetPAG () const
 
PTAStatgetStat () const
 Get PTA stat. More...
 
SVFModulegetModule () const
 Module. More...
 
OrderedNodeSetgetAllValidPtrs ()
 Get all Valid Pointers for resolution. More...
 
virtual ~PointerAnalysis ()
 Destructor. More...
 
virtual void computeDDAPts (NodeID)
 Compute points-to results on-demand, overridden by derived classes. More...
 
void printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets)
 Print targets of a function pointer. More...
 
virtual void dumpPts (NodeID ptr, const PointsTo &pts)
 
void printIndCSTargets ()
 
void dumpAllTypes ()
 
void dumpStat ()
 Dump the statistics. More...
 
bool containBlackHoleNode (const PointsTo &pts)
 Determine whether a points-to contains a black hole or constant node. More...
 
bool containConstantNode (const PointsTo &pts)
 
virtual bool isBlkObjOrConstantObj (NodeID ptd) const
 
bool isHeapMemObj (NodeID id) const
 Whether this object is heap or array. More...
 
bool isArrayMemObj (NodeID id) const
 
bool isFIObjNode (NodeID id) const
 
NodeID getBaseObjVar (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 SteensgaardcreateSteensgaard (SVFIR *_pag)
 Create an singleton instance. More...
 
static void releaseSteensgaard ()
 
static bool classof (const Steensgaard *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const AndersenBase *pta)
 
static bool classof (const PointerAnalysis *pta)
 
- Static Public Member Functions inherited from SVF::AndersenBase
static bool classof (const AndersenBase *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const PointerAnalysis *pta)
 
- Static Public Member Functions inherited from SVF::BVDataPTAImpl
static bool classof (const PointerAnalysis *pta)
 

Private Attributes

NodeToEquivClassMap nodeToECMap
 
NodeToSubsMap nodeToSubsMap
 

Static Private Attributes

static Steensgaardsteens = nullptr
 

Additional Inherited Members

- Public Attributes inherited from SVF::AndersenBase
NodeBS redundantGepNodes
 
- Public Attributes inherited from SVF::WPASolver< GraphType >
u32_t numOfIteration
 num of iterations during constraint solving More...
 
- Static Public Attributes inherited from SVF::AndersenBase
static u32_t numOfProcessedAddr = 0
 Statistics. More...
 
static u32_t numOfProcessedCopy = 0
 Number of processed Addr edge. More...
 
static u32_t numOfProcessedGep = 0
 Number of processed Copy edge. More...
 
static u32_t numOfProcessedLoad = 0
 Number of processed Gep edge. More...
 
static u32_t numOfProcessedStore = 0
 Number of processed Load edge. More...
 
static u32_t numOfSfrs = 0
 Number of processed Store edge. More...
 
static u32_t numOfFieldExpand = 0
 
static u32_t numOfSCCDetection = 0
 
static double timeOfSCCDetection = 0
 
static double timeOfSCCMerges = 0
 
static double timeOfCollapse = 0
 
static u32_t AveragePointsToSetSize = 0
 
static u32_t MaxPointsToSetSize = 0
 
static double timeOfProcessCopyGep = 0
 
static double timeOfProcessLoadStore = 0
 
static double timeOfUpdateCallGraph = 0
 
- 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::AndersenBase
void heapAllocatorViaIndCall (const CallICFGNode *cs, NodePairSet &cpySrcNodes)
 
- Protected Member Functions inherited from SVF::WPASolver< GraphType >
 WPASolver ()
 Constructor. More...
 
virtual ~WPASolver ()=default
 Destructor. More...
 
SCCgetSCCDetector () const
 Get SCC detector. More...
 
const GraphType graph ()
 Get/Set graph methods. More...
 
void setGraph (GraphType g)
 
virtual NodeStackSCCDetect ()
 SCC detection. More...
 
virtual NodeStackSCCDetect (NodeSet &candidates)
 
virtual void initWorklist ()
 
virtual void processNode (NodeID)
 Following methods are to be implemented in child class, in order to achieve a fully worked PTA. More...
 
virtual void collapseFields ()
 collapse positive weight cycles of a graph More...
 
virtual void propagate (GNODE *v)
 
virtual bool propFromSrcToDst (GEDGE *)
 Propagate information from source to destination node, to be implemented in the child class. More...
 
NodeID popFromWorklist ()
 Worklist operations. More...
 
virtual void pushIntoWorklist (NodeID id)
 
bool isWorklistEmpty ()
 
bool isInWorklist (NodeID id)
 
GNODENode (NodeID id)
 Get node on the graph. More...
 
NodeID Node_Index (GNODE node)
 Get node ID. More...
 
- Protected Member Functions inherited from SVF::BVDataPTAImpl
PTDataTygetPTDataTy () const
 Get points-to data structure. More...
 
DiffPTDataTygetDiffPTDataTy () const
 
DFPTDataTygetDFPTDataTy () const
 
MutDFPTDataTygetMutDFPTDataTy () const
 
VersionedPTDataTygetVersionedPTDataTy () const
 
virtual void onTheFlyCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
 On the fly call graph construction. More...
 
virtual void onTheFlyThreadCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges)
 On the fly thread call graph construction respecting forksite. More...
 
- Protected Member Functions inherited from SVF::PointerAnalysis
const CallSiteToFunPtrMapgetIndirectCallsites () const
 Return all indirect callsites. More...
 
NodeID getFunPtr (const CallICFGNode *cs) const
 Return function pointer PAGNode at a callsite cs. More...
 
virtual void validateTests ()
 Alias check functions to verify correctness of pointer analysis. More...
 
virtual void validateSuccessTests (std::string fun)
 
virtual void validateExpectedFailureTests (std::string fun)
 
void resetObjFieldSensitive ()
 Reset all object node as field-sensitive. More...
 
- Protected Attributes inherited from SVF::AndersenBase
ConstraintGraphconsCG
 Constraint Graph. More...
 
CallSite2DummyValPN callsite2DummyValPN
 
- Protected Attributes inherited from SVF::WPASolver< GraphType >
bool reanalyze
 Reanalyze if any constraint value changed. More...
 
u32_t iterationForPrintStat
 print out statistics for i-th iteration More...
 
GraphType _graph
 Graph. More...
 
std::unique_ptr< SCCscc
 SCC. More...
 
WorkList worklist
 Worklist for resolution. More...
 
- Protected Attributes inherited from SVF::PointerAnalysis
bool print_stat
 User input flags. More...
 
bool alias_validation
 Flag for validating points-to/alias results. More...
 
u32_t OnTheFlyIterBudgetForStat
 Flag for iteration budget for on-the-fly statistics. More...
 
SVFModulesvfMod
 Module. More...
 
PTATY ptaTy
 Pointer analysis Type. More...
 
PTAImplTy ptaImplTy
 PTA implementation type. More...
 
PTAStatstat
 Statistics. More...
 
PTACallGraphcallgraph
 Call graph used for pointer analysis. More...
 
CallGraphSCCcallGraphSCC
 SCC for PTACallGraph. More...
 
ICFGicfg
 Interprocedural control-flow graph. More...
 
CommonCHGraphchgraph
 CHGraph. More...
 
- Static Protected Attributes inherited from SVF::PointerAnalysis
static SVFIRpag = nullptr
 SVFIR. More...
 

Detailed Description

Definition at line 20 of file Steensgaard.h.

Member Typedef Documentation

◆ NodeToEquivClassMap

Definition at line 24 of file Steensgaard.h.

◆ NodeToSubsMap

Definition at line 25 of file Steensgaard.h.

Constructor & Destructor Documentation

◆ Steensgaard()

SVF::Steensgaard::Steensgaard ( SVFIR _pag)
inline

Constructor.

Definition at line 28 of file Steensgaard.h.

28 : AndersenBase(_pag, Steensgaard_WPA, true) {}
AndersenBase(SVFIR *_pag, PTATY type=Andersen_BASE, bool alias_check=true)
Constructor.
Definition: Andersen.h:65
@ Steensgaard_WPA
Steensgaard PTA.

Member Function Documentation

◆ addCopyEdge()

virtual bool SVF::Steensgaard::addCopyEdge ( NodeID  src,
NodeID  dst 
)
inlineoverridevirtual

Add copy edge on constraint graph.

Implements SVF::AndersenBase.

Definition at line 118 of file Steensgaard.h.

119  {
120  return consCG->addCopyCGEdge(src, dst);
121  }
ConstraintGraph * consCG
Constraint Graph.
Definition: Andersen.h:178
CopyCGEdge * addCopyCGEdge(NodeID src, NodeID dst)
Add Copy edge.
Definition: ConsG.cpp:222

◆ addSubNode()

void SVF::Steensgaard::addSubNode ( NodeID  node,
NodeID  sub 
)
inline

Definition at line 112 of file Steensgaard.h.

113  {
114  nodeToSubsMap[node].insert(sub);
115  }
NodeToSubsMap nodeToSubsMap
Definition: Steensgaard.h:126

◆ classof() [1/3]

static bool SVF::Steensgaard::classof ( const AndersenBase pta)
inlinestatic

Definition at line 60 of file Steensgaard.h.

61  {
62  return (pta->getAnalysisTy() == Steensgaard_WPA);
63  }

◆ classof() [2/3]

static bool SVF::Steensgaard::classof ( const PointerAnalysis pta)
inlinestatic

Definition at line 64 of file Steensgaard.h.

65  {
66  return (pta->getAnalysisTy() == Steensgaard_WPA);
67  }

◆ classof() [3/3]

static bool SVF::Steensgaard::classof ( const Steensgaard )
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 56 of file Steensgaard.h.

57  {
58  return true;
59  }

◆ createSteensgaard()

static Steensgaard* SVF::Steensgaard::createSteensgaard ( SVFIR _pag)
inlinestatic

Create an singleton instance.

Definition at line 31 of file Steensgaard.h.

32  {
33  if (steens == nullptr)
34  {
35  steens = new Steensgaard(_pag);
36  steens->analyze();
37  return steens;
38  }
39  return steens;
40  }
virtual void analyze() override
Andersen analysis.
Definition: Andersen.cpp:133
static Steensgaard * steens
Definition: Steensgaard.h:124
Steensgaard(SVFIR *_pag)
Constructor.
Definition: Steensgaard.h:28

◆ ecUnion()

void Steensgaard::ecUnion ( NodeID  id,
NodeID  ec 
)

merge node into equiv class and merge node's pts into ec's pts

Definition at line 95 of file Steensgaard.cpp.

96 {
97  if (unionPts(ec, node))
98  pushIntoWorklist(ec);
99  setEC(node, ec);
100 }
void setEC(NodeID node, NodeID rep)
Definition: Steensgaard.cpp:82
virtual bool unionPts(NodeID id, const PointsTo &target) override
pts(id) = pts(id) U target
Definition: Steensgaard.h:76
virtual void pushIntoWorklist(NodeID id)
Definition: WPASolver.h:156

◆ getEC()

NodeID SVF::Steensgaard::getEC ( NodeID  id) const
inline

API for equivalence class operations Every constraint node maps to an unique equivalence class EC An equivalence class has a set of sub constraint nodes.

Definition at line 92 of file Steensgaard.h.

93  {
94  NodeToEquivClassMap::const_iterator it = nodeToECMap.find(id);
95  if (it == nodeToECMap.end())
96  return id;
97  else
98  return it->second;
99  }
NodeToEquivClassMap nodeToECMap
Definition: Steensgaard.h:125

◆ getPts()

virtual const PointsTo& SVF::Steensgaard::getPts ( NodeID  id)
inlineoverridevirtual

Operation of points-to set.

Reimplemented from SVF::BVDataPTAImpl.

Definition at line 71 of file Steensgaard.h.

72  {
73  return getPTDataTy()->getPts(getEC(id));
74  }
PTDataTy * getPTDataTy() const
Get points-to data structure.
virtual const DataSet & getPts(const Key &var)=0
Get points-to set of var.
NodeID getEC(NodeID id) const
Definition: Steensgaard.h:92

◆ getSubNodes()

Set<NodeID>& SVF::Steensgaard::getSubNodes ( NodeID  id)
inline

Definition at line 107 of file Steensgaard.h.

108  {
109  nodeToSubsMap[id].insert(id);
110  return nodeToSubsMap[id];
111  }

◆ processAllAddr()

void Steensgaard::processAllAddr ( )

Process address edges

Definition at line 105 of file Steensgaard.cpp.

106 {
108  nodeEit = consCG->end();
109  nodeIt != nodeEit; nodeIt++)
110  {
111  ConstraintNode* cgNode = nodeIt->second;
113  eit = cgNode->incomingAddrsEnd();
114  it != eit; ++it)
115  {
117 
118  const AddrCGEdge* addr = cast<AddrCGEdge>(*it);
119  NodeID dst = addr->getDstID();
120  NodeID src = addr->getSrcID();
121  if (addPts(dst, src))
122  pushIntoWorklist(dst);
123  }
124  }
125 }
static u32_t numOfProcessedAddr
Statistics.
Definition: Andersen.h:157
virtual bool addPts(NodeID id, NodeID ptd)
const_iterator incomingAddrsBegin() const
Definition: ConsGNode.h:181
ConstraintEdge::ConstraintEdgeSetTy::const_iterator const_iterator
Definition: ConsGNode.h:45
const_iterator incomingAddrsEnd() const
Definition: ConsGNode.h:185
NodeID getDstID() const
Definition: GenericGraph.h:85
NodeID getSrcID() const
get methods of the components
Definition: GenericGraph.h:81
iterator begin()
Iterators.
Definition: GenericGraph.h:627
u32_t NodeID
Definition: GeneralType.h:55

◆ releaseSteensgaard()

static void SVF::Steensgaard::releaseSteensgaard ( )
inlinestatic

Definition at line 41 of file Steensgaard.h.

42  {
43  if (steens)
44  delete steens;
45  steens = nullptr;
46  }

◆ sccRepNode()

NodeID SVF::Steensgaard::sccRepNode ( NodeID  id) const
inlineoverridevirtual

Return getEC(id)

Reimplemented from SVF::AndersenBase.

Definition at line 101 of file Steensgaard.h.

102  {
103  return getEC(id);
104  }

◆ setEC()

void Steensgaard::setEC ( NodeID  node,
NodeID  rep 
)

Definition at line 82 of file Steensgaard.cpp.

83 {
84  rep = getEC(rep);
85  Set<NodeID>& subNodes = getSubNodes(node);
86  for (NodeID sub : subNodes)
87  {
88  nodeToECMap[sub] = rep;
89  addSubNode(rep, sub);
90  }
91  subNodes.clear();
92 }
Set< NodeID > & getSubNodes(NodeID id)
Definition: Steensgaard.h:107
void addSubNode(NodeID node, NodeID sub)
Definition: Steensgaard.h:112
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: GeneralType.h:96

◆ solveWorklist()

void Steensgaard::solveWorklist ( )
overridevirtual

Steensgaard analysis

foreach o \in pts(p)

*p = q : EC(o) == EC(q)

q = p : EC(q) == EC(p)

q = &p->f : EC(q) == EC(p)

Reimplemented from SVF::WPASolver< GraphType >.

Definition at line 42 of file Steensgaard.cpp.

43 {
44 
46 
47  // Keep solving until workList is empty.
48  while (!isWorklistEmpty())
49  {
50  NodeID nodeId = popFromWorklist();
51  ConstraintNode* node = consCG->getConstraintNode(nodeId);
52 
54  for (NodeID o : getPts(nodeId))
55  {
56 
58  for (ConstraintEdge* edge : node->getStoreInEdges())
59  {
60  ecUnion(edge->getSrcID(), o);
61  }
62  // r = *p : EC(r) == EC(o)
63  for (ConstraintEdge* edge : node->getLoadOutEdges())
64  {
65  ecUnion(o, edge->getDstID());
66  }
67  }
68 
70  for (ConstraintEdge* edge : node->getCopyOutEdges())
71  {
72  ecUnion(edge->getSrcID(), edge->getDstID());
73  }
75  for (ConstraintEdge* edge : node->getGepOutEdges())
76  {
77  ecUnion(edge->getSrcID(), edge->getDstID());
78  }
79  }
80 }
ConstraintNode * getConstraintNode(NodeID id) const
Get/add/remove constraint node.
Definition: ConsG.h:109
const ConstraintEdge::ConstraintEdgeSetTy & getGepOutEdges() const
Definition: ConsGNode.h:123
const ConstraintEdge::ConstraintEdgeSetTy & getLoadOutEdges() const
Definition: ConsGNode.h:131
const ConstraintEdge::ConstraintEdgeSetTy & getCopyOutEdges() const
Definition: ConsGNode.h:115
const ConstraintEdge::ConstraintEdgeSetTy & getStoreInEdges() const
Definition: ConsGNode.h:135
void ecUnion(NodeID id, NodeID ec)
merge node into equiv class and merge node's pts into ec's pts
Definition: Steensgaard.cpp:95
virtual const PointsTo & getPts(NodeID id) override
Operation of points-to set.
Definition: Steensgaard.h:71
NodeID popFromWorklist()
Worklist operations.
Definition: WPASolver.h:151
bool isWorklistEmpty()
Definition: WPASolver.h:160

◆ unionPts() [1/2]

virtual bool SVF::Steensgaard::unionPts ( NodeID  id,
const PointsTo target 
)
inlineoverridevirtual

pts(id) = pts(id) U target

Reimplemented from SVF::BVDataPTAImpl.

Definition at line 76 of file Steensgaard.h.

77  {
78  id = getEC(id);
79  return getPTDataTy()->unionPts(id, target);
80  }
virtual bool unionPts(const Key &dstVar, const Key &srcVar)=0
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).

◆ unionPts() [2/2]

virtual bool SVF::Steensgaard::unionPts ( NodeID  id,
NodeID  ptd 
)
inlineoverridevirtual

pts(id) = pts(id) U pts(ptd)

Reimplemented from SVF::BVDataPTAImpl.

Definition at line 82 of file Steensgaard.h.

83  {
84  id = getEC(id);
85  ptd = getEC(ptd);
86  return getPTDataTy()->unionPts(id, ptd);
87  }

Member Data Documentation

◆ nodeToECMap

NodeToEquivClassMap SVF::Steensgaard::nodeToECMap
private

Definition at line 125 of file Steensgaard.h.

◆ nodeToSubsMap

NodeToSubsMap SVF::Steensgaard::nodeToSubsMap
private

Definition at line 126 of file Steensgaard.h.

◆ steens

Steensgaard * Steensgaard::steens = nullptr
staticprivate

Definition at line 124 of file Steensgaard.h.


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