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

#include <ICFGEdge.h>

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

Public Member Functions

 IntraCFGEdge (ICFGNode *s, ICFGNode *d)
 Constructor. More...
 
const SVFVargetCondition () 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. More...
 
 ~ICFGEdge ()
 Destructor. More...
 
bool isCFGEdge () const
 Get methods of the components. More...
 
bool isCallCFGEdge () const
 
bool isRetCFGEdge () const
 
bool isIntraCFGEdge () const
 
- Public Member Functions inherited from SVF::GenericEdge< NodeTy >
 GenericEdge (NodeTy *s, NodeTy *d, GEdgeFlag k)
 Constructor. More...
 
virtual ~GenericEdge ()
 Destructor. More...
 
NodeID getSrcID () const
 get methods of the components More...
 
NodeID getDstID () const
 
GEdgeKind getEdgeKind () const
 
GEdgeKind getEdgeKindWithoutMask () const
 
NodeTypegetSrcNode () const
 
NodeTypegetDstNode () 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: More...
 
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. More...
 

Private Member Functions

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

Private Attributes

const SVFVarconditionVar
 
s64_t branchCondVal
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
class ICFG
 
class SVFIRBuilder
 

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< NodeTy >
typedef NodeTy NodeType
 Node type. More...
 
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) More...
 
- Static Protected Attributes inherited from SVF::GenericEdge< NodeTy >
static constexpr unsigned char EdgeKindMaskBits = 8
 We use the lower 8 bits to denote edge kind. More...
 
static constexpr u64_t EdgeKindMask = (~0ULL) >> (64 - EdgeKindMaskBits)
 

Detailed Description

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

Definition at line 113 of file ICFGEdge.h.

Constructor & Destructor Documentation

◆ IntraCFGEdge()

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

Constructor.

Definition at line 122 of file ICFGEdge.h.

123  : ICFGEdge(s, d, IntraCF), conditionVar(nullptr), branchCondVal(0)
124  {
125  }
ICFGEdge(ICFGNode *s, ICFGNode *d, GEdgeFlag k)
Constructor.
Definition: ICFGEdge.h:64
const SVFVar * conditionVar
Definition: ICFGEdge.h:165
s64_t branchCondVal
Definition: ICFGEdge.h:166

Member Function Documentation

◆ classof() [1/3]

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

Definition at line 136 of file ICFGEdge.h.

137  {
138  return edge->getEdgeKind() == IntraCF;
139  }

◆ classof() [2/3]

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

Definition at line 132 of file ICFGEdge.h.

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

◆ classof() [3/3]

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

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

Definition at line 128 of file ICFGEdge.h.

129  {
130  return true;
131  }

◆ getCondition()

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

Definition at line 142 of file ICFGEdge.h.

143  {
144  return conditionVar;
145  }

◆ getSuccessorCondValue()

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

Definition at line 147 of file ICFGEdge.h.

148  {
149  assert(getCondition() && "this is not a conditional branch edge");
150  return branchCondVal;
151  }
const SVFVar * getCondition() const
Definition: ICFGEdge.h:142

◆ setBranchCondVal()

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

Definition at line 173 of file ICFGEdge.h.

174  {
175  branchCondVal = bVal;
176  }

◆ setConditionVar()

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

Definition at line 168 of file ICFGEdge.h.

169  {
170  conditionVar = c;
171  }

◆ toString()

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

Reimplemented from SVF::ICFGEdge.

Definition at line 165 of file ICFG.cpp.

166 {
167  std::string str;
168  std::stringstream rawstr(str);
169  if(getCondition() == nullptr)
170  rawstr << "IntraCFGEdge: [ICFGNode" << getDstID() << " <-- ICFGNode" << getSrcID() << "]\t";
171  else
172  rawstr << "IntraCFGEdge: [ICFGNode" << getDstID() << " <-- ICFGNode" << getSrcID() << "] (branchCondition:" << getCondition()->toString() << ") (succCondValue: " << getSuccessorCondValue() << ") \t";
173 
174  return rawstr.str();
175 }
const char *const string
Definition: cJSON.h:172
NodeID getDstID() const
Definition: GenericGraph.h:85
NodeID getSrcID() const
get methods of the components
Definition: GenericGraph.h:81
s64_t getSuccessorCondValue() const
Definition: ICFGEdge.h:147
virtual const std::string toString() const

Friends And Related Function Documentation

◆ ICFG

friend class ICFG
friend

Definition at line 117 of file ICFGEdge.h.

◆ SVFIRBuilder

friend class SVFIRBuilder
friend

Definition at line 118 of file ICFGEdge.h.

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 116 of file ICFGEdge.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 115 of file ICFGEdge.h.

Member Data Documentation

◆ branchCondVal

s64_t SVF::IntraCFGEdge::branchCondVal
private

Definition at line 166 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 165 of file ICFGEdge.h.


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