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 ,
  IntrinsicValNode , BasicBlockValNode , AsmPCValNode , 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
 
const bool hasLLVMValue () 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 
IntrinsicValNode 
BasicBlockValNode 
AsmPCValNode 
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 IntrinsicValNode, // │ └── LLVM intrinsic call instruction (e.g. llvm.dbg.declare)
84 BasicBlockValNode, // │ └── LLVM BasicBlock (label operand of br/switch)
85 AsmPCValNode, // │ └── InlineAsm, DSOLocalEquivalent, NoCFIValue
86
87 // └─ Subclass: ObjVar (Object variable nodes)
88 ObjNode, // ├── Represents an object variable
89 // │ └─ Subclass: GepObjVar
90 GepObjNode, // │ ├── Represents a GEP object variable
91 // │ └─ Subclass: BaseObjVar
92 BaseObjNode, // │ ├── Represents a base object node
93 FunObjNode, // │ ├── Represents a function object
94 HeapObjNode, // │ ├── Represents a heap object
95 StackObjNode, // │ ├── Represents a stack object
96 GlobalObjNode, // │ ├── Represents a global object
97 ConstAggObjNode, // │ ├── Represents a constant aggregate object
98 // │ └─ Subclass: ConstDataObjVar
99 ConstDataObjNode, // │ ├── Represents a constant data object
100 ConstFPObjNode, // │ ├── Represents a constant floating-point object
101 ConstIntObjNode, // │ ├── Represents a constant integer object
102 ConstNullptrObjNode, // │ └── Represents a constant nullptr object
103 // │ └─ Subclass: DummyObjVar
104 DummyObjNode, // │ └── Dummy node for uninitialized objects
105
106 // ┌─────────────────────────────────────────────────────────────────────────┐
107 // │ VFGNode: Classes of Value Flow Graph (VFG) node kinds (Parent class: │
108 // │ VFGNode) │
109 // │ Includes operation nodes and specialized subclasses │
110 // └─────────────────────────────────────────────────────────────────────────┘
111 Cmp, // ├── Represents a comparison operation
112 BinaryOp, // ├── Represents a binary operation
113 UnaryOp, // ├── Represents a unary operation
114 Branch, // ├── Represents a branch operation
115 DummyVProp, // ├── Dummy node for value propagation
116 NPtr, // ├── Represents a null pointer operation
117 // │ └─ Subclass: ArgumentVFGNode
118 FRet, // │ ├── Represents a function return value
119 ARet, // │ ├── Represents an argument return value
120 AParm, // │ ├── Represents an argument parameter
121 FParm, // │ └── Represents a function parameter
122 // │ └─ Subclass: StmtVFGNode
123 Addr, // │ ├── Represents an address operation
124 Copy, // │ ├── Represents a copy operation
125 Gep, // │ ├── Represents a GEP operation
126 Store, // │ ├── Represents a store operation
127 Load, // │ └── Represents a load operation
128 // │ └─ Subclass: PHIVFGNode
129 TPhi, // │ ├── Represents a type-based PHI node
130 TIntraPhi, // │ ├── Represents an intra-procedural PHI node
131 TInterPhi, // │ └── Represents an inter-procedural PHI node
132 // │ └─ Subclass: MRSVFGNode
133 FPIN, // │ ├── Function parameter input
134 FPOUT, // │ ├── Function parameter output
135 APIN, // │ ├── Argument parameter input
136 APOUT, // │ └── Argument parameter output
137 // │ └─ Subclass: MSSAPHISVFGNode
138 MPhi, // │ ├── Memory PHI node
139 MIntraPhi, // │ ├── Intra-procedural memory PHI node
140 MInterPhi, // │ └── Inter-procedural memory PHI node
141
142 // ┌─────────────────────────────────────────────────────────────────────────┐
143 // │ Additional specific graph node types │
144 // └─────────────────────────────────────────────────────────────────────────┘
145 CallNodeKd, // Callgraph node
146 CDNodeKd, // Control dependence graph node
147 CFLNodeKd, // CFL graph node
148 CHNodeKd, // Class hierarchy graph node
149 ConstraintNodeKd, // Constraint graph node
150 TCTNodeKd, // Thread creation tree node
151 DCHNodeKd, // DCHG node
152 BasicBlockKd, // Basic block node
153 OtherKd // Other node kind
154 };
@ ConstNullptrObjNode
Definition SVFValue.h:102
@ BasicBlockValNode
Definition SVFValue.h:84
@ ConstNullptrValNode
Definition SVFValue.h:80

Constructor & Destructor Documentation

◆ SVFValue()

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

Definition at line 157 of file SVFValue.h.

157 : id(i),nodeKind(k), type(ty)
158 {
159
160 }
GNodeK nodeKind
Node kind.
Definition SVFValue.h:210
NodeID id
Node ID.
Definition SVFValue.h:209
const SVFType * type
SVF type.
Definition SVFValue.h:211
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

Member Function Documentation

◆ getId()

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

Get ID.

Definition at line 163 of file SVFValue.h.

164 {
165 return id;
166 }

◆ getName()

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

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

Definition at line 189 of file SVFValue.h.

190 {
191 return name;
192 }
std::string name
Definition SVFValue.h:213

◆ getNodeKind()

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

Get node kind.

Definition at line 169 of file SVFValue.h.

170 {
171 return nodeKind;
172 }

◆ 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 199 of file SVFValue.h.

200 {
201 return sourceLoc;
202 }
std::string sourceLoc
Source code information of this value.
Definition SVFValue.h:214

◆ getType()

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

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

Definition at line 174 of file SVFValue.h.

175 {
176 return type;
177 }

◆ hasLLVMValue()

const bool SVF::SVFValue::hasLLVMValue ( ) const

Definition at line 758 of file LLVMUtil.cpp.

759{
761
762}
static LLVMModuleSet * getLLVMModuleSet()
Definition LLVMModule.h:131
bool hasLLVMValue(const SVFValue *value) const
Definition LLVMModule.h:255

◆ isArgumentVFGNodeKinds()

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

Definition at line 292 of file SVFValue.h.

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

◆ isBaseObjVarKinds()

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

Definition at line 268 of file SVFValue.h.

269 {
270 static_assert(DummyObjNode - BaseObjNode == 10,
271 "The number of BaseObjVarKinds has changed, make sure the "
272 "range is correct");
274 }

◆ isConstantDataObjVarKinds()

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

Definition at line 276 of file SVFValue.h.

277 {
278 static_assert(ConstNullptrObjNode - ConstDataObjNode == 3,
279 "The number of ConstantDataObjVarKinds has changed, make "
280 "sure the range is correct");
282 }

◆ isConstantDataValVar()

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

Definition at line 252 of file SVFValue.h.

253 {
254 static_assert(ConstNullptrValNode - ConstDataValNode == 4,
255 "The number of ConstantDataValVarKinds has changed, make "
256 "sure the range is correct");
258 }

◆ isICFGNodeKinds()

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

Helper functions to check node kinds.

Definition at line 218 of file SVFValue.h.

219 {
220 static_assert(FunRetBlock - IntraBlock == 5,
221 "the number of ICFGNodeKinds has changed, make sure "
222 "the range is correct");
224 }

◆ isInterICFGNodeKind()

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

Definition at line 226 of file SVFValue.h.

227 {
228 static_assert(FunRetBlock - FunEntryBlock == 3,
229 "the number of InterICFGNodeKind has changed, make sure "
230 "the range is correct");
232 }

◆ isMRSVFGNodeKinds()

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

Definition at line 316 of file SVFValue.h.

317 {
318 static_assert(MInterPhi - FPIN == 6,
319 "The number of MRSVFGNodeKinds has changed, make sure "
320 "the range is correct");
322 }

◆ isMSSAPHISVFGNodeKinds()

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

Definition at line 324 of file SVFValue.h.

325 {
326 static_assert(MInterPhi - MPhi == 2,
327 "The number of MSSAPHISVFGNodeKinds has changed, make "
328 "sure the range is correct");
330 }

◆ isObjVarKinds()

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

Definition at line 260 of file SVFValue.h.

261 {
262 static_assert(DummyObjNode - ObjNode == 12,
263 "The number of ObjVarKinds has changed, make sure the "
264 "range is correct");
266 }

◆ isPHIVFGNodeKinds()

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

Definition at line 308 of file SVFValue.h.

309 {
310 static_assert(TInterPhi - TPhi == 2,
311 "The number of PHIVFGNodeKinds has changed, make sure "
312 "the range is correct");
314 }

◆ isStmtVFGNodeKinds()

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

Definition at line 300 of file SVFValue.h.

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

◆ isSVFVarKind()

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

Definition at line 234 of file SVFValue.h.

235 {
236 static_assert(DummyObjNode - ValNode == 29,
237 "The number of SVFVarKinds has changed, make sure the "
238 "range is correct");
239
241 }

◆ isValVarKinds()

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

Definition at line 243 of file SVFValue.h.

244 {
245 static_assert(AsmPCValNode - ValNode == 16,
246 "The number of ValVarKinds has changed, make sure the "
247 "range is correct");
249 }

◆ isVFGNodeKinds()

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

Definition at line 284 of file SVFValue.h.

285 {
286 static_assert(MInterPhi - Cmp == 24,
287 "The number of VFGNodeKinds has changed, make sure the "
288 "range is correct");
290 }

◆ setName() [1/2]

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

Definition at line 179 of file SVFValue.h.

180 {
181 name = nameInfo;
182 }

◆ setName() [2/2]

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

Definition at line 184 of file SVFValue.h.

185 {
186 name = std::move(nameInfo);
187 }

◆ setSourceLoc()

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

Definition at line 194 of file SVFValue.h.

195 {
197 }

◆ valueOnlyToString()

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

Definition at line 739 of file LLVMUtil.cpp.

740{
741 std::string str;
742 llvm::raw_string_ostream rawstr(str);
743 assert(
744 !SVFUtil::isa<GepObjVar>(this) && !SVFUtil::isa<GepValVar>(this) &&
745 !SVFUtil::isa<DummyObjVar>(this) &&!SVFUtil::isa<DummyValVar>(this) &&
746 !SVFUtil::isa<BlackHoleValVar>(this) &&
747 "invalid value, refer to their toString method");
748 auto llvmVal =
750 if (llvmVal)
751 rawstr << " " << *llvmVal << " ";
752 else
753 rawstr << "";
754 rawstr << getSourceLoc();
755 return rawstr.str();
756}
const Value * getLLVMValue(const SVFValue *value) const
Definition LLVMModule.h:260
virtual const std::string getSourceLoc() const
Definition SVFValue.h:199

Member Data Documentation

◆ id

NodeID SVF::SVFValue::id
protected

Node ID.

Definition at line 209 of file SVFValue.h.

◆ name

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

Definition at line 213 of file SVFValue.h.

◆ nodeKind

GNodeK SVF::SVFValue::nodeKind
protected

Node kind.

Definition at line 210 of file SVFValue.h.

◆ sourceLoc

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

Source code information of this value.

Definition at line 214 of file SVFValue.h.

◆ type

const SVFType* SVF::SVFValue::type
protected

SVF type.

Definition at line 211 of file SVFValue.h.


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