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

#include <SVFStatements.h>

Inheritance diagram for SVF::PhiStmt:
SVF::MultiOpndStmt SVF::SVFStmt SVF::GenericEdge< SVFVar >

Public Types

typedef std::vector< const ICFGNode * > OpICFGNodeVec
Public Types inherited from SVF::MultiOpndStmt
typedef std::vector< ValVar * > OPVars
Public Types inherited from SVF::SVFStmt
enum  PEDGEK {
  Addr , Copy , Store , Load ,
  Call , Ret , Gep , Phi ,
  Select , Cmp , BinaryOp , UnaryOp ,
  Branch , ThreadFork , ThreadJoin
}
typedef GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
typedef Map< EdgeID, SVFStmtSetTy > PAGEdgeToSetMapTy
typedef PAGEdgeToSetMapTy KindToSVFStmtMapTy
typedef SVFStmtSetTy PAGEdgeSetTy
Public Types inherited from SVF::GenericEdge< SVFVar >
typedef SVFVar 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

 PhiStmt (ValVar *res, const OPVars &opnds, const OpICFGNodeVec &icfgNodes)
 constructor
void addOpVar (ValVar *op, const ICFGNode *inode)
void setOpICFGNodeVec (OpICFGNodeVec &icfgNodes)
const OpICFGNodeVec * getOpICFGNodeVec () const
const ICFGNode * getOpICFGNode (u32_t op_idx) const
 Return the corresponding ICFGNode of this operand.
bool isFunctionRetPhi () const
virtual const std::string toString () const override
Public Member Functions inherited from SVF::MultiOpndStmt
const ValVar * getOpVar (u32_t pos) const
 Operand SVFVars.
const ValVar * getRes () const
 Result SVFVar.
NodeID getOpVarID (u32_t pos) const
NodeID getResID () const
u32_t getOpVarNum () const
const OPVars & getOpndVars () const
OPVars::const_iterator opVarBegin () const
OPVars::const_iterator opVerEnd () const
Public Member Functions inherited from SVF::SVFStmt
 SVFStmt (SVFVar *s, SVFVar *d, GEdgeFlag k, bool real=true)
 Constructor.
 ~SVFStmt ()
 Destructor.
EdgeID getEdgeID () const
 Return Edge ID.
virtual bool isPTAEdge () const
 Whether src and dst nodes are both of pointer type.
void setValue (const SVFVar *val)
 Get/set methods for llvm instruction.
const SVFVar * getValue () const
void setBB (const SVFBasicBlock *bb)
const SVFBasicBlock * getBB () const
void setICFGNode (ICFGNode *node)
ICFGNode * getICFGNode () const
Public Member Functions inherited from SVF::GenericEdge< SVFVar >
 GenericEdge (SVFVar *s, SVFVar *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 PhiStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const SVFStmt *edge)
static bool classof (const MultiOpndStmt *edge)
static bool classof (const GenericPAGEdgeTy *edge)
Static Public Member Functions inherited from SVF::MultiOpndStmt
static bool classof (const MultiOpndStmt *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const SVFStmt *node)
static bool classof (const GenericPAGEdgeTy *node)
Static Public Member Functions inherited from SVF::SVFStmt
static bool classof (const SVFStmt *)
 ClassOf.
static bool classof (const GenericPAGEdgeTy *edge)
static GEdgeFlag makeEdgeFlagWithAddionalOpnd (GEdgeKind k, const SVFVar *var)
static GEdgeFlag makeEdgeFlagWithCallInst (GEdgeKind k, const ICFGNode *cs)
static GEdgeFlag makeEdgeFlagWithStoreInst (GEdgeKind k, const ICFGNode *store)
static const Inst2LabelMap * getInst2LabelMap ()
static const Var2LabelMap * getVar2LabelMap ()
static const u64_t * getCallEdgeLabelCounter ()
static const u64_t * getStoreEdgeLabelCounter ()
static const u64_t * getMultiOpndLabelCounter ()

Private Member Functions

 PhiStmt (const PhiStmt &)
 place holder
void operator= (const PhiStmt &)
 place holder

Private Attributes

OpICFGNodeVec opICFGNodes

Friends

class GraphDBClient

Additional Inherited Members

Protected Member Functions inherited from SVF::MultiOpndStmt
 MultiOpndStmt (ValVar *r, const OPVars &opnds, GEdgeFlag k)
 Constructor, only used by subclasses but not external users.
Protected Member Functions inherited from SVF::SVFStmt
 SVFStmt (GEdgeFlag k)
 Private constructor for reading SVFIR from file without side-effect.
 SVFStmt (SVFVar *s, SVFVar *d, GEdgeFlag k, EdgeID eid, SVFVar *value, ICFGNode *icfgNode, bool real=true)
void setBasicBlock (const SVFBasicBlock *bb)
void setCallEdgeLabelCounter (u64_t counter)
void setStoreEdgeLabelCounter (u64_t counter)
void setMultiOpndLabelCounter (u64_t counter)
Static Protected Member Functions inherited from SVF::SVFStmt
static void addInst2Labeled (const ICFGNode *cs, u32_t label)
static void addVar2Labeled (const SVFVar *var, u32_t label)
Protected Attributes inherited from SVF::MultiOpndStmt
OPVars opVars
Static Protected Attributes inherited from SVF::GenericEdge< SVFVar >
static constexpr unsigned char EdgeKindMaskBits
 We use the lower 8 bits to denote edge kind.
static constexpr u64_t EdgeKindMask

Detailed Description

Phi statement (e.g., p = phi(q,r) which receives values from variables q and r from different paths) it is typically at a joint point of the control-flow graph

Definition at line 911 of file SVFStatements.h.

Member Typedef Documentation

◆ OpICFGNodeVec

typedef std::vector<const ICFGNode*> SVF::PhiStmt::OpICFGNodeVec

Definition at line 915 of file SVFStatements.h.

Constructor & Destructor Documentation

◆ PhiStmt() [1/2]

SVF::PhiStmt::PhiStmt ( const PhiStmt & )
private

place holder

◆ PhiStmt() [2/2]

SVF::PhiStmt::PhiStmt ( ValVar * res,
const OPVars & opnds,
const OpICFGNodeVec & icfgNodes )
inline

constructor

Definition at line 945 of file SVFStatements.h.

946 : MultiOpndStmt(res, opnds, SVFStmt::Phi), opICFGNodes(icfgNodes)
947 {
948 assert(opnds.size() == icfgNodes.size() &&
949 "Numbers of operands and their ICFGNodes are not consistent?");
950 }
MultiOpndStmt()
place holder
OpICFGNodeVec opICFGNodes

Member Function Documentation

◆ addOpVar()

void SVF::PhiStmt::addOpVar ( ValVar * op,
const ICFGNode * inode )
inline

Definition at line 951 of file SVFStatements.h.

952 {
953 opVars.push_back(op);
954 opICFGNodes.push_back(inode);
955 assert(opVars.size() == opICFGNodes.size() &&
956 "Numbers of operands and their ICFGNodes are not consistent?");
957 }

◆ classof() [1/4]

bool SVF::PhiStmt::classof ( const GenericPAGEdgeTy * edge)
inlinestatic

Definition at line 938 of file SVFStatements.h.

939 {
940 return edge->getEdgeKind() == SVFStmt::Phi;
941 }

◆ classof() [2/4]

bool SVF::PhiStmt::classof ( const MultiOpndStmt * edge)
inlinestatic

Definition at line 934 of file SVFStatements.h.

935 {
936 return edge->getEdgeKind() == SVFStmt::Phi;
937 }

◆ classof() [3/4]

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

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

Definition at line 926 of file SVFStatements.h.

927 {
928 return true;
929 }

◆ classof() [4/4]

bool SVF::PhiStmt::classof ( const SVFStmt * edge)
inlinestatic

Definition at line 930 of file SVFStatements.h.

931 {
932 return edge->getEdgeKind() == SVFStmt::Phi;
933 }

◆ getOpICFGNode()

const ICFGNode * SVF::PhiStmt::getOpICFGNode ( u32_t op_idx) const
inline

Return the corresponding ICFGNode of this operand.

Definition at line 972 of file SVFStatements.h.

973 {
974 return opICFGNodes.at(op_idx);
975 }

◆ getOpICFGNodeVec()

const OpICFGNodeVec * SVF::PhiStmt::getOpICFGNodeVec ( ) const
inline

Definition at line 966 of file SVFStatements.h.

967 {
968 return &opICFGNodes;
969 }

◆ isFunctionRetPhi()

bool PhiStmt::isFunctionRetPhi ( ) const

Return true if this is a phi at the function exit to receive one or multiple return values of this function

Definition at line 464 of file SVFStatements.cpp.

465{
467}
const ValVar * getRes() const
Result SVFVar.
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241

◆ operator=()

void SVF::PhiStmt::operator= ( const PhiStmt & )
private

place holder

◆ setOpICFGNodeVec()

void SVF::PhiStmt::setOpICFGNodeVec ( OpICFGNodeVec & icfgNodes)
inline

Definition at line 959 of file SVFStatements.h.

960 {
961 assert(opVars.size() == icfgNodes.size() &&
962 "Numbers of operands and their ICFGNodes are not consistent?");
963 opICFGNodes = icfgNodes;
964 }

◆ toString()

const std::string PhiStmt::toString ( ) const
overridevirtual

Reimplemented from SVF::SVFStmt.

Definition at line 110 of file SVFStatements.cpp.

111{
112 std::string str;
113 std::stringstream rawstr(str);
114 rawstr << "PhiStmt: [Var" << getResID() << " <-- (";
115 for(u32_t i = 0; i < getOpVarNum(); i++)
116 rawstr << "[Var" << getOpVar(i)->getId() << ", ICFGNode" << getOpICFGNode(i)->getId() << "],";
117 rawstr << ")]\t";
119 {
120 rawstr << "\n";
121 rawstr << getValue()->toString();
122 }
123 return rawstr.str();
124}
NodeID getResID() const
const ValVar * getOpVar(u32_t pos) const
Operand SVFVars.
u32_t getOpVarNum() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:120
const ICFGNode * getOpICFGNode(u32_t op_idx) const
Return the corresponding ICFGNode of this operand.
const SVFVar * getValue() const
NodeID getId() const
Get ID.
Definition SVFValue.h:158
virtual const std::string toString() const
Get string representation.
unsigned u32_t
Definition GeneralType.h:67

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 913 of file SVFStatements.h.

Member Data Documentation

◆ opICFGNodes

OpICFGNodeVec SVF::PhiStmt::opICFGNodes
private

Definition at line 921 of file SVFStatements.h.


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