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

#include <SVFStatements.h>

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

Public Types

typedef std::vector< const ICFGNode * > OpICFGNodeVec
 
- Public Types inherited from SVF::MultiOpndStmt
typedef std::vector< SVFVar * > 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, SVFStmtSetTyPAGEdgeToSetMapTy
 
typedef PAGEdgeToSetMapTy KindToSVFStmtMapTy
 
typedef SVFStmtSetTy PAGEdgeSetTy
 
- 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

 PhiStmt (SVFVar *res, const OPVars &opnds, const OpICFGNodeVec &icfgNodes)
 constructor
 
void addOpVar (SVFVar *op, const ICFGNode *inode)
 
void setOpICFGNodeVec (OpICFGNodeVec &icfgNodes)
 
const OpICFGNodeVecgetOpICFGNodeVec () const
 
const ICFGNodegetOpICFGNode (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 SVFVargetOpVar (u32_t pos) const
 Operand SVFVars.
 
const SVFVargetRes () const
 Result SVFVar.
 
NodeID getOpVarID (u32_t pos) const
 
NodeID getResID () const
 
u32_t getOpVarNum () const
 
const OPVarsgetOpndVars () 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 SVFVargetValue () const
 
void setBB (const SVFBasicBlock *bb)
 
const SVFBasicBlockgetBB () const
 
void setICFGNode (ICFGNode *node)
 
ICFGNodegetICFGNode () 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
 
NodeTypegetSrcNode () const
 
NodeTypegetDstNode () 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 Inst2LabelMapgetInst2LabelMap ()
 
static const Var2LabelMapgetVar2LabelMap ()
 
static const u64_tgetCallEdgeLabelCounter ()
 
static const u64_tgetStoreEdgeLabelCounter ()
 
static const u64_tgetMultiOpndLabelCounter ()
 

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 (SVFVar *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< 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

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 866 of file SVFStatements.h.

Member Typedef Documentation

◆ OpICFGNodeVec

Definition at line 870 of file SVFStatements.h.

Constructor & Destructor Documentation

◆ PhiStmt() [1/2]

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

place holder

◆ PhiStmt() [2/2]

SVF::PhiStmt::PhiStmt ( SVFVar res,
const OPVars opnds,
const OpICFGNodeVec icfgNodes 
)
inline

constructor

Definition at line 900 of file SVFStatements.h.

901 : MultiOpndStmt(res, opnds, SVFStmt::Phi), opICFGNodes(icfgNodes)
902 {
903 assert(opnds.size() == icfgNodes.size() &&
904 "Numbers of operands and their ICFGNodes are not consistent?");
905 }
MultiOpndStmt()
place holder
OpICFGNodeVec opICFGNodes
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ addOpVar()

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

Definition at line 906 of file SVFStatements.h.

907 {
908 opVars.push_back(op);
909 opICFGNodes.push_back(inode);
910 assert(opVars.size() == opICFGNodes.size() &&
911 "Numbers of operands and their ICFGNodes are not consistent?");
912 }

◆ classof() [1/4]

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

Definition at line 893 of file SVFStatements.h.

894 {
895 return edge->getEdgeKind() == SVFStmt::Phi;
896 }

◆ classof() [2/4]

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

Definition at line 889 of file SVFStatements.h.

890 {
891 return edge->getEdgeKind() == SVFStmt::Phi;
892 }

◆ classof() [3/4]

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

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

Definition at line 881 of file SVFStatements.h.

882 {
883 return true;
884 }

◆ classof() [4/4]

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

Definition at line 885 of file SVFStatements.h.

886 {
887 return edge->getEdgeKind() == SVFStmt::Phi;
888 }

◆ getOpICFGNode()

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

Return the corresponding ICFGNode of this operand.

Definition at line 927 of file SVFStatements.h.

928 {
929 return opICFGNodes.at(op_idx);
930 }

◆ getOpICFGNodeVec()

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

Definition at line 921 of file SVFStatements.h.

922 {
923 return &opICFGNodes;
924 }

◆ 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 315 of file SVFStatements.cpp.

316{
317 return SVFUtil::isa<RetValPN>(getRes());
318}
const SVFVar * getRes() const
Result SVFVar.

◆ operator=()

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

place holder

◆ setOpICFGNodeVec()

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

Definition at line 914 of file SVFStatements.h.

915 {
916 assert(opVars.size() == icfgNodes.size() &&
917 "Numbers of operands and their ICFGNodes are not consistent?");
918 opICFGNodes = icfgNodes;
919 }

◆ 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}
unsigned u32_t
Definition CommandLine.h:18
NodeID getResID() const
const SVFVar * getOpVar(u32_t pos) const
Operand SVFVars.
u32_t getOpVarNum() const
static const Option< bool > ShowSVFIRValue
Definition Options.h:119
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:160
virtual const std::string toString() const
Get string representation.

Friends And Related Symbol Documentation

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 868 of file SVFStatements.h.

Member Data Documentation

◆ opICFGNodes

OpICFGNodeVec SVF::PhiStmt::opICFGNodes
private

Definition at line 876 of file SVFStatements.h.


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