Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SVF::PHIVFGNode Class Reference

#include <VFGNode.h>

Inheritance diagram for SVF::PHIVFGNode:
SVF::VFGNode SVF::GenericNode< NodeTy, EdgeTy > SVF::SVFBaseNode SVF::InterPHIVFGNode SVF::IntraPHIVFGNode

Public Types

typedef Map< u32_t, const PAGNode * > OPVers
 
- Public Types inherited from SVF::VFGNode
typedef GNodeK VFGNodeK
 
typedef VFGEdge::VFGEdgeSetTy::iterator iterator
 
typedef VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
 
typedef Set< const CallPE * > CallPESet
 
typedef Set< const RetPE * > RetPESet
 
- Public Types inherited from SVF::GenericNode< NodeTy, EdgeTy >
typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
 Edge kind. More...
 
typedef GEdgeSetTy::iterator iterator
 
typedef GEdgeSetTy::const_iterator const_iterator
 
- Public Types inherited from SVF::SVFBaseNode
enum  GNodeK {
  IntraBlock , GlobalBlock , FunEntryBlock , FunExitBlock ,
  FunCallBlock , FunRetBlock , ValNode , GepValNode ,
  RetNode , VarargNode , DummyValNode , ObjNode ,
  GepObjNode , FIObjNode , DummyObjNode , Cmp ,
  BinaryOp , UnaryOp , Branch , DummyVProp ,
  NPtr , FRet , ARet , AParm ,
  FParm , Addr , Copy , Gep ,
  Store , Load , TPhi , TIntraPhi ,
  TInterPhi , FPIN , FPOUT , APIN ,
  APOUT , MPhi , MIntraPhi , MInterPhi ,
  CallNodeKd , CDNodeKd , CFLNodeKd , CHNodeKd ,
  ConstraintNodeKd , TCTNodeKd , DCHNodeKd , OtherKd
}
 

Public Member Functions

 PHIVFGNode (NodeID id, const PAGNode *r, VFGNodeK k=TPhi)
 Constructor. More...
 
bool isPTANode () const
 Whether this phi node is of pointer type (used for pointer analysis). More...
 
const PAGNodegetOpVer (u32_t pos) const
 Operands at a llvm PHINode. More...
 
void setOpVer (u32_t pos, const PAGNode *node)
 
const PAGNodegetRes () const
 
u32_t getOpVerNum () const
 
OPVers::const_iterator opVerBegin () const
 
OPVers::const_iterator opVerEnd () const
 
const NodeBS getDefSVFVars () const override
 Return the left hand side SVF Vars. More...
 
const SVFValuegetValue () const override
 Return the corresponding LLVM value, if possible, nullptr otherwise. More...
 
const std::string toString () const override
 
- Public Member Functions inherited from SVF::VFGNode
 VFGNode (NodeID i, VFGNodeK k)
 Constructor. More...
 
virtual const ICFGNodegetICFGNode () const
 Return corresponding ICFG node. More...
 
virtual void setICFGNode (const ICFGNode *node)
 Set corresponding ICFG node. More...
 
virtual const SVFFunctiongetFun () const
 Get the function of this SVFGNode. More...
 
- Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
 GenericNode (NodeID i, GNodeK k)
 Constructor. More...
 
virtual ~GenericNode ()
 Destructor. More...
 
bool hasIncomingEdge () const
 Has incoming/outgoing edge set. More...
 
bool hasOutgoingEdge () const
 
iterator OutEdgeBegin ()
 iterators More...
 
iterator OutEdgeEnd ()
 
iterator InEdgeBegin ()
 
iterator InEdgeEnd ()
 
const_iterator OutEdgeBegin () const
 
const_iterator OutEdgeEnd () const
 
const_iterator InEdgeBegin () const
 
const_iterator InEdgeEnd () const
 
virtual iterator directOutEdgeBegin ()
 Iterators used for SCC detection, overwrite it in child class if necessary. More...
 
virtual iterator directOutEdgeEnd ()
 
virtual iterator directInEdgeBegin ()
 
virtual iterator directInEdgeEnd ()
 
virtual const_iterator directOutEdgeBegin () const
 
virtual const_iterator directOutEdgeEnd () const
 
virtual const_iterator directInEdgeBegin () const
 
virtual const_iterator directInEdgeEnd () const
 
bool addIncomingEdge (EdgeType *inEdge)
 Add incoming and outgoing edges. More...
 
bool addOutgoingEdge (EdgeType *outEdge)
 
EdgeTypehasIncomingEdge (EdgeType *edge) const
 Find incoming and outgoing edges. More...
 
EdgeTypehasOutgoingEdge (EdgeType *edge) const
 
const GEdgeSetTygetOutEdges () const
 
const GEdgeSetTygetInEdges () const
 
u32_t removeIncomingEdge (EdgeType *edge)
 
u32_t removeOutgoingEdge (EdgeType *edge)
 
- Public Member Functions inherited from SVF::SVFBaseNode
 SVFBaseNode (NodeID i, GNodeK k, SVFType *ty=nullptr)
 
NodeID getId () const
 Get ID. More...
 
GNodeK getNodeKind () const
 Get node kind. More...
 
virtual const SVFTypegetType () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
const std::string valueOnlyToString () const
 

Static Public Member Functions

static bool classof (const PHIVFGNode *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const VFGNode *node)
 
static bool classof (const GenericVFGNodeTy *node)
 
static bool classof (const SVFBaseNode *node)
 
- Static Public Member Functions inherited from SVF::VFGNode
static bool classof (const VFGNode *)
 
static bool classof (const GenericVFGNodeTy *node)
 
static bool classof (const SVFBaseNode *node)
 
- Static Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
static bool classof (const GenericNode< NodeTy, EdgeTy > *)
 
static bool classof (const SVFBaseNode *)
 

Protected Attributes

const PAGNoderes
 
OPVers opVers
 
- Protected Attributes inherited from SVF::VFGNode
const ICFGNodeicfgNode
 
- Protected Attributes inherited from SVF::SVFBaseNode
NodeID id
 Node ID. More...
 
GNodeK nodeKind
 Node kind. More...
 
const SVFTypetype
 SVF type. More...
 
std::string sourceLoc
 Source code information of this value. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from SVF::SVFBaseNode
static bool isICFGNodeKinds (GNodeK n)
 Helper functions to check node kinds. More...
 
static bool isInterICFGNodeKind (GNodeK n)
 
static bool isSVFVarKind (GNodeK n)
 
static bool isValVarKinds (GNodeK n)
 
static bool isObjVarKinds (GNodeK n)
 
static bool isVFGNodeKinds (GNodeK n)
 
static bool isArgumentVFGNodeKinds (GNodeK n)
 
static bool isStmtVFGNodeKinds (GNodeK n)
 
static bool isPHIVFGNodeKinds (GNodeK n)
 
static bool isMRSVFGNodeKinds (GNodeK n)
 
static bool isMSSAPHISVFGNodeKinds (GNodeK n)
 

Detailed Description

Definition at line 668 of file VFGNode.h.

Member Typedef Documentation

◆ OPVers

Definition at line 672 of file VFGNode.h.

Constructor & Destructor Documentation

◆ PHIVFGNode()

PHIVFGNode::PHIVFGNode ( NodeID  id,
const PAGNode r,
VFGNodeK  k = TPhi 
)

Constructor.

Definition at line 428 of file VFG.cpp.

428  : VFGNode(id, k), res(r)
429 {
430 
431 }
const PAGNode * res
Definition: VFGNode.h:674
VFGNode(NodeID i, VFGNodeK k)
Constructor.
Definition: VFGNode.h:61

Member Function Documentation

◆ classof() [1/4]

static bool SVF::PHIVFGNode::classof ( const GenericVFGNodeTy node)
inlinestatic

Definition at line 727 of file VFGNode.h.

728  {
729  return isPHIVFGNodeKinds(node->getNodeKind());
730  }
static bool isPHIVFGNodeKinds(GNodeK n)
Definition: GenericGraph.h:363

◆ classof() [2/4]

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

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

Definition at line 719 of file VFGNode.h.

720  {
721  return true;
722  }

◆ classof() [3/4]

static bool SVF::PHIVFGNode::classof ( const SVFBaseNode node)
inlinestatic

Definition at line 731 of file VFGNode.h.

732  {
733  return isPHIVFGNodeKinds(node->getNodeKind());
734  }

◆ classof() [4/4]

static bool SVF::PHIVFGNode::classof ( const VFGNode node)
inlinestatic

Definition at line 723 of file VFGNode.h.

724  {
725  return isPHIVFGNodeKinds(node->getNodeKind());
726  }

◆ getDefSVFVars()

const NodeBS PHIVFGNode::getDefSVFVars ( ) const
overridevirtual

Return the left hand side SVF Vars.

Implements SVF::VFGNode.

Definition at line 213 of file VFG.cpp.

214 {
215  NodeBS nb;
216  nb.set(getRes()->getId());
217  return nb;
218 }
const PAGNode * getRes() const
Definition: VFGNode.h:699
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
void set(unsigned Idx)

◆ getOpVer()

const PAGNode* SVF::PHIVFGNode::getOpVer ( u32_t  pos) const
inline

Operands at a llvm PHINode.

Definition at line 689 of file VFGNode.h.

690  {
691  OPVers::const_iterator it = opVers.find(pos);
692  assert(it!=opVers.end() && "version is nullptr, did not rename?");
693  return it->second;
694  }
OPVers opVers
Definition: VFGNode.h:675

◆ getOpVerNum()

u32_t SVF::PHIVFGNode::getOpVerNum ( ) const
inline

Definition at line 703 of file VFGNode.h.

704  {
705  return opVers.size();
706  }

◆ getRes()

const PAGNode* SVF::PHIVFGNode::getRes ( ) const
inline

Definition at line 699 of file VFGNode.h.

700  {
701  return res;
702  }

◆ getValue()

const SVFValue * PHIVFGNode::getValue ( ) const
overridevirtual

Return the corresponding LLVM value, if possible, nullptr otherwise.

Reimplemented from SVF::VFGNode.

Definition at line 1091 of file VFG.cpp.

1092 {
1093  return getRes()->getValue();
1094 }
const SVFValue * getValue() const
Get/has methods of the components.
Definition: SVFVariables.h:83

◆ isPTANode()

bool SVF::PHIVFGNode::isPTANode ( ) const
inline

Whether this phi node is of pointer type (used for pointer analysis).

Definition at line 682 of file VFGNode.h.

683  {
684  return res->isPointer();
685  }
virtual bool isPointer() const
Whether it is a pointer.
Definition: SVFVariables.h:106

◆ opVerBegin()

OPVers::const_iterator SVF::PHIVFGNode::opVerBegin ( ) const
inline

Definition at line 707 of file VFGNode.h.

708  {
709  return opVers.begin();
710  }

◆ opVerEnd()

OPVers::const_iterator SVF::PHIVFGNode::opVerEnd ( ) const
inline

Definition at line 711 of file VFGNode.h.

712  {
713  return opVers.end();
714  }

◆ setOpVer()

void SVF::PHIVFGNode::setOpVer ( u32_t  pos,
const PAGNode node 
)
inline

Definition at line 695 of file VFGNode.h.

696  {
697  opVers[pos] = node;
698  }

◆ toString()

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

Reimplemented from SVF::VFGNode.

Reimplemented in SVF::InterPHIVFGNode, and SVF::IntraPHIVFGNode.

Definition at line 220 of file VFG.cpp.

221 {
222  std::string str;
223  std::stringstream rawstr(str);
224  rawstr << "PHIVFGNode ID: " << getId() << " ";
225  rawstr << "PAGNode: [" << res->getId() << " = PHI(";
226  for(PHIVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
227  it != eit; it++)
228  rawstr << it->second->getId() << ", ";
229  rawstr << ")]\t";
230  if(res->hasValue())
231  {
232  rawstr << " " << res->getValue()->toString();
233  }
234  return rawstr.str();
235 }
const char *const string
Definition: cJSON.h:172
OPVers::const_iterator opVerBegin() const
Definition: VFGNode.h:707
OPVers::const_iterator opVerEnd() const
Definition: VFGNode.h:711
std::string toString() const
Needs to be implemented by a SVF front end.
Definition: LLVMUtil.cpp:663
bool hasValue() const
Definition: SVFVariables.h:101

Member Data Documentation

◆ opVers

OPVers SVF::PHIVFGNode::opVers
protected

Definition at line 675 of file VFGNode.h.

◆ res

const PAGNode* SVF::PHIVFGNode::res
protected

Definition at line 674 of file VFGNode.h.


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