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

#include <ICFGEdge.h>

Inheritance diagram for SVF::IntraCFGEdge:
SVF::ICFGEdge SVF::GenericEdge< ICFGNode >

Public Member Functions

 IntraCFGEdge (ICFGNode *s, ICFGNode *d)
 Constructor.
const SVFVar * getCondition () const
s64_t getSuccessorCondValue () const
virtual const std::string toString () const
Public Member Functions inherited from SVF::ICFGEdge
 ICFGEdge (ICFGNode *s, ICFGNode *d, GEdgeFlag k)
 Constructor.
 ~ICFGEdge ()
 Destructor.
bool isCFGEdge () const
 Get methods of the components.
bool isCallCFGEdge () const
bool isRetCFGEdge () const
bool isIntraCFGEdge () const
Public Member Functions inherited from SVF::GenericEdge< ICFGNode >
 GenericEdge (ICFGNode *s, ICFGNode *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 bool classof (const IntraCFGEdge *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const ICFGEdge *edge)
static bool classof (const GenericICFGEdgeTy *edge)
Static Public Member Functions inherited from SVF::ICFGEdge
static GEdgeFlag makeEdgeFlagWithInvokeID (GEdgeKind k, CallSiteID cs)
 Compute the unique edgeFlag value from edge kind and CallSiteID.

Private Member Functions

void setConditionVar (const SVFVar *c)
void setBranchCondVal (s64_t bVal)

Private Attributes

const SVFVar * conditionVar
s64_t branchCondVal

Friends

class ICFG
class SVFIRBuilder
class GraphDBClient

Additional Inherited Members

Public Types inherited from SVF::ICFGEdge
enum  ICFGEdgeK { IntraCF , CallCF , RetCF }
typedef ICFGEdgeK SVFGEdgeK
typedef GenericNode< ICFGNode, ICFGEdge >::GEdgeSetTy ICFGEdgeSetTy
typedef ICFGEdgeSetTy SVFGEdgeSetTy
Public Types inherited from SVF::GenericEdge< ICFGNode >
typedef ICFGNode 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).
Static Protected Attributes inherited from SVF::GenericEdge< ICFGNode >
static constexpr unsigned char EdgeKindMaskBits
 We use the lower 8 bits to denote edge kind.
static constexpr u64_t EdgeKindMask

Detailed Description

Intra ICFG edge representing control-flows between basic blocks within a function

Definition at line 111 of file ICFGEdge.h.

Constructor & Destructor Documentation

◆ IntraCFGEdge()

SVF::IntraCFGEdge::IntraCFGEdge ( ICFGNode * s,
ICFGNode * d )
inline

Constructor.

Definition at line 119 of file ICFGEdge.h.

120 : ICFGEdge(s, d, IntraCF), conditionVar(nullptr), branchCondVal(0)
121 {
122 }
ICFGEdge(ICFGNode *s, ICFGNode *d, GEdgeFlag k)
Constructor.
Definition ICFGEdge.h:62
const SVFVar * conditionVar
Definition ICFGEdge.h:162

Member Function Documentation

◆ classof() [1/3]

bool SVF::IntraCFGEdge::classof ( const GenericICFGEdgeTy * edge)
inlinestatic

Definition at line 133 of file ICFGEdge.h.

134 {
135 return edge->getEdgeKind() == IntraCF;
136 }

◆ classof() [2/3]

bool SVF::IntraCFGEdge::classof ( const ICFGEdge * edge)
inlinestatic

Definition at line 129 of file ICFGEdge.h.

130 {
131 return edge->getEdgeKind() == IntraCF;
132 }

◆ classof() [3/3]

bool SVF::IntraCFGEdge::classof ( const IntraCFGEdge * )
inlinestatic

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

Definition at line 125 of file ICFGEdge.h.

126 {
127 return true;
128 }

◆ getCondition()

const SVFVar * SVF::IntraCFGEdge::getCondition ( ) const
inline

Definition at line 139 of file ICFGEdge.h.

140 {
141 return conditionVar;
142 }

◆ getSuccessorCondValue()

s64_t SVF::IntraCFGEdge::getSuccessorCondValue ( ) const
inline

Definition at line 144 of file ICFGEdge.h.

145 {
146 assert(getCondition() && "this is not a conditional branch edge");
147 return branchCondVal;
148 }
const SVFVar * getCondition() const
Definition ICFGEdge.h:139

◆ setBranchCondVal()

void SVF::IntraCFGEdge::setBranchCondVal ( s64_t bVal)
inlineprivate

Definition at line 170 of file ICFGEdge.h.

171 {
172 branchCondVal = bVal;
173 }

◆ setConditionVar()

void SVF::IntraCFGEdge::setConditionVar ( const SVFVar * c)
inlineprivate

Definition at line 165 of file ICFGEdge.h.

166 {
167 conditionVar = c;
168 }

◆ toString()

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

Reimplemented from SVF::ICFGEdge.

Definition at line 163 of file ICFG.cpp.

164{
165 std::string str;
166 std::stringstream rawstr(str);
167 if(getCondition() == nullptr)
168 rawstr << "IntraCFGEdge: [ICFGNode" << getDstID() << " <-- ICFGNode" << getSrcID() << "]\t";
169 else
170 rawstr << "IntraCFGEdge: [ICFGNode" << getDstID() << " <-- ICFGNode" << getSrcID() << "] (branchCondition:" << getCondition()->toString() << ") (succCondValue: " << getSuccessorCondValue() << ") \t";
171
172 return rawstr.str();
173}
s64_t getSuccessorCondValue() const
Definition ICFGEdge.h:144
virtual const std::string toString() const
Get string representation.

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 115 of file ICFGEdge.h.

◆ ICFG

friend class ICFG
friend

Definition at line 113 of file ICFGEdge.h.

◆ SVFIRBuilder

friend class SVFIRBuilder
friend

Definition at line 114 of file ICFGEdge.h.

Member Data Documentation

◆ branchCondVal

s64_t SVF::IntraCFGEdge::branchCondVal
private

Definition at line 163 of file ICFGEdge.h.

◆ conditionVar

const SVFVar* SVF::IntraCFGEdge::conditionVar
private

conditionVar is a boolean (for if/else) or numeric condition variable (for switch). branchCondVal is the value when this condition should hold to execute this CFGEdge. E.g., Inst1: br cmp label 0, label 1, Inst2: label 0 Inst3: label 1; for edge between Inst1 and Inst 2, the first element is cmp and the second element is 0

Definition at line 162 of file ICFGEdge.h.


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