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

#include <GenericGraph.h>

Inheritance diagram for SVF::SVFBaseNode:
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::PTACallGraphNode SVF::SVFVar SVF::TCTNode SVF::VFGNode

Public Types

enum  GNodeK {
  IntraBlock , GlobalBlock , FunEntryBlock , FunExitBlock ,
  FunCallBlock , FunRetBlock , ValNode , FunValNode ,
  GepValNode , RetNode , VarargNode , DummyValNode ,
  ObjNode , GepObjNode , BaseObjNode , FunObjNode ,
  HeapObjNode , StackObjNode , 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

 SVFBaseNode (NodeID i, GNodeK k, SVFType *ty=nullptr)
 
NodeID getId () const
 Get ID.
 
GNodeK getNodeKind () const
 Get node kind.
 
virtual const SVFTypegetType () 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 isObjVarKinds (GNodeK n)
 
static bool isBaseObjVarKinds (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 sourceLoc
 Source code information of this value.
 

Detailed Description

Definition at line 137 of file GenericGraph.h.

Member Enumeration Documentation

◆ GNodeK

Enumerator
IntraBlock 
GlobalBlock 
FunEntryBlock 
FunExitBlock 
FunCallBlock 
FunRetBlock 
ValNode 
FunValNode 
GepValNode 
RetNode 
VarargNode 
DummyValNode 
ObjNode 
GepObjNode 
BaseObjNode 
FunObjNode 
HeapObjNode 
StackObjNode 
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 

Definition at line 142 of file GenericGraph.h.

143 {
144 // ┌── ICFGNode: Classes of inter-procedural and intra-procedural control flow graph nodes
145 IntraBlock, // ├──Represents a node within a single procedure
146 GlobalBlock, // ├──Represents a global-level block
147 // │ └─ InterICFGNode: Classes of inter-procedural control flow graph nodes
148 FunEntryBlock, // ├──Entry point of a function
149 FunExitBlock, // ├──Exit point of a function
150 FunCallBlock, // ├──Call site in the function
151 FunRetBlock, // ├──Return site in the function
152 // └────────
153
154 // ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
155 // │ └── ValVar: Classes of top-level variable nodes
156 ValNode, // ├──Represents a standard value variable
157 FunValNode, // ├──Represents a Function value variable
158 GepValNode, // ├──Represents a GEP value variable
159 RetNode, // ├──Represents a return value node
160 VarargNode, // ├──Represents a variadic argument node
161 DummyValNode, // ├──Dummy node for uninitialized values
162 // │ └── ObjVar: Classes of object variable nodes
163 ObjNode, // ├──Represents an object variable
164 GepObjNode, // ├──Represents a GEP object variable
165 // │ └── BaseObjVar: Classes of base object nodes
166 BaseObjNode, // ├──Represents a base object node
167 FunObjNode, // ├──Types of function object
168 HeapObjNode, // ├──Types of heap object
169 StackObjNode, // ├──Types of stack object
170 DummyObjNode, // ├──Dummy node for uninitialized objects
171 // └────────
172
173 // ┌── VFGNode: Classes of Value Flow Graph (VFG) node kinds with operations
174 Cmp, // ├──Represents a comparison operation
175 BinaryOp, // ├──Represents a binary operation
176 UnaryOp, // ├──Represents a unary operation
177 Branch, // ├──Represents a branch operation
178 DummyVProp, // ├──Dummy node for value propagation
179 NPtr, // ├──Represents a null pointer operation
180 // │ └── ArgumentVFGNode: Classes of argument nodes in VFG
181 FRet, // ├──Represents a function return value
182 ARet, // ├──Represents an argument return value
183 AParm, // ├──Represents an argument parameter
184 FParm, // ├──Represents a function parameter
185 // │ └── StmtVFGNode: Classes of statement nodes in VFG
186 Addr, // ├──Represents an address operation
187 Copy, // ├──Represents a copy operation
188 Gep, // ├──Represents a GEP operation
189 Store, // ├──Represents a store operation
190 Load, // ├──Represents a load operation
191 // │ └── PHIVFGNode: Classes of PHI nodes in VFG
192 TPhi, // ├──Represents a type-based PHI node
193 TIntraPhi, // ├──Represents an intra-procedural PHI node
194 TInterPhi, // ├──Represents an inter-procedural PHI node
195 // │ └── MRSVFGNode: Classes of Memory-related SVFG nodes
196 FPIN, // ├──Function parameter input
197 FPOUT, // ├──Function parameter output
198 APIN, // ├──Argument parameter input
199 APOUT, // ├──Argument parameter output
200 // │ └── MSSAPHISVFGNode: Classes of Mem SSA PHI nodes for SVFG
201 MPhi, // ├──Memory PHI node
202 MIntraPhi, // ├──Intra-procedural memory PHI node
203 MInterPhi, // ├──Inter-procedural memory PHI node
204 // └────────
205
206 // Additional specific graph node types
207 CallNodeKd, // Callgraph node
208 CDNodeKd, // Control dependence graph node
209 CFLNodeKd, // CFL graph node
210 CHNodeKd, // Class hierarchy graph node
211 ConstraintNodeKd, // Constraint graph node
212 TCTNodeKd, // Thread creation tree node
213 DCHNodeKd, // DCHG node
214 OtherKd // Other node kind
215 };

Constructor & Destructor Documentation

◆ SVFBaseNode()

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

Definition at line 219 of file GenericGraph.h.

219 : id(i),nodeKind(k), type(ty)
220 {
221
222 }
NodeID id
Node ID.
const SVFType * type
SVF type.
GNodeK nodeKind
Node kind.
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ getId()

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

Get ID.

Definition at line 225 of file GenericGraph.h.

226 {
227 return id;
228 }

◆ getNodeKind()

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

Get node kind.

Definition at line 231 of file GenericGraph.h.

232 {
233 return nodeKind;
234 }

◆ getSourceLoc()

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

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

Definition at line 246 of file GenericGraph.h.

247 {
248 return sourceLoc;
249 }
std::string sourceLoc
Source code information of this value.

◆ getType()

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

Reimplemented in SVF::SVFVar, SVF::ObjVar, SVF::GepValVar, and SVF::GepObjVar.

Definition at line 236 of file GenericGraph.h.

237 {
238 return type;
239 }

◆ isArgumentVFGNodeKinds()

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

Definition at line 320 of file GenericGraph.h.

321 {
322 static_assert(FParm - FRet == 3,
323 "The number of ArgumentVFGNodeKinds has changed, make "
324 "sure the range is correct");
325 return n <= FParm && n >= FRet;
326 }

◆ isBaseObjVarKinds()

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

Definition at line 304 of file GenericGraph.h.

305 {
306 static_assert(DummyObjNode - BaseObjNode == 4,
307 "The number of BaseObjVarKinds has changed, make sure the "
308 "range is correct");
310 }

◆ isICFGNodeKinds()

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

Helper functions to check node kinds.

Definition at line 263 of file GenericGraph.h.

264 {
265 static_assert(FunRetBlock - IntraBlock == 5,
266 "the number of ICFGNodeKinds has changed, make sure "
267 "the range is correct");
269 }

◆ isInterICFGNodeKind()

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

Definition at line 271 of file GenericGraph.h.

272 {
273 static_assert(FunRetBlock - FunEntryBlock == 3,
274 "the number of InterICFGNodeKind has changed, make sure "
275 "the range is correct");
277 }

◆ isMRSVFGNodeKinds()

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

Definition at line 344 of file GenericGraph.h.

345 {
346 static_assert(MInterPhi - FPIN == 6,
347 "The number of MRSVFGNodeKinds has changed, make sure "
348 "the range is correct");
350 }

◆ isMSSAPHISVFGNodeKinds()

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

Definition at line 352 of file GenericGraph.h.

353 {
354 static_assert(MInterPhi - MPhi == 2,
355 "The number of MSSAPHISVFGNodeKinds has changed, make "
356 "sure the range is correct");
358 }

◆ isObjVarKinds()

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

Definition at line 296 of file GenericGraph.h.

297 {
298 static_assert(DummyObjNode - ObjNode == 6,
299 "The number of ObjVarKinds has changed, make sure the "
300 "range is correct");
302 }

◆ isPHIVFGNodeKinds()

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

Definition at line 336 of file GenericGraph.h.

337 {
338 static_assert(TInterPhi - TPhi == 2,
339 "The number of PHIVFGNodeKinds has changed, make sure "
340 "the range is correct");
342 }

◆ isStmtVFGNodeKinds()

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

Definition at line 328 of file GenericGraph.h.

329 {
330 static_assert(Load - Addr == 4,
331 "The number of StmtVFGNodeKinds has changed, make sure "
332 "the range is correct");
333 return n <= Load && n >= Addr;
334 }

◆ isSVFVarKind()

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

Definition at line 279 of file GenericGraph.h.

280 {
281 static_assert(DummyObjNode - ValNode == 12,
282 "The number of SVFVarKinds has changed, make sure the "
283 "range is correct");
284
286 }

◆ isValVarKinds()

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

Definition at line 288 of file GenericGraph.h.

289 {
290 static_assert(DummyValNode - ValNode == 5,
291 "The number of ValVarKinds has changed, make sure the "
292 "range is correct");
294 }

◆ isVFGNodeKinds()

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

Definition at line 312 of file GenericGraph.h.

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

◆ setSourceLoc()

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

Definition at line 241 of file GenericGraph.h.

242 {
244 }

◆ valueOnlyToString()

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

Definition at line 746 of file LLVMUtil.cpp.

747{
748 std::string str;
749 llvm::raw_string_ostream rawstr(str);
750 if (const SVF::PTACallGraphNode* fun = SVFUtil::dyn_cast<PTACallGraphNode>(this))
751 {
752 rawstr << "Function: " << fun->getFunction()->getName() << " ";
753 }
754 else
755 {
757 if (llvmVal)
758 rawstr << " " << *llvmVal << " ";
759 else
760 rawstr << " No llvmVal found";
761 }
762 rawstr << getSourceLoc();
763 return rawstr.str();
764}
static LLVMModuleSet * getLLVMModuleSet()
Definition LLVMModule.h:122
const Value * getLLVMValue(const SVFValue *value) const
Definition LLVMModule.h:239
virtual const std::string getSourceLoc() const

Member Data Documentation

◆ id

NodeID SVF::SVFBaseNode::id
protected

Node ID.

Definition at line 255 of file GenericGraph.h.

◆ nodeKind

GNodeK SVF::SVFBaseNode::nodeKind
protected

Node kind.

Definition at line 256 of file GenericGraph.h.

◆ sourceLoc

std::string SVF::SVFBaseNode::sourceLoc
protected

Source code information of this value.

Definition at line 259 of file GenericGraph.h.

◆ type

const SVFType* SVF::SVFBaseNode::type
protected

SVF type.

Definition at line 257 of file GenericGraph.h.


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