Skip to content

Commit

Permalink
Update svflib
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Jan 24, 2025
1 parent 6bbcd7b commit ada6486
Show file tree
Hide file tree
Showing 14 changed files with 447 additions and 448 deletions.
Binary file modified SVF-osx/Release-build/bin/ae
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/cfl
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/dvf
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/llvm2svf
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/mta
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/saber
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/svf-ex
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/wpa
Binary file not shown.
196 changes: 105 additions & 91 deletions SVF-osx/Release-build/include/Graphs/GenericGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,96 +141,110 @@ class SVFBaseNode

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
// ┌─────────────────────────────────────────────────────────────────────────┐
// │ 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
// │ └─ Subclass: ConstDataObjVar
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, SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
SVFBaseNode(NodeID i, GNodeK k, const SVFType* ty = nullptr): id(i),nodeKind(k), type(ty)
{

}
Expand Down Expand Up @@ -326,10 +340,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 +364,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 Expand Up @@ -433,7 +447,7 @@ class GenericNode: public SVFBaseNode

public:
/// Constructor
GenericNode(NodeID i, GNodeK k): SVFBaseNode(i, k)
GenericNode(NodeID i, GNodeK k, const SVFType* svfType = nullptr): SVFBaseNode(i, k, svfType)
{

}
Expand Down
2 changes: 1 addition & 1 deletion SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class SVFIRBuilder: public llvm::InstVisitor<SVFIRBuilder>
{
LLVMContext& cxt = llvmModuleSet()->getContext();
ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt));
NodeID nullPtr = pag->addConstantNullPtrValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr);
NodeID nullPtr = pag->addConstantNullPtrValNode(pag->getNullPtr(), nullptr, llvmModuleSet()->getSVFType(constNull->getType()));
llvmModuleSet()->addToSVFVar2LLVMValueMap(constNull, pag->getGNode(pag->getNullPtr()));
setCurrentLocation(constNull, nullptr);
addBlackHoleAddrEdge(pag->getBlkPtr());
Expand Down
Loading

0 comments on commit ada6486

Please sign in to comment.