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

#include <SVFValue.h>

Inheritance diagram for SVF::SVFValue:
SVF::GenericNode< DCHNode, DCHEdge > SVF::GenericNode< CFLNode, CFLEdge > SVF::GenericNode< ConstraintNode, ConstraintEdge > SVF::GenericNode< NodeTy, EdgeTy > SVF::DCHNode SVF::CFLNode SVF::ConstraintNode SVF::CDGNode SVF::CHNode SVF::CallGraphNode SVF::ICFGNode SVF::SVFBasicBlock SVF::SVFVar SVF::TCTNode SVF::VFGNode

Public Types

enum  GNodeK {
  IntraBlock , GlobalBlock , FunEntryBlock , FunExitBlock ,
  FunCallBlock , FunRetBlock , ValNode , ArgValNode ,
  FunValNode , GepValNode , RetValNode , VarargValNode ,
  GlobalValNode , ConstAggValNode , ConstDataValNode , BlackHoleValNode ,
  ConstFPValNode , ConstIntValNode , ConstNullptrValNode , DummyValNode ,
  ObjNode , GepObjNode , BaseObjNode , FunObjNode ,
  HeapObjNode , StackObjNode , GlobalObjNode , ConstAggObjNode ,
  ConstDataObjNode , ConstFPObjNode , ConstIntObjNode , ConstNullptrObjNode ,
  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 , BasicBlockKd , OtherKd
}
 

Public Member Functions

 SVFValue (NodeID i, GNodeK k, const SVFType *ty=nullptr)
 
NodeID getId () const
 Get ID.
 
GNodeK getNodeKind () const
 Get node kind.
 
virtual const SVFTypegetType () const
 
virtual void setName (const std::string &nameInfo)
 
virtual void setName (std::string &&nameInfo)
 
virtual const std::string & getName () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
const std::string valueOnlyToString () const
 

Static Protected Member Functions

static bool isICFGNodeKinds (GNodeK n)
 Helper functions to check node kinds.
 
static bool isInterICFGNodeKind (GNodeK n)
 
static bool isSVFVarKind (GNodeK n)
 
static bool isValVarKinds (GNodeK n)
 
static bool isConstantDataValVar (GNodeK n)
 
static bool isObjVarKinds (GNodeK n)
 
static bool isBaseObjVarKinds (GNodeK n)
 
static bool isConstantDataObjVarKinds (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)
 

Protected Attributes

NodeID id
 Node ID.
 
GNodeK nodeKind
 Node kind.
 
const SVFTypetype
 SVF type.
 
std::string name
 
std::string sourceLoc
 Source code information of this value.
 

Detailed Description

Definition at line 43 of file SVFValue.h.

Member Enumeration Documentation

◆ GNodeK

Enumerator
IntraBlock 
GlobalBlock 
FunEntryBlock 
FunExitBlock 
FunCallBlock 
FunRetBlock 
ValNode 
ArgValNode 
FunValNode 
GepValNode 
RetValNode 
VarargValNode 
GlobalValNode 
ConstAggValNode 
ConstDataValNode 
BlackHoleValNode 
ConstFPValNode 
ConstIntValNode 
ConstNullptrValNode 
DummyValNode 
ObjNode 
GepObjNode 
BaseObjNode 
FunObjNode 
HeapObjNode 
StackObjNode 
GlobalObjNode 
ConstAggObjNode 
ConstDataObjNode 
ConstFPObjNode 
ConstIntObjNode 
ConstNullptrObjNode 
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 
BasicBlockKd 
OtherKd 

Definition at line 48 of file SVFValue.h.

49 {
50 // ┌─────────────────────────────────────────────────────────────────────────┐
51 // │ ICFGNode: Classes of inter-procedural and intra-procedural control flow │
52 // │ graph nodes (Parent class: ICFGNode) │
53 // └─────────────────────────────────────────────────────────────────────────┘
54 IntraBlock, // ├── Represents a node within a single procedure
55 GlobalBlock, // ├── Represents a global-level block
56 // │ └─ Subclass: InterICFGNode
57 FunEntryBlock, // │ ├── Entry point of a function
58 FunExitBlock, // │ ├── Exit point of a function
59 FunCallBlock, // │ ├── Call site in the function
60 FunRetBlock, // │ └── Return site in the function
61
62 // ┌─────────────────────────────────────────────────────────────────────────┐
63 // │ SVFVar: Classes of variable nodes (Parent class: SVFVar) │
64 // │ Includes two main subclasses: ValVar and ObjVar │
65 // └─────────────────────────────────────────────────────────────────────────┘
66 // └─ Subclass: ValVar (Top-level variable nodes)
67 ValNode, // ├── Represents a standard value variable
68 ArgValNode, // ├── Represents an argument value variable
69 FunValNode, // ├── Represents a function value variable
70 GepValNode, // ├── Represents a GEP value variable
71 RetValNode, // ├── Represents a return value node
72 VarargValNode, // ├── Represents a variadic argument node
73 GlobalValNode, // ├── Represents a global variable node
74 ConstAggValNode, // ├── Represents a constant aggregate value node
75 // │ └─ Subclass: ConstDataValVar
76 ConstDataValNode, // │ ├── Represents a constant data variable
77 BlackHoleValNode, // │ ├── Represents a black hole node
78 ConstFPValNode, // │ ├── Represents a constant floating-point value node
79 ConstIntValNode, // │ ├── Represents a constant integer value node
80 ConstNullptrValNode, // │ └── Represents a constant nullptr value node
81 // │ └─ Subclass: DummyValVar
82 DummyValNode, // │ └── Dummy node for uninitialized values
83
84 // └─ Subclass: ObjVar (Object variable nodes)
85 ObjNode, // ├── Represents an object variable
86 // │ └─ Subclass: GepObjVar
87 GepObjNode, // │ ├── Represents a GEP object variable
88 // │ └─ Subclass: BaseObjVar
89 BaseObjNode, // │ ├── Represents a base object node
90 FunObjNode, // │ ├── Represents a function object
91 HeapObjNode, // │ ├── Represents a heap object
92 StackObjNode, // │ ├── Represents a stack object
93 GlobalObjNode, // │ ├── Represents a global object
94 ConstAggObjNode, // │ ├── Represents a constant aggregate object
95 // │ └─ Subclass: ConstDataObjVar
96 ConstDataObjNode, // │ ├── Represents a constant data object
97 ConstFPObjNode, // │ ├── Represents a constant floating-point object
98 ConstIntObjNode, // │ ├── Represents a constant integer object
99 ConstNullptrObjNode, // │ └── Represents a constant nullptr object
100 // │ └─ Subclass: DummyObjVar
101 DummyObjNode, // │ └── Dummy node for uninitialized objects
102
103 // ┌─────────────────────────────────────────────────────────────────────────┐
104 // │ VFGNode: Classes of Value Flow Graph (VFG) node kinds (Parent class: │
105 // │ VFGNode) │
106 // │ Includes operation nodes and specialized subclasses │
107 // └─────────────────────────────────────────────────────────────────────────┘
108 Cmp, // ├── Represents a comparison operation
109 BinaryOp, // ├── Represents a binary operation
110 UnaryOp, // ├── Represents a unary operation
111 Branch, // ├── Represents a branch operation
112 DummyVProp, // ├── Dummy node for value propagation
113 NPtr, // ├── Represents a null pointer operation
114 // │ └─ Subclass: ArgumentVFGNode
115 FRet, // │ ├── Represents a function return value
116 ARet, // │ ├── Represents an argument return value
117 AParm, // │ ├── Represents an argument parameter
118 FParm, // │ └── Represents a function parameter
119 // │ └─ Subclass: StmtVFGNode
120 Addr, // │ ├── Represents an address operation
121 Copy, // │ ├── Represents a copy operation
122 Gep, // │ ├── Represents a GEP operation
123 Store, // │ ├── Represents a store operation
124 Load, // │ └── Represents a load operation
125 // │ └─ Subclass: PHIVFGNode
126 TPhi, // │ ├── Represents a type-based PHI node
127 TIntraPhi, // │ ├── Represents an intra-procedural PHI node
128 TInterPhi, // │ └── Represents an inter-procedural PHI node
129 // │ └─ Subclass: MRSVFGNode
130 FPIN, // │ ├── Function parameter input
131 FPOUT, // │ ├── Function parameter output
132 APIN, // │ ├── Argument parameter input
133 APOUT, // │ └── Argument parameter output
134 // │ └─ Subclass: MSSAPHISVFGNode
135 MPhi, // │ ├── Memory PHI node
136 MIntraPhi, // │ ├── Intra-procedural memory PHI node
137 MInterPhi, // │ └── Inter-procedural memory PHI node
138
139 // ┌─────────────────────────────────────────────────────────────────────────┐
140 // │ Additional specific graph node types │
141 // └─────────────────────────────────────────────────────────────────────────┘
142 CallNodeKd, // Callgraph node
143 CDNodeKd, // Control dependence graph node
144 CFLNodeKd, // CFL graph node
145 CHNodeKd, // Class hierarchy graph node
146 ConstraintNodeKd, // Constraint graph node
147 TCTNodeKd, // Thread creation tree node
148 DCHNodeKd, // DCHG node
149 BasicBlockKd, // Basic block node
150 OtherKd // Other node kind
151 };
@ ConstNullptrObjNode
Definition SVFValue.h:99
@ ConstNullptrValNode
Definition SVFValue.h:80

Constructor & Destructor Documentation

◆ SVFValue()

SVF::SVFValue::SVFValue ( NodeID  i,
GNodeK  k,
const SVFType ty = nullptr 
)
inline

Definition at line 154 of file SVFValue.h.

154 : id(i),nodeKind(k), type(ty)
155 {
156
157 }
GNodeK nodeKind
Node kind.
Definition SVFValue.h:206
NodeID id
Node ID.
Definition SVFValue.h:205
const SVFType * type
SVF type.
Definition SVFValue.h:207
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ getId()

NodeID SVF::SVFValue::getId ( ) const
inline

Get ID.

Definition at line 160 of file SVFValue.h.

161 {
162 return id;
163 }

◆ getName()

virtual const std::string & SVF::SVFValue::getName ( ) const
inlinevirtual

Reimplemented in SVF::DCHNode, SVF::CallGraphNode, and SVF::CHNode.

Definition at line 186 of file SVFValue.h.

187 {
188 return name;
189 }
std::string name
Definition SVFValue.h:209

◆ getNodeKind()

GNodeK SVF::SVFValue::getNodeKind ( ) const
inline

Get node kind.

Definition at line 166 of file SVFValue.h.

167 {
168 return nodeKind;
169 }

◆ getSourceLoc()

virtual const std::string SVF::SVFValue::getSourceLoc ( ) const
inlinevirtual

Reimplemented in SVF::GlobalICFGNode, SVF::FunEntryICFGNode, SVF::FunExitICFGNode, SVF::CallICFGNode, and SVF::RetICFGNode.

Definition at line 196 of file SVFValue.h.

197 {
198 return sourceLoc;
199 }
std::string sourceLoc
Source code information of this value.
Definition SVFValue.h:210

◆ getType()

virtual const SVFType * SVF::SVFValue::getType ( ) const
inlinevirtual

Reimplemented in SVF::GepValVar, SVF::BaseObjVar, and SVF::GepObjVar.

Definition at line 171 of file SVFValue.h.

172 {
173 return type;
174 }

◆ isArgumentVFGNodeKinds()

static bool SVF::SVFValue::isArgumentVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 288 of file SVFValue.h.

289 {
290 static_assert(FParm - FRet == 3,
291 "The number of ArgumentVFGNodeKinds has changed, make "
292 "sure the range is correct");
293 return n <= FParm && n >= FRet;
294 }

◆ isBaseObjVarKinds()

static bool SVF::SVFValue::isBaseObjVarKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 264 of file SVFValue.h.

265 {
266 static_assert(DummyObjNode - BaseObjNode == 10,
267 "The number of BaseObjVarKinds has changed, make sure the "
268 "range is correct");
270 }

◆ isConstantDataObjVarKinds()

static bool SVF::SVFValue::isConstantDataObjVarKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 272 of file SVFValue.h.

273 {
274 static_assert(ConstNullptrObjNode - ConstDataObjNode == 3,
275 "The number of ConstantDataObjVarKinds has changed, make "
276 "sure the range is correct");
278 }

◆ isConstantDataValVar()

static bool SVF::SVFValue::isConstantDataValVar ( GNodeK  n)
inlinestaticprotected

Definition at line 248 of file SVFValue.h.

249 {
250 static_assert(ConstNullptrValNode - ConstDataValNode == 4,
251 "The number of ConstantDataValVarKinds has changed, make "
252 "sure the range is correct");
254 }

◆ isICFGNodeKinds()

static bool SVF::SVFValue::isICFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Helper functions to check node kinds.

Definition at line 214 of file SVFValue.h.

215 {
216 static_assert(FunRetBlock - IntraBlock == 5,
217 "the number of ICFGNodeKinds has changed, make sure "
218 "the range is correct");
220 }

◆ isInterICFGNodeKind()

static bool SVF::SVFValue::isInterICFGNodeKind ( GNodeK  n)
inlinestaticprotected

Definition at line 222 of file SVFValue.h.

223 {
224 static_assert(FunRetBlock - FunEntryBlock == 3,
225 "the number of InterICFGNodeKind has changed, make sure "
226 "the range is correct");
228 }

◆ isMRSVFGNodeKinds()

static bool SVF::SVFValue::isMRSVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 312 of file SVFValue.h.

313 {
314 static_assert(MInterPhi - FPIN == 6,
315 "The number of MRSVFGNodeKinds has changed, make sure "
316 "the range is correct");
318 }

◆ isMSSAPHISVFGNodeKinds()

static bool SVF::SVFValue::isMSSAPHISVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 320 of file SVFValue.h.

321 {
322 static_assert(MInterPhi - MPhi == 2,
323 "The number of MSSAPHISVFGNodeKinds has changed, make "
324 "sure the range is correct");
326 }

◆ isObjVarKinds()

static bool SVF::SVFValue::isObjVarKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 256 of file SVFValue.h.

257 {
258 static_assert(DummyObjNode - ObjNode == 12,
259 "The number of ObjVarKinds has changed, make sure the "
260 "range is correct");
262 }

◆ isPHIVFGNodeKinds()

static bool SVF::SVFValue::isPHIVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 304 of file SVFValue.h.

305 {
306 static_assert(TInterPhi - TPhi == 2,
307 "The number of PHIVFGNodeKinds has changed, make sure "
308 "the range is correct");
310 }

◆ isStmtVFGNodeKinds()

static bool SVF::SVFValue::isStmtVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 296 of file SVFValue.h.

297 {
298 static_assert(Load - Addr == 4,
299 "The number of StmtVFGNodeKinds has changed, make sure "
300 "the range is correct");
301 return n <= Load && n >= Addr;
302 }

◆ isSVFVarKind()

static bool SVF::SVFValue::isSVFVarKind ( GNodeK  n)
inlinestaticprotected

Definition at line 230 of file SVFValue.h.

231 {
232 static_assert(DummyObjNode - ValNode == 26,
233 "The number of SVFVarKinds has changed, make sure the "
234 "range is correct");
235
237 }

◆ isValVarKinds()

static bool SVF::SVFValue::isValVarKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 239 of file SVFValue.h.

240 {
241 static_assert(DummyValNode - ValNode == 13,
242 "The number of ValVarKinds has changed, make sure the "
243 "range is correct");
245 }

◆ isVFGNodeKinds()

static bool SVF::SVFValue::isVFGNodeKinds ( GNodeK  n)
inlinestaticprotected

Definition at line 280 of file SVFValue.h.

281 {
282 static_assert(MInterPhi - Cmp == 24,
283 "The number of VFGNodeKinds has changed, make sure the "
284 "range is correct");
286 }

◆ setName() [1/2]

virtual void SVF::SVFValue::setName ( const std::string &  nameInfo)
inlinevirtual

Definition at line 176 of file SVFValue.h.

177 {
178 name = nameInfo;
179 }

◆ setName() [2/2]

virtual void SVF::SVFValue::setName ( std::string &&  nameInfo)
inlinevirtual

Definition at line 181 of file SVFValue.h.

182 {
183 name = std::move(nameInfo);
184 }

◆ setSourceLoc()

virtual void SVF::SVFValue::setSourceLoc ( const std::string &  sourceCodeInfo)
inlinevirtual

Definition at line 191 of file SVFValue.h.

192 {
194 }

◆ valueOnlyToString()

const std::string SVF::SVFValue::valueOnlyToString ( ) const

Definition at line 735 of file LLVMUtil.cpp.

736{
737 std::string str;
738 llvm::raw_string_ostream rawstr(str);
739 assert(
740 !SVFUtil::isa<GepObjVar>(this) && !SVFUtil::isa<GepValVar>(this) &&
741 !SVFUtil::isa<DummyObjVar>(this) &&!SVFUtil::isa<DummyValVar>(this) &&
742 !SVFUtil::isa<BlackHoleValVar>(this) &&
743 "invalid value, refer to their toString method");
744 auto llvmVal =
746 if (llvmVal)
747 rawstr << " " << *llvmVal << " ";
748 else
749 rawstr << "";
750 rawstr << getSourceLoc();
751 return rawstr.str();
752}
static LLVMModuleSet * getLLVMModuleSet()
Definition LLVMModule.h:131
const Value * getLLVMValue(const SVFValue *value) const
Definition LLVMModule.h:260
virtual const std::string getSourceLoc() const
Definition SVFValue.h:196

Member Data Documentation

◆ id

NodeID SVF::SVFValue::id
protected

Node ID.

Definition at line 205 of file SVFValue.h.

◆ name

std::string SVF::SVFValue::name
protected

Definition at line 209 of file SVFValue.h.

◆ nodeKind

GNodeK SVF::SVFValue::nodeKind
protected

Node kind.

Definition at line 206 of file SVFValue.h.

◆ sourceLoc

std::string SVF::SVFValue::sourceLoc
protected

Source code information of this value.

Definition at line 210 of file SVFValue.h.

◆ type

const SVFType* SVF::SVFValue::type
protected

SVF type.

Definition at line 207 of file SVFValue.h.


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