Skip to content

Commit

Permalink
Update svflib
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Aug 23, 2024
1 parent 45c8503 commit 522ebeb
Show file tree
Hide file tree
Showing 27 changed files with 124 additions and 124 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/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.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class AbstractInterpretation

public:
enum ExtAPIType { UNCLASSIFIED, MEMCPY, MEMSET, STRCPY, STRCAT };
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
typedef SCCDetection<CallGraph*> CallGraphSCC;
/// Constructor
AbstractInterpretation();

Expand Down
4 changes: 2 additions & 2 deletions SVF-osx/Release-build/include/DDA/ContextDDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ class ContextDDA : public CondPTAImpl<ContextCond>, public DDAVFSolver<CxtVar,Cx
/// Whether call/return inside recursion
inline virtual bool isEdgeInRecursion(CallSiteID csId)
{
const SVFFunction* caller = getPTACallGraph()->getCallerOfCallSite(csId);
const SVFFunction* callee = getPTACallGraph()->getCalleeOfCallSite(csId);
const SVFFunction* caller = getCallGraph()->getCallerOfCallSite(csId);
const SVFFunction* callee = getCallGraph()->getCalleeOfCallSite(csId);
return inSameCallGraphSCC(caller, callee);
}
/// Update call graph.
Expand Down
10 changes: 5 additions & 5 deletions SVF-osx/Release-build/include/DDA/DDAVFSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class DDAVFSolver
friend class DDAStat;
public:
typedef SCCDetection<SVFG*> SVFGSCC;
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
typedef PTACallGraphEdge::CallInstSet CallInstSet;
typedef SCCDetection<CallGraph*> CallGraphSCC;
typedef CallGraphEdge::CallInstSet CallInstSet;
typedef SVFIR::CallSiteSet CallSiteSet;
typedef OrderedSet<DPIm> DPTItemSet;
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
Expand Down Expand Up @@ -505,7 +505,7 @@ class DDAVFSolver
{
CallInstSet csSet;
/// use pre-analysis call graph to approximate all potential callsites
_ander->getPTACallGraph()->getIndCallSitesInvokingCallee(fun,csSet);
_ander->getCallGraph()->getIndCallSitesInvokingCallee(fun,csSet);
for(CallInstSet::const_iterator it = csSet.begin(), eit = csSet.end(); it!=eit; ++it)
{
NodeID funPtr = _pag->getFunPtr(*it);
Expand Down Expand Up @@ -624,7 +624,7 @@ class DDAVFSolver
return (getSVFGSCCRepNode(edge->getSrcID()) == getSVFGSCCRepNode(edge->getDstID()));
}
/// Set callgraph
inline void setCallGraph (PTACallGraph* cg)
inline void setCallGraph (CallGraph* cg)
{
_callGraph = cg;
}
Expand Down Expand Up @@ -775,7 +775,7 @@ class DDAVFSolver
SVFG* _svfg; ///< SVFG
AndersenWaveDiff* _ander; ///< Andersen's analysis
NodeBS candidateQueries; ///< candidate pointers;
PTACallGraph* _callGraph; ///< CallGraph
CallGraph* _callGraph; ///< CallGraph
CallGraphSCC* _callGraphSCC; ///< SCC for CallGraph
SVFGSCC* _svfgSCC; ///< SCC for SVFG
DPTItemSet backwardVisited; ///< visited map during backward traversing
Expand Down
2 changes: 1 addition & 1 deletion SVF-osx/Release-build/include/DDA/FlowDDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FlowDDA : public BVDataPTAImpl, public DDAVFSolver<NodeID,PointsTo,LocDPIt
{
BVDataPTAImpl::initialize();
buildSVFG(pag);
setCallGraph(getPTACallGraph());
setCallGraph(getCallGraph());
setCallGraphSCC(getCallGraphSCC());
stat = setDDAStat(new DDAStat(this));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- PTACallGraph.h -- Call graph representation----------------------------//
//===- CallGraph.h -- Call graph representation----------------------------//
//
// SVF: Static Value-Flow Analysis
//
Expand All @@ -21,14 +21,14 @@
//===----------------------------------------------------------------------===//

/*
* PTACallGraph.h
* CallGraph.h
*
* Created on: Nov 7, 2013
* Author: Yulei Sui
*/

#ifndef PTACALLGRAPH_H_
#define PTACALLGRAPH_H_
#ifndef CALLGRAPH_H_
#define CALLGRAPH_H_

#include "Graphs/GenericGraph.h"
#include "SVFIR/SVFValue.h"
Expand All @@ -38,7 +38,7 @@
namespace SVF
{

class PTACallGraphNode;
class CallGraphNode;
class SVFModule;


Expand All @@ -47,8 +47,8 @@ class SVFModule;
* Multiple calls from function A to B are merged into one call edge
* Each call edge has a set of direct callsites and a set of indirect callsites
*/
typedef GenericEdge<PTACallGraphNode> GenericCallGraphEdgeTy;
class PTACallGraphEdge : public GenericCallGraphEdgeTy
typedef GenericEdge<CallGraphNode> GenericCallGraphEdgeTy;
class CallGraphEdge : public GenericCallGraphEdgeTy
{

public:
Expand All @@ -65,12 +65,12 @@ class PTACallGraphEdge : public GenericCallGraphEdgeTy
CallSiteID csId;
public:
/// Constructor
PTACallGraphEdge(PTACallGraphNode* s, PTACallGraphNode* d, CEDGEK kind, CallSiteID cs) :
CallGraphEdge(CallGraphNode* s, CallGraphNode* d, CEDGEK kind, CallSiteID cs) :
GenericCallGraphEdgeTy(s, d, makeEdgeFlagWithInvokeID(kind, cs)), csId(cs)
{
}
/// Destructor
virtual ~PTACallGraphEdge()
virtual ~CallGraphEdge()
{
}
/// Compute the unique edgeFlag value from edge kind and CallSiteID.
Expand Down Expand Up @@ -140,21 +140,21 @@ class PTACallGraphEdge : public GenericCallGraphEdgeTy

/// ClassOf
//@{
static inline bool classof(const PTACallGraphEdge*)
static inline bool classof(const CallGraphEdge*)
{
return true;
}
static inline bool classof(const GenericCallGraphEdgeTy *edge)
{
return edge->getEdgeKind() == PTACallGraphEdge::CallRetEdge ||
edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge ||
edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
return edge->getEdgeKind() == CallGraphEdge::CallRetEdge ||
edge->getEdgeKind() == CallGraphEdge::TDForkEdge ||
edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
}
//@}

/// Overloading operator << for dumping ICFG node ID
//@{
friend OutStream& operator<< (OutStream &o, const PTACallGraphEdge &edge)
friend OutStream& operator<< (OutStream &o, const CallGraphEdge &edge)
{
o << edge.toString();
return o;
Expand All @@ -163,28 +163,28 @@ class PTACallGraphEdge : public GenericCallGraphEdgeTy

virtual const std::string toString() const;

typedef GenericNode<PTACallGraphNode,PTACallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
typedef GenericNode<CallGraphNode,CallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;

};

/*
* Call Graph node representing a function
*/
typedef GenericNode<PTACallGraphNode,PTACallGraphEdge> GenericCallGraphNodeTy;
class PTACallGraphNode : public GenericCallGraphNodeTy
typedef GenericNode<CallGraphNode,CallGraphEdge> GenericCallGraphNodeTy;
class CallGraphNode : public GenericCallGraphNodeTy
{

public:
typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
typedef PTACallGraphEdge::CallGraphEdgeSet::iterator iterator;
typedef PTACallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator;
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
typedef CallGraphEdge::CallGraphEdgeSet::iterator iterator;
typedef CallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator;

private:
const SVFFunction* fun;

public:
/// Constructor
PTACallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,0), fun(f)
CallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,0), fun(f)
{

}
Expand All @@ -201,7 +201,7 @@ class PTACallGraphNode : public GenericCallGraphNodeTy

/// Overloading operator << for dumping ICFG node ID
//@{
friend OutStream& operator<< (OutStream &o, const PTACallGraphNode &node)
friend OutStream& operator<< (OutStream &o, const CallGraphNode &node)
{
o << node.toString();
return o;
Expand All @@ -214,13 +214,13 @@ class PTACallGraphNode : public GenericCallGraphNodeTy
/*!
* Pointer Analysis Call Graph used internally for various pointer analysis
*/
typedef GenericGraph<PTACallGraphNode,PTACallGraphEdge> GenericCallGraphTy;
class PTACallGraph : public GenericCallGraphTy
typedef GenericGraph<CallGraphNode,CallGraphEdge> GenericCallGraphTy;
class CallGraph : public GenericCallGraphTy
{

public:
typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
typedef Map<const SVFFunction*, PTACallGraphNode *> FunToCallGraphNodeMap;
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
typedef Map<const SVFFunction*, CallGraphNode *> FunToCallGraphNodeMap;
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
typedef std::pair<const CallICFGNode*, const SVFFunction*> CallSitePair;
typedef Map<CallSitePair, CallSiteID> CallSiteToIdMap;
Expand Down Expand Up @@ -258,13 +258,13 @@ class PTACallGraph : public GenericCallGraphTy

public:
/// Constructor
PTACallGraph(CGEK k = NormCallGraph);
CallGraph(CGEK k = NormCallGraph);

/// Add callgraph Node
void addCallGraphNode(const SVFFunction* fun);

/// Destructor
virtual ~PTACallGraph()
virtual ~CallGraph()
{
destroy();
}
Expand Down Expand Up @@ -312,11 +312,11 @@ class PTACallGraph : public GenericCallGraphTy

/// Get call graph node
//@{
inline PTACallGraphNode* getCallGraphNode(NodeID id) const
inline CallGraphNode* getCallGraphNode(NodeID id) const
{
return getGNode(id);
}
inline PTACallGraphNode* getCallGraphNode(const SVFFunction* fun) const
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
{
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
Expand Down Expand Up @@ -374,9 +374,9 @@ class PTACallGraph : public GenericCallGraphTy
}
//@}
/// Whether we have already created this call graph edge
PTACallGraphEdge* hasGraphEdge(PTACallGraphNode* src, PTACallGraphNode* dst,PTACallGraphEdge::CEDGEK kind, CallSiteID csId) const;
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,CallGraphEdge::CEDGEK kind, CallSiteID csId) const;
/// Get call graph edge via nodes
PTACallGraphEdge* getGraphEdge(PTACallGraphNode* src, PTACallGraphNode* dst,PTACallGraphEdge::CEDGEK kind, CallSiteID csId);
CallGraphEdge* getGraphEdge(CallGraphNode* src, CallGraphNode* dst,CallGraphEdge::CEDGEK kind, CallSiteID csId);

/// Get all callees for a callsite
inline void getCallees(const CallICFGNode* cs, FunctionSet& callees)
Expand Down Expand Up @@ -414,7 +414,7 @@ class PTACallGraph : public GenericCallGraphTy
}
//@}
/// Add call graph edge
inline void addEdge(PTACallGraphEdge* edge)
inline void addEdge(CallGraphEdge* edge)
{
edge->getDstNode()->addIncomingEdge(edge);
edge->getSrcNode()->addOutgoingEdge(edge);
Expand All @@ -428,9 +428,9 @@ class PTACallGraph : public GenericCallGraphTy

/// Get callsites invoking the callee
//@{
void getAllCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
void getDirCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
void getIndCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
void getAllCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
void getDirCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
void getIndCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
//@}

/// Whether its reachable between two functions
Expand All @@ -451,21 +451,21 @@ namespace SVF
* GenericGraphTraits specializations for generic graph algorithms.
* Provide graph traits for traversing from a constraint node using standard graph traversals.
*/
template<> struct GenericGraphTraits<SVF::PTACallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* >
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* >
{
};

/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
template<>
struct GenericGraphTraits<Inverse<SVF::PTACallGraphNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* > >
struct GenericGraphTraits<Inverse<SVF::CallGraphNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* > >
{
};

template<> struct GenericGraphTraits<SVF::PTACallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* >
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
{
typedef SVF::PTACallGraphNode *NodeRef;
typedef SVF::CallGraphNode *NodeRef;
};

} // End namespace llvm

#endif /* PTACALLGRAPH_H_ */
#endif /* CALLGRAPH_H_ */
4 changes: 2 additions & 2 deletions SVF-osx/Release-build/include/Graphs/ICFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
namespace SVF
{

class PTACallGraph;
class CallGraph;

/*!
* Interprocedural Control-Flow Graph (ICFG)
Expand Down Expand Up @@ -117,7 +117,7 @@ class ICFG : public GenericICFGTy
void view();

/// update ICFG for indirect calls
void updateCallGraph(PTACallGraph* callgraph);
void updateCallGraph(CallGraph* callgraph);

/// Whether node is in a loop
inline bool isInLoop(const ICFGNode *node)
Expand Down
Loading

0 comments on commit 522ebeb

Please sign in to comment.