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< CFLNode, CFLEdge > SVF::GenericNode< ConstraintNode, ConstraintEdge > SVF::GenericNode< NodeTy, EdgeTy > 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 , ConstDataValNode , BlackHoleValNode , ConstFPValNode ,
  ConstIntValNode , ConstNullptrValNode , DummyValNode , IntrinsicValNode ,
  AsmPCValNode , ObjNode , GepObjNode , BaseObjNode ,
  FunObjNode , HeapObjNode , StackObjNode , GlobalObjNode ,
  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 ,
  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 42 of file SVFValue.h.

Member Enumeration Documentation

◆ GNodeK

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

Definition at line 47 of file SVFValue.h.

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

Constructor & Destructor Documentation

◆ SVFValue()

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

Definition at line 152 of file SVFValue.h.

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

Member Function Documentation

◆ getId()

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

Get ID.

Definition at line 158 of file SVFValue.h.

159 {
160 return id;
161 }

◆ getName()

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

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

Definition at line 184 of file SVFValue.h.

185 {
186 return name;
187 }
std::string name
Definition SVFValue.h:208

◆ getNodeKind()

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

Get node kind.

Definition at line 164 of file SVFValue.h.

165 {
166 return nodeKind;
167 }

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

195 {
196 return sourceLoc;
197 }
std::string sourceLoc
Source code information of this value.
Definition SVFValue.h:209

◆ getType()

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

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

Definition at line 169 of file SVFValue.h.

170 {
171 return type;
172 }

◆ hasLLVMValue()

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

Definition at line 760 of file LLVMUtil.cpp.

761{
763
764}
static LLVMModuleSet * getLLVMModuleSet()
Definition LLVMModule.h:133
bool hasLLVMValue(const SVFValue *value) const
Definition LLVMModule.h:258

◆ isArgumentVFGNodeKinds()

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

Definition at line 287 of file SVFValue.h.

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

◆ isBaseObjVarKinds()

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

Definition at line 263 of file SVFValue.h.

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

◆ isConstantDataObjVarKinds()

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

Definition at line 271 of file SVFValue.h.

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

◆ isConstantDataValVar()

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

Definition at line 247 of file SVFValue.h.

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

◆ isICFGNodeKinds()

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

Helper functions to check node kinds.

Definition at line 213 of file SVFValue.h.

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

◆ isInterICFGNodeKind()

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

Definition at line 221 of file SVFValue.h.

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

◆ isMRSVFGNodeKinds()

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

Definition at line 311 of file SVFValue.h.

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

◆ isMSSAPHISVFGNodeKinds()

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

Definition at line 319 of file SVFValue.h.

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

◆ isObjVarKinds()

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

Definition at line 255 of file SVFValue.h.

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

◆ isPHIVFGNodeKinds()

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

Definition at line 303 of file SVFValue.h.

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

◆ isStmtVFGNodeKinds()

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

Definition at line 295 of file SVFValue.h.

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

◆ isSVFVarKind()

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

Definition at line 229 of file SVFValue.h.

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

◆ isValVarKinds()

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

Definition at line 238 of file SVFValue.h.

239 {
240 static_assert(AsmPCValNode - ValNode == 14,
241 "The number of ValVarKinds has changed, make sure the "
242 "range is correct");
244 }

◆ isVFGNodeKinds()

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

Definition at line 279 of file SVFValue.h.

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

◆ setName() [1/2]

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

Definition at line 174 of file SVFValue.h.

175 {
176 name = nameInfo;
177 }

◆ setName() [2/2]

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

Definition at line 179 of file SVFValue.h.

180 {
181 name = std::move(nameInfo);
182 }

◆ setSourceLoc()

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

Definition at line 189 of file SVFValue.h.

190 {
192 }

◆ valueOnlyToString()

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

Definition at line 741 of file LLVMUtil.cpp.

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

Member Data Documentation

◆ id

NodeID SVF::SVFValue::id
protected

Node ID.

Definition at line 204 of file SVFValue.h.

◆ name

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

Definition at line 208 of file SVFValue.h.

◆ nodeKind

GNodeK SVF::SVFValue::nodeKind
protected

Node kind.

Definition at line 205 of file SVFValue.h.

◆ sourceLoc

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

Source code information of this value.

Definition at line 209 of file SVFValue.h.

◆ type

const SVFType* SVF::SVFValue::type
protected

SVF type.

Definition at line 206 of file SVFValue.h.


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