Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
SVF::PTACallGraphEdge Class Reference

#include <PTACallGraph.h>

Inheritance diagram for SVF::PTACallGraphEdge:
SVF::GenericEdge< NodeTy > SVF::HareParForEdge SVF::ThreadForkEdge SVF::ThreadJoinEdge

Public Types

enum  CEDGEK { CallRetEdge , TDForkEdge , TDJoinEdge , HareParForEdge }
 
typedef Set< const CallICFGNode * > CallInstSet
 
typedef GenericNode< PTACallGraphNode, PTACallGraphEdge >::GEdgeSetTy CallGraphEdgeSet
 
- Public Types inherited from SVF::GenericEdge< NodeTy >
typedef NodeTy NodeType
 Node type.
 
typedef u64_t GEdgeFlag
 
typedef s64_t GEdgeKind
 
typedef struct SVF::GenericEdge::equalGEdge equalGEdge
 Add the hash function for std::set (we also can overload operator< to implement this)
 

Public Member Functions

 PTACallGraphEdge (PTACallGraphNode *s, PTACallGraphNode *d, CEDGEK kind, CallSiteID cs)
 Constructor.
 
virtual ~PTACallGraphEdge ()
 Destructor.
 
CallSiteID getCallSiteID () const
 Get direct and indirect calls.
 
bool isDirectCallEdge () const
 
bool isIndirectCallEdge () const
 
CallInstSet & getDirectCalls ()
 
CallInstSet & getIndirectCalls ()
 
const CallInstSet & getDirectCalls () const
 
const CallInstSet & getIndirectCalls () const
 
void addDirectCallSite (const CallICFGNode *call)
 Add direct and indirect callsite.
 
void addInDirectCallSite (const CallICFGNode *call)
 
CallInstSet::const_iterator directCallsBegin () const
 Iterators for direct and indirect callsites.
 
CallInstSet::const_iterator directCallsEnd () const
 
CallInstSet::const_iterator indirectCallsBegin () const
 
CallInstSet::const_iterator indirectCallsEnd () const
 
virtual const std::string toString () const
 
- Public Member Functions inherited from SVF::GenericEdge< NodeTy >
 GenericEdge (NodeTy *s, NodeTy *d, GEdgeFlag k)
 Constructor.
 
virtual ~GenericEdge ()
 Destructor.
 
NodeID getSrcID () const
 get methods of the components
 
NodeID getDstID () const
 
GEdgeKind getEdgeKind () const
 
GEdgeKind getEdgeKindWithoutMask () const
 
NodeType * getSrcNode () const
 
NodeType * getDstNode () const
 
virtual bool operator== (const GenericEdge< NodeType > *rhs) const
 

Static Public Member Functions

static GEdgeFlag makeEdgeFlagWithInvokeID (GEdgeKind k, CallSiteID cs)
 Compute the unique edgeFlag value from edge kind and CallSiteID.
 
static bool classof (const PTACallGraphEdge *)
 ClassOf.
 
static bool classof (const GenericPTACallGraphEdgeTy *edge)
 

Private Attributes

CallInstSet directCalls
 
CallInstSet indirectCalls
 
CallSiteID csId
 

Friends

OutStream & operator<< (OutStream &o, const PTACallGraphEdge &edge)
 Overloading operator << for dumping ICFG node ID.
 

Additional Inherited Members

- Static Protected Attributes inherited from SVF::GenericEdge< NodeTy >
static constexpr unsigned char EdgeKindMaskBits = 8
 We use the lower 8 bits to denote edge kind.
 
static constexpr u64_t EdgeKindMask = (~0ULL) >> (64 - EdgeKindMaskBits)
 

Detailed Description

Definition at line 52 of file PTACallGraph.h.

Member Typedef Documentation

◆ CallGraphEdgeSet

Definition at line 167 of file PTACallGraph.h.

◆ CallInstSet

Definition at line 56 of file PTACallGraph.h.

Member Enumeration Documentation

◆ CEDGEK

Enumerator
CallRetEdge 
TDForkEdge 
TDJoinEdge 
HareParForEdge 

Definition at line 57 of file PTACallGraph.h.

Constructor & Destructor Documentation

◆ PTACallGraphEdge()

SVF::PTACallGraphEdge::PTACallGraphEdge ( PTACallGraphNode *  s,
PTACallGraphNode *  d,
CEDGEK  kind,
CallSiteID  cs 
)
inline

Constructor.

Definition at line 69 of file PTACallGraph.h.

69 :
71 {
72 }
static GEdgeFlag makeEdgeFlagWithInvokeID(GEdgeKind k, CallSiteID cs)
Compute the unique edgeFlag value from edge kind and CallSiteID.
GenericEdge< PTACallGraphNode > GenericPTACallGraphEdgeTy
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~PTACallGraphEdge()

virtual SVF::PTACallGraphEdge::~PTACallGraphEdge ( )
inlinevirtual

Destructor.

Definition at line 74 of file PTACallGraph.h.

75 {
76 }

Member Function Documentation

◆ addDirectCallSite()

void PTACallGraphEdge::addDirectCallSite ( const CallICFGNode *  call)

Add direct and indirect callsite.

Definition at line 47 of file PTACallGraph.cpp.

48{
49 assert(call->getCalledFunction() && "not a direct callsite??");
50 directCalls.insert(call);
51}
const SVFFunction * getCalledFunction() const
Definition ICFGNode.h:518
CallInstSet directCalls

◆ addInDirectCallSite()

void PTACallGraphEdge::addInDirectCallSite ( const CallICFGNode *  call)

Definition at line 53 of file PTACallGraph.cpp.

54{
55 assert((nullptr == call->getCalledFunction() || !SVFUtil::isa<FunValVar>(SVFUtil::getForkedFun(call))) &&
56 "not an indirect callsite??");
57 indirectCalls.insert(call);
58}
CallInstSet indirectCalls
const ValVar * getForkedFun(const CallICFGNode *inst)
Return thread fork function.
Definition SVFUtil.h:343

◆ classof() [1/2]

static bool SVF::PTACallGraphEdge::classof ( const GenericPTACallGraphEdgeTy *  edge)
inlinestatic

Definition at line 148 of file PTACallGraph.h.

149 {
150 return edge->getEdgeKind() == PTACallGraphEdge::CallRetEdge ||
151 edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge ||
152 edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
153 }

◆ classof() [2/2]

static bool SVF::PTACallGraphEdge::classof ( const PTACallGraphEdge *  )
inlinestatic

ClassOf.

Definition at line 144 of file PTACallGraph.h.

145 {
146 return true;
147 }

◆ directCallsBegin()

CallInstSet::const_iterator SVF::PTACallGraphEdge::directCallsBegin ( ) const
inline

Iterators for direct and indirect callsites.

Definition at line 123 of file PTACallGraph.h.

124 {
125 return directCalls.begin();
126 }

◆ directCallsEnd()

CallInstSet::const_iterator SVF::PTACallGraphEdge::directCallsEnd ( ) const
inline

Definition at line 127 of file PTACallGraph.h.

128 {
129 return directCalls.end();
130 }

◆ getCallSiteID()

CallSiteID SVF::PTACallGraphEdge::getCallSiteID ( ) const
inline

Get direct and indirect calls.

Definition at line 84 of file PTACallGraph.h.

85 {
86 return csId;
87 }

◆ getDirectCalls() [1/2]

CallInstSet & SVF::PTACallGraphEdge::getDirectCalls ( )
inline

Definition at line 96 of file PTACallGraph.h.

97 {
98 return directCalls;
99 }

◆ getDirectCalls() [2/2]

const CallInstSet & SVF::PTACallGraphEdge::getDirectCalls ( ) const
inline

Definition at line 104 of file PTACallGraph.h.

105 {
106 return directCalls;
107 }

◆ getIndirectCalls() [1/2]

CallInstSet & SVF::PTACallGraphEdge::getIndirectCalls ( )
inline

Definition at line 100 of file PTACallGraph.h.

101 {
102 return indirectCalls;
103 }

◆ getIndirectCalls() [2/2]

const CallInstSet & SVF::PTACallGraphEdge::getIndirectCalls ( ) const
inline

Definition at line 108 of file PTACallGraph.h.

109 {
110 return indirectCalls;
111 }

◆ indirectCallsBegin()

CallInstSet::const_iterator SVF::PTACallGraphEdge::indirectCallsBegin ( ) const
inline

Definition at line 132 of file PTACallGraph.h.

133 {
134 return indirectCalls.begin();
135 }

◆ indirectCallsEnd()

CallInstSet::const_iterator SVF::PTACallGraphEdge::indirectCallsEnd ( ) const
inline

Definition at line 136 of file PTACallGraph.h.

137 {
138 return indirectCalls.end();
139 }

◆ isDirectCallEdge()

bool SVF::PTACallGraphEdge::isDirectCallEdge ( ) const
inline

Definition at line 88 of file PTACallGraph.h.

89 {
90 return !directCalls.empty() && indirectCalls.empty();
91 }

◆ isIndirectCallEdge()

bool SVF::PTACallGraphEdge::isIndirectCallEdge ( ) const
inline

Definition at line 92 of file PTACallGraph.h.

93 {
94 return directCalls.empty() && !indirectCalls.empty();
95 }

◆ makeEdgeFlagWithInvokeID()

static GEdgeFlag SVF::PTACallGraphEdge::makeEdgeFlagWithInvokeID ( GEdgeKind  k,
CallSiteID  cs 
)
inlinestatic

Compute the unique edgeFlag value from edge kind and CallSiteID.

Definition at line 78 of file PTACallGraph.h.

79 {
80 return (cs << EdgeKindMaskBits) | k;
81 }
static constexpr unsigned char EdgeKindMaskBits
We use the lower 8 bits to denote edge kind.

◆ toString()

const std::string PTACallGraphEdge::toString ( ) const
virtual

Reimplemented in SVF::ThreadForkEdge, and SVF::ThreadJoinEdge.

Definition at line 61 of file PTACallGraph.cpp.

62{
63 std::string str;
64 std::stringstream rawstr(str);
65 rawstr << "CallSite ID: " << getCallSiteID();
67 rawstr << "direct call";
68 else
69 rawstr << "indirect call";
70 rawstr << "[" << getDstID() << "<--" << getSrcID() << "]\t";
71 return rawstr.str();
72}
NodeID getDstID() const
NodeID getSrcID() const
get methods of the components
bool isDirectCallEdge() const
CallSiteID getCallSiteID() const
Get direct and indirect calls.

Friends And Related Symbol Documentation

◆ operator<<

OutStream & operator<< ( OutStream &  o,
const PTACallGraphEdge &  edge 
)
friend

Overloading operator << for dumping ICFG node ID.

Definition at line 158 of file PTACallGraph.h.

159 {
160 o << edge.toString();
161 return o;
162 }

Member Data Documentation

◆ csId

CallSiteID SVF::PTACallGraphEdge::csId
private

Definition at line 66 of file PTACallGraph.h.

◆ directCalls

CallInstSet SVF::PTACallGraphEdge::directCalls
private

Definition at line 64 of file PTACallGraph.h.

◆ indirectCalls

CallInstSet SVF::PTACallGraphEdge::indirectCalls
private

Definition at line 65 of file PTACallGraph.h.


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