Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::ICFGWTO Class Reference

#include <ICFGWTO.h>

Inheritance diagram for SVF::ICFGWTO:
SVF::WTO< ICFG >

Public Types

typedef WTO< ICFG > Base
typedef WTOComponentVisitor< ICFG >::WTONodeT ICFGWTONode
Public Types inherited from SVF::WTO< ICFG >
typedef ICFG::NodeType NodeT
typedef ICFG::EdgeType EdgeT
typedef WTOCycleDepth< ICFG > GraphTWTOCycleDepth
typedef WTOComponent< ICFG > WTOComponentT
typedef WTONode< ICFG > WTONodeT
typedef WTOCycle< ICFG > WTOCycleT
typedef Set< const NodeT * > NodeRefList
typedef WTOComponentRefList::const_iterator Iterator
 Iterator over the components.

Public Member Functions

 ICFGWTO (const ICFGNode *node, Set< const FunObjVar * > funcScc={})
virtual ~ICFGWTO ()
virtual std::vector< const ICFGNode * > getSuccessors (const ICFGNode *node) override
 Return the successors of node.
Public Member Functions inherited from SVF::WTO< ICFG >
 WTO (const NodeT *entry)
 Compute the weak topological order of the given graph.
 WTO (const WTO &other)=default
 No copy constructor.
 WTO (WTO &&other)=default
 Move constructor.
WTO & operator= (const WTO &other)=default
 No copy assignment operator.
WTO & operator= (WTO &&other)=default
 Move assignment operator.
 ~WTO ()
 Destructor.
const WTOComponentRefList & getWTOComponents () const
 Get all wto components in WTO.
Iterator begin () const
 Begin iterator over the components.
Iterator end () const
 End iterator over the components.
bool isHead (const NodeT *node) const
NodeRefToWTOCycleMap::const_iterator headBegin () const
NodeRefToWTOCycleMap::const_iterator headEnd () const
 End iterator over the components.
const GraphTWTOCycleDepth & cycleDepth (const NodeT *n) const
 Return the cycleDepth of the given node.
bool in_cycleDepth_table (const NodeT *n) const
 Return the cycleDepth of the given node.
void accept (WTOComponentVisitor< ICFG > &v)
 Accept the given visitor.
std::string toString () const
 Dump the order, for debugging purpose.
void init ()

Public Attributes

Set< const FunObjVar * > scc

Additional Inherited Members

Protected Types inherited from SVF::WTO< ICFG >
typedef const WTOComponentT * WTOComponentPtr
typedef std::list< WTOComponentPtr > WTOComponentRefList
typedef Set< WTOComponentPtr > WTOComponentRefSet
typedef Map< const NodeT *, const WTOCycleT * > NodeRefToWTOCycleMap
typedef Map< const NodeT *, NodeRefList > NodeRefTONodeRefListMap
typedef u32_t CycleDepthNumber
typedef Map< const NodeT *, CycleDepthNumber > NodeRefToCycleDepthNumber
typedef std::vector< const NodeT * > Stack
typedef std::shared_ptr< GraphTWTOCycleDepth > WTOCycleDepthPtr
typedef Map< const NodeT *, WTOCycleDepthPtr > NodeRefToWTOCycleDepthPtr
Protected Member Functions inherited from SVF::WTO< ICFG >
CycleDepthNumber getCDN (const NodeT *n) const
 Return the depth-first number of the given node.
void setCDN (const NodeT *n, const CycleDepthNumber &dfn)
 Set the depth-first number of the given node.
const NodeT * pop ()
 Pop a node from the stack.
void push (const NodeT *n)
 Push a node on the stack.
const WTONodeT * newNode (const NodeT *node)
const WTOCycleT * newCycle (const WTONodeT *node, const WTOComponentRefList &partition)
virtual const WTOCycleT * component (const NodeT *node)
 Create the cycle component for the given node.
virtual CycleDepthNumber visit (const NodeT *node, WTOComponentRefList &partition)
void buildNodeToDepth ()
 Build the node to WTO cycle depth table.
Protected Attributes inherited from SVF::WTO< ICFG >
WTOComponentRefList _components
WTOComponentRefSet _allComponents
NodeRefToWTOCycleMap headRefToCycle
NodeRefToWTOCycleDepthPtr _nodeToDepth
NodeRefToCycleDepthNumber _nodeToCDN
CycleDepthNumber _num
Stack _stack
const NodeT * _entry

Detailed Description

Interprocedural Weak Topological Order Each IWTO has an entry ICFGNode within an function-level SCC boundary. Here scc is one or more functions.

Definition at line 53 of file ICFGWTO.h.

Member Typedef Documentation

◆ Base

Definition at line 56 of file ICFGWTO.h.

◆ ICFGWTONode

Constructor & Destructor Documentation

◆ ICFGWTO()

SVF::ICFGWTO::ICFGWTO ( const ICFGNode * node,
Set< const FunObjVar * > funcScc = {} )
inlineexplicit

Definition at line 61 of file ICFGWTO.h.

61 {}) :
62 Base(node), scc(funcScc)
63 {
64 if (scc.empty()) // if funcScc is empty, the scc is the function itself
65 scc.insert(node->getFun());
66 }
Set< const FunObjVar * > scc
Definition ICFGWTO.h:58
WTO< ICFG > Base
Definition ICFGWTO.h:56

◆ ~ICFGWTO()

virtual SVF::ICFGWTO::~ICFGWTO ( )
inlinevirtual

Definition at line 68 of file ICFGWTO.h.

69 {
70 }

Member Function Documentation

◆ getSuccessors()

virtual std::vector< const ICFGNode * > SVF::ICFGWTO::getSuccessors ( const ICFGNode * node)
inlineoverridevirtual

Return the successors of node.

Reimplemented from SVF::WTO< ICFG >.

Definition at line 72 of file ICFGWTO.h.

73 {
74 std::vector<const ICFGNode*> successors;
75
76 if (const auto* callNode = SVFUtil::dyn_cast<CallICFGNode>(node))
77 {
78
79 for (const auto &e : callNode->getOutEdges())
80 {
81 ICFGNode *calleeEntryICFGNode = e->getDstNode();
82 const ICFGNode *succ = nullptr;
83
84 if (scc.find(calleeEntryICFGNode->getFun()) != scc.end()) // caller & callee in the same SCC
85 succ = calleeEntryICFGNode;
86 else
87 succ = callNode->getRetICFGNode(); // caller & callee in different SCC
88
89 successors.push_back(succ);
90 }
91 }
92 else
93 {
94 for (const auto& e : node->getOutEdges())
95 {
96 ICFGNode *succ = e->getDstNode();
97 if (scc.find(succ->getFun()) == scc.end()) // if not in the same SCC, skip
98 continue;
99 successors.push_back(succ);
100 }
101 }
102
103 return successors;
104 }
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
Definition Casting.h:405

Member Data Documentation

◆ scc

Set<const FunObjVar*> SVF::ICFGWTO::scc

Definition at line 58 of file ICFGWTO.h.


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