Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jumormt committed Jan 24, 2025
1 parent 7f16104 commit 8c53d81
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 278 deletions.
2 changes: 1 addition & 1 deletion svf-llvm/lib/LLVMUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ const std::string SVFBaseNode::valueOnlyToString() const
{
baseNode = objVar->getBaseObj();
}
if (SVFUtil::isa<DummyObjVar, DummyValVar, BlackHoleVar>(baseNode))
if (SVFUtil::isa<DummyObjVar, DummyValVar, BlackHoleValVar>(baseNode))
rawstr << "";
else
{
Expand Down
2 changes: 1 addition & 1 deletion svf-llvm/lib/SVFIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
{
assert(srcFun==curInst->getFunction() && "SrcNode of the PAGEdge not in the same function?");
}
if(dstFun!=nullptr && !SVFUtil::isa<CallPE>(edge) && !SVFUtil::isa<RetPN>(edge->getDstNode()))
if(dstFun!=nullptr && !SVFUtil::isa<CallPE>(edge) && !SVFUtil::isa<RetValPN>(edge->getDstNode()))
{
assert(dstFun==curInst->getFunction() && "DstNode of the PAGEdge not in the same function?");
}
Expand Down
194 changes: 103 additions & 91 deletions svf/include/Graphs/GenericGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,97 +139,109 @@ class SVFBaseNode

public:

enum GNodeK
{
// ┌── ICFGNode: Classes of inter-procedural and intra-procedural control flow graph nodes
IntraBlock, // ├──Represents a node within a single procedure
GlobalBlock, // ├──Represents a global-level block
// │ └─ InterICFGNode: Classes of inter-procedural control flow graph nodes
FunEntryBlock, // ├──Entry point of a function
FunExitBlock, // ├──Exit point of a function
FunCallBlock, // ├──Call site in the function
FunRetBlock, // ├──Return site in the function
// └────────

// ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar)
// │ └── ValVar: Classes of top-level variable nodes
ValNode, // ├──Represents a standard value variable
ArgNode, // ├──Represents an argument value variable
FunValNode, // ├──Represents a Function value variable
GepValNode, // ├──Represents a GEP value variable
RetNode, // ├──Represents a return value node
VarargNode, // ├──Represents a variadic argument node
GlobalValNode, // ├──Represents a global variable node
ConstantAggValNode, // ├──Represents a constant aggregate value node
ConstantDataValNode, // ├──Represents a constant data variable
BlackHoleNode, // ├──Represents a black hole node
ConstantFPValNode, // ├──Represents a constant float-point value node
ConstantIntValNode, // ├── Represents a constant integer value node
ConstantNullptrValNode, // ├── Represents a constant nullptr value node
DummyValNode, // ├──Represents a dummy node for uninitialized values
// │ └── ObjVar: Classes of object variable nodes
ObjNode, // ├──Represents an object variable
GepObjNode, // ├──Represents a GEP object variable
// │ └── BaseObjVar: Classes of base object nodes
BaseObjNode, // ├──Represents a base object node
FunObjNode, // ├──Types of function object
HeapObjNode, // ├──Types of heap object
StackObjNode, // ├──Types of stack object
GlobalObjNode, // ├──Types of global object
ConstantAggObjNode, // ├──Types of constant aggregate object
ConstantDataObjNode, // ├──Types of constant data object
ConstantFPObjNode, // ├──Types of constant float-point object
ConstantIntObjNode, // ├──Types of constant integer object
ConstantNullptrObjNode, // ├──Types of constant nullptr object
DummyObjNode, // ├──Dummy node for uninitialized objects
// └────────

// ┌── VFGNode: Classes of Value Flow Graph (VFG) node kinds with operations
Cmp, // ├──Represents a comparison operation
BinaryOp, // ├──Represents a binary operation
UnaryOp, // ├──Represents a unary operation
Branch, // ├──Represents a branch operation
DummyVProp, // ├──Dummy node for value propagation
NPtr, // ├──Represents a null pointer operation
// │ └── ArgumentVFGNode: Classes of argument nodes in VFG
FRet, // ├──Represents a function return value
ARet, // ├──Represents an argument return value
AParm, // ├──Represents an argument parameter
FParm, // ├──Represents a function parameter
// │ └── StmtVFGNode: Classes of statement nodes in VFG
Addr, // ├──Represents an address operation
Copy, // ├──Represents a copy operation
Gep, // ├──Represents a GEP operation
Store, // ├──Represents a store operation
Load, // ├──Represents a load operation
// │ └── PHIVFGNode: Classes of PHI nodes in VFG
TPhi, // ├──Represents a type-based PHI node
TIntraPhi, // ├──Represents an intra-procedural PHI node
TInterPhi, // ├──Represents an inter-procedural PHI node
// │ └── MRSVFGNode: Classes of Memory-related SVFG nodes
FPIN, // ├──Function parameter input
FPOUT, // ├──Function parameter output
APIN, // ├──Argument parameter input
APOUT, // ├──Argument parameter output
// │ └── MSSAPHISVFGNode: Classes of Mem SSA PHI nodes for SVFG
MPhi, // ├──Memory PHI node
MIntraPhi, // ├──Intra-procedural memory PHI node
MInterPhi, // ├──Inter-procedural memory PHI node
// └────────

// Additional specific graph node types
CallNodeKd, // Callgraph node
CDNodeKd, // Control dependence graph node
CFLNodeKd, // CFL graph node
CHNodeKd, // Class hierarchy graph node
enum GNodeK {
// ┌─────────────────────────────────────────────────────────────────────────┐
// │ ICFGNode: Classes of inter-procedural and intra-procedural control flow │
// │ graph nodes (Parent class: ICFGNode) │
// └─────────────────────────────────────────────────────────────────────────┘
IntraBlock, // ├── Represents a node within a single procedure
GlobalBlock, // ├── Represents a global-level block
// │ └─ Subclass: InterICFGNode
FunEntryBlock, // │ ├── Entry point of a function
FunExitBlock, // │ ├── Exit point of a function
FunCallBlock, // │ ├── Call site in the function
FunRetBlock, // │ └── Return site in the function

// ┌─────────────────────────────────────────────────────────────────────────┐
// │ SVFVar: Classes of variable nodes (Parent class: SVFVar) │
// │ Includes two main subclasses: ValVar and ObjVar │
// └─────────────────────────────────────────────────────────────────────────┘
// └─ Subclass: ValVar (Top-level variable nodes)
ValNode, // ├── Represents a standard value variable
ArgValNode, // ├── Represents an argument value variable
FunValNode, // ├── Represents a function value variable
GepValNode, // ├── Represents a GEP value variable
RetValNode, // ├── Represents a return value node
VarargValNode, // ├── Represents a variadic argument node
GlobalValNode, // ├── Represents a global variable node
ConstAggValNode, // ├── Represents a constant aggregate value node
// │ └─ Subclass: ConstDataValVar
ConstDataValNode, // │ ├── Represents a constant data variable
BlackHoleValNode, // │ ├── Represents a black hole node
ConstFPValNode, // │ ├── Represents a constant floating-point value node
ConstIntValNode, // │ ├── Represents a constant integer value node
ConstNullptrValNode, // │ └── Represents a constant nullptr value node
// │ └─ Subclass: DummyValVar
DummyValNode, // │ Dummy node for uninitialized values

// └─ Subclass: ObjVar (Object variable nodes)
ObjNode, // ├── Represents an object variable
// │ └─ Subclass: GepObjVar
GepObjNode, // │ ├── Represents a GEP object variable
// │ └─ Subclass: BaseObjVar
BaseObjNode, // │ ├── Represents a base object node
FunObjNode, // │ ├── Represents a function object
HeapObjNode, // │ ├── Represents a heap object
StackObjNode, // │ ├── Represents a stack object
GlobalObjNode, // │ ├── Represents a global object
ConstAggObjNode, // │ ├── Represents a constant aggregate object
ConstDataObjNode, // │ ├── Represents a constant data object
ConstFPObjNode, // │ ├── Represents a constant floating-point object
ConstIntObjNode, // │ ├── Represents a constant integer object
ConstNullptrObjNode, // │ └── Represents a constant nullptr object
// │ └─ Subclass: DummyObjVar
DummyObjNode, // │ Dummy node for uninitialized objects

// ┌─────────────────────────────────────────────────────────────────────────┐
// │ VFGNode: Classes of Value Flow Graph (VFG) node kinds (Parent class: │
// │ VFGNode) │
// │ Includes operation nodes and specialized subclasses │
// └─────────────────────────────────────────────────────────────────────────┘
Cmp, // ├── Represents a comparison operation
BinaryOp, // ├── Represents a binary operation
UnaryOp, // ├── Represents a unary operation
Branch, // ├── Represents a branch operation
DummyVProp, // ├── Dummy node for value propagation
NPtr, // ├── Represents a null pointer operation
// │ └─ Subclass: ArgumentVFGNode
FRet, // │ ├── Represents a function return value
ARet, // │ ├── Represents an argument return value
AParm, // │ ├── Represents an argument parameter
FParm, // │ └── Represents a function parameter
// │ └─ Subclass: StmtVFGNode
Addr, // │ ├── Represents an address operation
Copy, // │ ├── Represents a copy operation
Gep, // │ ├── Represents a GEP operation
Store, // │ ├── Represents a store operation
Load, // │ └── Represents a load operation
// │ └─ Subclass: PHIVFGNode
TPhi, // │ ├── Represents a type-based PHI node
TIntraPhi, // │ ├── Represents an intra-procedural PHI node
TInterPhi, // │ └── Represents an inter-procedural PHI node
// │ └─ Subclass: MRSVFGNode
FPIN, // │ ├── Function parameter input
FPOUT, // │ ├── Function parameter output
APIN, // │ ├── Argument parameter input
APOUT, // │ └── Argument parameter output
// │ └─ Subclass: MSSAPHISVFGNode
MPhi, // │ ├── Memory PHI node
MIntraPhi, // │ ├── Intra-procedural memory PHI node
MInterPhi, // │ └── Inter-procedural memory PHI node

// ┌─────────────────────────────────────────────────────────────────────────┐
// │ Additional specific graph node types │
// └─────────────────────────────────────────────────────────────────────────┘
CallNodeKd, // Callgraph node
CDNodeKd, // Control dependence graph node
CFLNodeKd, // CFL graph node
CHNodeKd, // Class hierarchy graph node
ConstraintNodeKd, // Constraint graph node
TCTNodeKd, // Thread creation tree node
DCHNodeKd, // DCHG node
OtherKd // Other node kind
TCTNodeKd, // Thread creation tree node
DCHNodeKd, // DCHG node
OtherKd // Other node kind
};



SVFBaseNode(NodeID i, GNodeK k, const SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
{

Expand Down Expand Up @@ -326,10 +338,10 @@ class SVFBaseNode

static inline bool isConstantDataValVar(GNodeK n)
{
static_assert(ConstantNullptrValNode - ConstantDataValNode == 4,
static_assert(ConstNullptrValNode - ConstDataValNode == 4,
"The number of ConstantDataValVarKinds has changed, make "
"sure the range is correct");
return n <= ConstantNullptrValNode && n >= ConstantDataValNode;
return n <= ConstNullptrValNode && n >= ConstDataValNode;
}

static inline bool isObjVarKinds(GNodeK n)
Expand All @@ -350,10 +362,10 @@ class SVFBaseNode

static inline bool isConstantDataObjVarKinds(GNodeK n)
{
static_assert(ConstantNullptrObjNode - ConstantDataObjNode == 3,
static_assert(ConstNullptrObjNode - ConstDataObjNode == 3,
"The number of ConstantDataObjVarKinds has changed, make "
"sure the range is correct");
return n <= ConstantNullptrObjNode && n >= ConstantDataObjNode;
return n <= ConstNullptrObjNode && n >= ConstDataObjNode;
}

static inline bool isVFGNodeKinds(GNodeK n)
Expand Down
24 changes: 12 additions & 12 deletions svf/include/SVFIR/SVFIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,20 +566,20 @@ class SVFIR : public IRGraph
inline NodeID addConstantFPValNode(const NodeID i, double dval,
const ICFGNode* icfgNode, const SVFType* type)
{
SVFVar* node = new ConstantFPValVar(i, dval, icfgNode, type);
SVFVar* node = new ConstFPValVar(i, dval, icfgNode, type);
return addNode(node);
}

inline NodeID addConstantIntValNode(NodeID i, const std::pair<s64_t, u64_t>& intValue,
const ICFGNode* icfgNode, const SVFType* type)
{
SVFVar* node = new ConstantIntValVar(i, intValue.first, intValue.second, icfgNode, type);
SVFVar* node = new ConstIntValVar(i, intValue.first, intValue.second, icfgNode, type);
return addNode(node);
}

inline NodeID addConstantNullPtrValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type)
{
SVFVar* node = new ConstantNullPtrValVar(i, icfgNode, type);
SVFVar* node = new ConstNullPtrValVar(i, icfgNode, type);
return addNode(node);
}

Expand All @@ -597,7 +597,7 @@ class SVFIR : public IRGraph

inline NodeID addConstantDataValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type)
{
SVFVar* node = new ConstantDataValVar(i, icfgNode, type);
SVFVar* node = new ConstDataValVar(i, icfgNode, type);
return addNode(node);
}

Expand Down Expand Up @@ -639,24 +639,24 @@ class SVFIR : public IRGraph
inline NodeID addConstantFPObjNode(NodeID i, ObjTypeInfo* ti, double dval, const SVFType* type)
{
memToFieldsMap[i].set(i);
ConstantFPObjVar* conObj = new ConstantFPObjVar(i, dval, ti, type);
ConstFPObjVar* conObj = new ConstFPObjVar(i, dval, ti, type);
return addObjNode(conObj);
}


inline NodeID addConstantIntObjNode(NodeID i, ObjTypeInfo* ti, const std::pair<s64_t, u64_t>& intValue, const SVFType* type)
{
memToFieldsMap[i].set(i);
ConstantIntObjVar* conObj =
new ConstantIntObjVar(i, intValue.first, intValue.second, ti, type);
ConstIntObjVar* conObj =
new ConstIntObjVar(i, intValue.first, intValue.second, ti, type);
return addObjNode(conObj);
}


inline NodeID addConstantNullPtrObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type)
{
memToFieldsMap[i].set(i);
ConstantNullPtrObjVar* conObj = new ConstantNullPtrObjVar(i, ti, type);
ConstNullPtrObjVar* conObj = new ConstNullPtrObjVar(i, ti, type);
return addObjNode(conObj);
}

Expand All @@ -669,26 +669,26 @@ class SVFIR : public IRGraph
inline NodeID addConstantAggObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type)
{
memToFieldsMap[i].set(i);
ConstantAggObjVar* conObj = new ConstantAggObjVar(i, ti, type);
ConstAggObjVar* conObj = new ConstAggObjVar(i, ti, type);
return addObjNode(conObj);
}
inline NodeID addConstantDataObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type)
{
memToFieldsMap[i].set(i);
ConstantDataObjVar* conObj = new ConstantDataObjVar(i, ti, type);
ConstDataObjVar* conObj = new ConstDataObjVar(i, ti, type);
return addObjNode(conObj);
}

/// Add a unique return node for a procedure
inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode, const SVFType* type)
{
SVFVar *node = new RetPN(i, callGraphNode, type);
SVFVar *node = new RetValPN(i, callGraphNode, type);
return addRetNode(callGraphNode, node);
}
/// Add a unique vararg node for a procedure
inline NodeID addVarargNode(NodeID i, const CallGraphNode* val, const SVFType* type)
{
SVFVar *node = new VarArgPN(i, val, type);
SVFVar *node = new VarArgValPN(i, val, type);
return addNode(node);
}

Expand Down
Loading

0 comments on commit 8c53d81

Please sign in to comment.