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::CallGraphEdge Class Reference

#include <CallGraph.h>

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

Public Types

enum  CEDGEK { CallRetEdge , TDForkEdge , TDJoinEdge , HareParForEdge }
 
typedef Set< const CallICFGNode * > CallInstSet
 
typedef GenericNode< CallGraphNode, CallGraphEdge >::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

 CallGraphEdge (CallGraphNode *s, CallGraphNode *d, CEDGEK kind, CallSiteID cs)
 Constructor.
 
virtual ~CallGraphEdge ()
 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 CallGraphEdge *)
 ClassOf.
 
static bool classof (const GenericPTACallGraphEdgeTy *edge)
 

Private Attributes

CallInstSet directCalls
 
CallInstSet indirectCalls
 
CallSiteID csId
 

Friends

OutStream & operator<< (OutStream &o, const CallGraphEdge &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 51 of file CallGraph.h.

Member Typedef Documentation

◆ CallGraphEdgeSet

Definition at line 166 of file CallGraph.h.

◆ CallInstSet

Definition at line 55 of file CallGraph.h.

Member Enumeration Documentation

◆ CEDGEK

Enumerator
CallRetEdge 
TDForkEdge 
TDJoinEdge 
HareParForEdge 

Definition at line 56 of file CallGraph.h.

Constructor & Destructor Documentation

◆ CallGraphEdge()

SVF::CallGraphEdge::CallGraphEdge ( CallGraphNode *  s,
CallGraphNode *  d,
CEDGEK  kind,
CallSiteID  cs 
)
inline

Constructor.

Definition at line 68 of file CallGraph.h.

68 :
70 {
71 }
CallSiteID csId
Definition CallGraph.h:65
static GEdgeFlag makeEdgeFlagWithInvokeID(GEdgeKind k, CallSiteID cs)
Compute the unique edgeFlag value from edge kind and CallSiteID.
Definition CallGraph.h:77
GenericEdge< CallGraphNode > GenericPTACallGraphEdgeTy
Definition CallGraph.h:50
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ ~CallGraphEdge()

virtual SVF::CallGraphEdge::~CallGraphEdge ( )
inlinevirtual

Destructor.

Definition at line 73 of file CallGraph.h.

74 {
75 }

Member Function Documentation

◆ addDirectCallSite()

void CallGraphEdge::addDirectCallSite ( const CallICFGNode *  call)

Add direct and indirect callsite.

Definition at line 55 of file CallGraph.cpp.

56{
57 assert(call->getCalledFunction() && "not a direct callsite??");
58 directCalls.insert(call);
59}
CallInstSet directCalls
Definition CallGraph.h:63
const FunObjVar * getCalledFunction() const
Definition ICFGNode.h:501

◆ addInDirectCallSite()

void CallGraphEdge::addInDirectCallSite ( const CallICFGNode *  call)

Definition at line 61 of file CallGraph.cpp.

62{
63 assert((nullptr == call->getCalledFunction() || !SVFUtil::isa<FunValVar>(SVFUtil::getForkedFun(call))) &&
64 "not an indirect callsite??");
65 indirectCalls.insert(call);
66}
CallInstSet indirectCalls
Definition CallGraph.h:64
const ValVar * getForkedFun(const CallICFGNode *inst)
Return thread fork function.
Definition SVFUtil.h:321

◆ classof() [1/2]

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

ClassOf.

Definition at line 143 of file CallGraph.h.

144 {
145 return true;
146 }

◆ classof() [2/2]

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

Definition at line 147 of file CallGraph.h.

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

◆ directCallsBegin()

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

Iterators for direct and indirect callsites.

Definition at line 122 of file CallGraph.h.

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

◆ directCallsEnd()

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

Definition at line 126 of file CallGraph.h.

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

◆ getCallSiteID()

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

Get direct and indirect calls.

Definition at line 83 of file CallGraph.h.

84 {
85 return csId;
86 }

◆ getDirectCalls() [1/2]

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

Definition at line 95 of file CallGraph.h.

96 {
97 return directCalls;
98 }

◆ getDirectCalls() [2/2]

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

Definition at line 103 of file CallGraph.h.

104 {
105 return directCalls;
106 }

◆ getIndirectCalls() [1/2]

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

Definition at line 99 of file CallGraph.h.

100 {
101 return indirectCalls;
102 }

◆ getIndirectCalls() [2/2]

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

Definition at line 107 of file CallGraph.h.

108 {
109 return indirectCalls;
110 }

◆ indirectCallsBegin()

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

Definition at line 131 of file CallGraph.h.

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

◆ indirectCallsEnd()

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

Definition at line 135 of file CallGraph.h.

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

◆ isDirectCallEdge()

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

Definition at line 87 of file CallGraph.h.

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

◆ isIndirectCallEdge()

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

Definition at line 91 of file CallGraph.h.

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

◆ makeEdgeFlagWithInvokeID()

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

Compute the unique edgeFlag value from edge kind and CallSiteID.

Definition at line 77 of file CallGraph.h.

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

◆ toString()

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

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

Definition at line 69 of file CallGraph.cpp.

70{
71 std::string str;
72 std::stringstream rawstr(str);
73 rawstr << "CallSite ID: " << getCallSiteID();
75 rawstr << "direct call";
76 else
77 rawstr << "indirect call";
78 rawstr << "[" << getDstID() << "<--" << getSrcID() << "]\t";
79 return rawstr.str();
80}
bool isDirectCallEdge() const
Definition CallGraph.h:87
CallSiteID getCallSiteID() const
Get direct and indirect calls.
Definition CallGraph.h:83
NodeID getDstID() const
NodeID getSrcID() const
get methods of the components

Friends And Related Symbol Documentation

◆ operator<<

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

Overloading operator << for dumping ICFG node ID.

Definition at line 157 of file CallGraph.h.

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

Member Data Documentation

◆ csId

CallSiteID SVF::CallGraphEdge::csId
private

Definition at line 65 of file CallGraph.h.

◆ directCalls

CallInstSet SVF::CallGraphEdge::directCalls
private

Definition at line 63 of file CallGraph.h.

◆ indirectCalls

CallInstSet SVF::CallGraphEdge::indirectCalls
private

Definition at line 64 of file CallGraph.h.


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