svf-lib 1.0.732 → 1.0.736
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/DDA/ContextDDA.h +1 -1
- package/SVF-linux/include/DDA/DDAClient.h +8 -8
- package/SVF-linux/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-linux/include/DDA/FlowDDA.h +1 -1
- package/SVF-linux/include/Graphs/ConsG.h +6 -6
- package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
- package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
- package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
- package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
- package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
- package/SVF-linux/include/Graphs/IRGraph.h +236 -0
- package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
- package/SVF-linux/include/Graphs/SVFG.h +1 -1
- package/SVF-linux/include/Graphs/SVFGOPT.h +3 -3
- package/SVF-linux/include/Graphs/VFG.h +37 -52
- package/SVF-linux/include/Graphs/VFGNode.h +2 -3
- package/SVF-linux/include/MSSA/MemRegion.h +11 -11
- package/SVF-linux/include/MSSA/MemSSA.h +4 -4
- package/SVF-linux/include/MTA/FSMPTA.h +1 -1
- package/SVF-linux/include/MemoryModel/PAGBuilderFromFile.h +8 -8
- package/SVF-linux/include/MemoryModel/PTAStat.h +31 -31
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +9 -9
- package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +3 -3
- package/SVF-linux/include/MemoryModel/SVFIR.h +526 -235
- package/SVF-linux/include/MemoryModel/SVFStatements.h +872 -0
- package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +346 -55
- package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
- package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
- package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +398 -0
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
- package/SVF-linux/include/Util/CFLSolver.h +1 -1
- package/SVF-linux/include/Util/ExtAPI.h +1 -1
- package/SVF-linux/include/Util/IRAnnotator.h +6 -6
- package/SVF-linux/include/Util/Options.h +1 -1
- package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
- package/SVF-linux/include/WPA/Andersen.h +11 -11
- package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
- package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
- package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
- package/SVF-linux/include/WPA/Steensgaard.h +2 -2
- package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
- package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
- package/SVF-linux/include/WPA/WPAStat.h +1 -2
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/DDA/ContextDDA.h +1 -1
- package/SVF-osx/include/DDA/DDAClient.h +8 -8
- package/SVF-osx/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-osx/include/DDA/FlowDDA.h +1 -1
- package/SVF-osx/include/Graphs/ConsG.h +6 -6
- package/SVF-osx/include/Graphs/ConsGEdge.h +2 -2
- package/SVF-osx/include/Graphs/ConsGNode.h +1 -1
- package/SVF-osx/include/Graphs/ExternalPAG.h +14 -14
- package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
- package/SVF-osx/include/Graphs/ICFGNode.h +14 -14
- package/SVF-osx/include/Graphs/IRGraph.h +236 -0
- package/SVF-osx/include/Graphs/OfflineConsG.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +1 -1
- package/SVF-osx/include/Graphs/SVFGOPT.h +3 -3
- package/SVF-osx/include/Graphs/VFG.h +37 -52
- package/SVF-osx/include/Graphs/VFGNode.h +2 -3
- package/SVF-osx/include/MSSA/MemRegion.h +11 -11
- package/SVF-osx/include/MSSA/MemSSA.h +4 -4
- package/SVF-osx/include/MTA/FSMPTA.h +1 -1
- package/SVF-osx/include/MemoryModel/PAGBuilderFromFile.h +8 -8
- package/SVF-osx/include/MemoryModel/PTAStat.h +31 -31
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +9 -9
- package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +3 -3
- package/SVF-osx/include/MemoryModel/SVFIR.h +526 -235
- package/SVF-osx/include/MemoryModel/SVFStatements.h +872 -0
- package/SVF-osx/include/MemoryModel/SVFVariables.h +842 -0
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +346 -55
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +0 -2
- package/SVF-osx/include/SABER/SrcSnkDDA.h +3 -3
- package/SVF-osx/include/SVF-FE/Graph2Json.h +1 -3
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +398 -0
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -1
- package/SVF-osx/include/Util/CFLSolver.h +1 -1
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/IRAnnotator.h +6 -6
- package/SVF-osx/include/Util/Options.h +1 -1
- package/SVF-osx/include/Util/TypeBasedHeapCloning.h +11 -11
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/AndersenSFR.h +4 -4
- package/SVF-osx/include/WPA/FlowSensitive.h +2 -2
- package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
- package/SVF-osx/include/WPA/Steensgaard.h +2 -2
- package/SVF-osx/include/WPA/TypeAnalysis.h +1 -1
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +2 -2
- package/SVF-osx/include/WPA/WPAStat.h +1 -2
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#define INCLUDE_UTIL_VFG_H_
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
#include "
|
|
34
|
+
#include "MemoryModel/SVFIR.h"
|
|
35
35
|
#include "Graphs/PTACallGraph.h"
|
|
36
36
|
#include "Graphs/VFGNode.h"
|
|
37
37
|
#include "Graphs/VFGEdge.h"
|
|
@@ -78,7 +78,7 @@ public:
|
|
|
78
78
|
typedef VFGEdge::VFGEdgeSetTy::iterator VFGNodeIter;
|
|
79
79
|
typedef VFGNodeIDToNodeMapTy::iterator iterator;
|
|
80
80
|
typedef VFGNodeIDToNodeMapTy::const_iterator const_iterator;
|
|
81
|
-
typedef
|
|
81
|
+
typedef SVFIR::PAGEdgeSet PAGEdgeSet;
|
|
82
82
|
typedef Set<const VFGNode*> GlobalVFGNodeSet;
|
|
83
83
|
typedef Set<const PAGNode*> PAGNodeSet;
|
|
84
84
|
|
|
@@ -99,7 +99,7 @@ protected:
|
|
|
99
99
|
|
|
100
100
|
GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
|
|
101
101
|
PTACallGraph* callgraph;
|
|
102
|
-
|
|
102
|
+
SVFIR* pag;
|
|
103
103
|
VFGK kind;
|
|
104
104
|
|
|
105
105
|
/// Clean up memory
|
|
@@ -127,8 +127,8 @@ public:
|
|
|
127
127
|
return (kind == PTRONLYSVFG) || (kind == PTRONLYSVFG_OPT);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
/// Return
|
|
131
|
-
inline
|
|
130
|
+
/// Return SVFIR
|
|
131
|
+
inline SVFIR* getPAG() const
|
|
132
132
|
{
|
|
133
133
|
return pag;
|
|
134
134
|
}
|
|
@@ -261,12 +261,12 @@ public:
|
|
|
261
261
|
const VFGNode* defNode = getVFGNode(getDef(pagNode));
|
|
262
262
|
if (const AddrVFGNode* addr = SVFUtil::dyn_cast<AddrVFGNode>(defNode))
|
|
263
263
|
{
|
|
264
|
-
if (
|
|
264
|
+
if (SVFIR::getPAG()->isBlkObjOrConstantObj(addr->getPAGEdge()->getSrcID()))
|
|
265
265
|
return true;
|
|
266
266
|
}
|
|
267
267
|
else if(const CopyVFGNode* copy = SVFUtil::dyn_cast<CopyVFGNode>(defNode))
|
|
268
268
|
{
|
|
269
|
-
if (
|
|
269
|
+
if (SVFIR::getPAG()->isNullPtr(copy->getPAGEdge()->getSrcID()))
|
|
270
270
|
return true;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -400,13 +400,13 @@ protected:
|
|
|
400
400
|
}
|
|
401
401
|
else
|
|
402
402
|
{
|
|
403
|
-
assert((it->second == node->getId()) && "a
|
|
403
|
+
assert((it->second == node->getId()) && "a SVFIR node can only have unique definition ");
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
inline NodeID getDef(const PAGNode* pagNode) const
|
|
407
407
|
{
|
|
408
408
|
PAGNodeToDefMapTy::const_iterator it = PAGNodeToDefMap.find(pagNode);
|
|
409
|
-
assert(it!=PAGNodeToDefMap.end() && "
|
|
409
|
+
assert(it!=PAGNodeToDefMap.end() && "SVFIR node does not have a definition??");
|
|
410
410
|
return it->second;
|
|
411
411
|
}
|
|
412
412
|
inline bool hasDef(const PAGNode* pagNode) const
|
|
@@ -503,7 +503,7 @@ protected:
|
|
|
503
503
|
setDef(load->getDstNode(),sNode);
|
|
504
504
|
}
|
|
505
505
|
/// Add a Store VFG node,
|
|
506
|
-
/// To be noted store does not create a new pointer, we do not set def for any
|
|
506
|
+
/// To be noted store does not create a new pointer, we do not set def for any SVFIR node
|
|
507
507
|
void addStoreVFGNode(const StorePE* store)
|
|
508
508
|
{
|
|
509
509
|
StoreVFGNode* sNode = new StoreVFGNode(totalVFGNode++,store);
|
|
@@ -545,7 +545,7 @@ protected:
|
|
|
545
545
|
PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
|
|
546
546
|
/// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
|
|
547
547
|
/// we will set this phi node's def later
|
|
548
|
-
/// Ideally, every function uniqueFunRet should be a PhiNode (
|
|
548
|
+
/// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
|
|
549
549
|
if (!pag->isPhiNode(uniqueFunRet)){
|
|
550
550
|
std::string warn = fun->getName().str();
|
|
551
551
|
SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
|
|
@@ -561,70 +561,55 @@ protected:
|
|
|
561
561
|
PAGNodeToActualRetMap[ret] = sNode;
|
|
562
562
|
}
|
|
563
563
|
/// Add an llvm PHI VFG node
|
|
564
|
-
inline void addIntraPHIVFGNode(const
|
|
564
|
+
inline void addIntraPHIVFGNode(const PhiPE* edge)
|
|
565
565
|
{
|
|
566
|
-
IntraPHIVFGNode* sNode = new IntraPHIVFGNode(totalVFGNode++,
|
|
566
|
+
IntraPHIVFGNode* sNode = new IntraPHIVFGNode(totalVFGNode++,edge->getRes());
|
|
567
567
|
u32_t pos = 0;
|
|
568
|
-
|
|
569
|
-
for(PAG::CopyPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
|
|
568
|
+
for(auto var : edge->getOpndVars())
|
|
570
569
|
{
|
|
571
|
-
|
|
572
|
-
|
|
570
|
+
sNode->setOpVerAndBB(pos, var, edge->getICFGNode());
|
|
571
|
+
pos++;
|
|
573
572
|
}
|
|
574
|
-
assert(edge && "edge not found?");
|
|
575
573
|
addVFGNode(sNode,edge->getICFGNode());
|
|
576
|
-
setDef(
|
|
577
|
-
PAGNodeToIntraPHIVFGNodeMap[
|
|
574
|
+
setDef(edge->getRes(),sNode);
|
|
575
|
+
PAGNodeToIntraPHIVFGNodeMap[edge->getRes()] = sNode;
|
|
578
576
|
}
|
|
579
577
|
/// Add a Compare VFG node
|
|
580
|
-
inline void addCmpVFGNode(const
|
|
578
|
+
inline void addCmpVFGNode(const CmpPE* edge)
|
|
581
579
|
{
|
|
582
|
-
CmpVFGNode* sNode = new CmpVFGNode(totalVFGNode++,
|
|
580
|
+
CmpVFGNode* sNode = new CmpVFGNode(totalVFGNode++, edge->getRes());
|
|
583
581
|
u32_t pos = 0;
|
|
584
|
-
|
|
585
|
-
for(PAG::CmpPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
|
|
582
|
+
for(auto var : edge->getOpndVars())
|
|
586
583
|
{
|
|
587
|
-
|
|
588
|
-
|
|
584
|
+
sNode->setOpVer(pos, var);
|
|
585
|
+
pos++;
|
|
589
586
|
}
|
|
590
|
-
assert(edge && "edge not found?");
|
|
591
587
|
addVFGNode(sNode,edge->getICFGNode());
|
|
592
|
-
setDef(
|
|
593
|
-
PAGNodeToCmpVFGNodeMap[
|
|
588
|
+
setDef(edge->getRes(),sNode);
|
|
589
|
+
PAGNodeToCmpVFGNodeMap[edge->getRes()] = sNode;
|
|
594
590
|
}
|
|
595
591
|
/// Add a BinaryOperator VFG node
|
|
596
|
-
inline void addBinaryOPVFGNode(const
|
|
592
|
+
inline void addBinaryOPVFGNode(const BinaryOPPE* edge)
|
|
597
593
|
{
|
|
598
|
-
BinaryOPVFGNode* sNode = new BinaryOPVFGNode(totalVFGNode++,
|
|
594
|
+
BinaryOPVFGNode* sNode = new BinaryOPVFGNode(totalVFGNode++, edge->getRes());
|
|
599
595
|
u32_t pos = 0;
|
|
600
|
-
|
|
601
|
-
for(PAG::BinaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
|
|
596
|
+
for(auto var : edge->getOpndVars())
|
|
602
597
|
{
|
|
603
|
-
|
|
604
|
-
|
|
598
|
+
sNode->setOpVer(pos, var);
|
|
599
|
+
pos++;
|
|
605
600
|
}
|
|
606
|
-
|
|
607
|
-
assert(edge && "edge not found?");
|
|
608
601
|
addVFGNode(sNode,edge->getICFGNode());
|
|
609
|
-
setDef(
|
|
610
|
-
PAGNodeToBinaryOPVFGNodeMap[
|
|
602
|
+
setDef(edge->getRes(),sNode);
|
|
603
|
+
PAGNodeToBinaryOPVFGNodeMap[edge->getRes()] = sNode;
|
|
611
604
|
}
|
|
612
605
|
/// Add a UnaryOperator VFG node
|
|
613
|
-
inline void addUnaryOPVFGNode(const
|
|
606
|
+
inline void addUnaryOPVFGNode(const UnaryOPPE* edge)
|
|
614
607
|
{
|
|
615
|
-
UnaryOPVFGNode* sNode = new UnaryOPVFGNode(totalVFGNode++,
|
|
616
|
-
|
|
617
|
-
const PAGEdge* edge = nullptr;
|
|
618
|
-
for(PAG::UnaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
|
|
619
|
-
{
|
|
620
|
-
edge = *it;
|
|
621
|
-
sNode->setOpVer(pos, (*it)->getSrcNode());
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
assert(edge && "edge not found?");
|
|
608
|
+
UnaryOPVFGNode* sNode = new UnaryOPVFGNode(totalVFGNode++, edge->getDstNode());
|
|
609
|
+
sNode->setOpVer(0, edge->getSrcNode());
|
|
625
610
|
addVFGNode(sNode,edge->getICFGNode());
|
|
626
|
-
setDef(
|
|
627
|
-
PAGNodeToUnaryOPVFGNodeMap[
|
|
611
|
+
setDef(edge->getDstNode(),sNode);
|
|
612
|
+
PAGNodeToUnaryOPVFGNodeMap[edge->getDstNode()] = sNode;
|
|
628
613
|
}
|
|
629
614
|
};
|
|
630
615
|
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
#include "Graphs/GenericGraph.h"
|
|
34
34
|
#include "Graphs/VFGEdge.h"
|
|
35
35
|
#include "Graphs/ICFGNode.h"
|
|
36
|
-
#include "
|
|
37
|
-
#include "Graphs/PAGEdge.h"
|
|
36
|
+
#include "MemoryModel/SVFIR.h"
|
|
38
37
|
|
|
39
38
|
namespace SVF
|
|
40
39
|
{
|
|
@@ -331,7 +330,7 @@ public:
|
|
|
331
330
|
CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r)
|
|
332
331
|
{
|
|
333
332
|
const CmpInst* cmp = SVFUtil::dyn_cast<CmpInst>(r->getValue());
|
|
334
|
-
assert(cmp && "not a
|
|
333
|
+
assert(cmp && "not a compare operator?");
|
|
335
334
|
}
|
|
336
335
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
337
336
|
//@{
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef MEMORYREGION_H_
|
|
31
31
|
#define MEMORYREGION_H_
|
|
32
32
|
|
|
33
|
-
#include "
|
|
33
|
+
#include "MemoryModel/SVFIR.h"
|
|
34
34
|
#include "Graphs/PTACallGraph.h"
|
|
35
35
|
#include "Util/SCC.h"
|
|
36
36
|
#include "Util/WorkList.h"
|
|
@@ -168,8 +168,8 @@ public:
|
|
|
168
168
|
|
|
169
169
|
typedef Map<NodeID, NodeBS> NodeToPTSSMap;
|
|
170
170
|
|
|
171
|
-
///
|
|
172
|
-
typedef
|
|
171
|
+
/// SVFIR edge list
|
|
172
|
+
typedef SVFIR::PAGEdgeList PAGEdgeList;
|
|
173
173
|
/// Call Graph SCC
|
|
174
174
|
typedef SCCDetection<PTACallGraph*> SCC;
|
|
175
175
|
|
|
@@ -197,17 +197,17 @@ private:
|
|
|
197
197
|
|
|
198
198
|
/// Map a function to all its memory regions
|
|
199
199
|
FunToMRsMap funToMRsMap;
|
|
200
|
-
/// Map a load
|
|
200
|
+
/// Map a load SVFIR Edge to its memory regions sets in order for inserting mus in Memory SSA
|
|
201
201
|
LoadsToMRsMap loadsToMRsMap;
|
|
202
|
-
/// Map a store
|
|
202
|
+
/// Map a store SVFIR Edge to its memory regions sets in order for inserting chis in Memory SSA
|
|
203
203
|
StoresToMRsMap storesToMRsMap;
|
|
204
204
|
/// Map a callsite to its refs regions
|
|
205
205
|
CallSiteToMRsMap callsiteToRefMRsMap;
|
|
206
206
|
/// Map a callsite to its mods regions
|
|
207
207
|
CallSiteToMRsMap callsiteToModMRsMap;
|
|
208
|
-
/// Map a load
|
|
208
|
+
/// Map a load SVFIR Edge to its CPts set map
|
|
209
209
|
LoadsToPointsToMap loadsToPointsToMap;
|
|
210
|
-
/// Map a store
|
|
210
|
+
/// Map a store SVFIR Edge to its CPts set map
|
|
211
211
|
StoresToPointsToMap storesToPointsToMap;
|
|
212
212
|
/// Map a callsite to it refs cpts set
|
|
213
213
|
CallSiteToPointsToMap callsiteToRefPointsToMap;
|
|
@@ -235,7 +235,7 @@ private:
|
|
|
235
235
|
/// Map a pointer to its cached points-to chain;
|
|
236
236
|
NodeToPTSSMap cachedPtsChainMap;
|
|
237
237
|
|
|
238
|
-
/// All global variable
|
|
238
|
+
/// All global variable SVFIR node ids
|
|
239
239
|
NodeBS allGlobals;
|
|
240
240
|
|
|
241
241
|
/// Clean up memory
|
|
@@ -427,11 +427,11 @@ public:
|
|
|
427
427
|
/// Start generating memory regions
|
|
428
428
|
virtual void generateMRs();
|
|
429
429
|
|
|
430
|
-
/// Get the function which
|
|
430
|
+
/// Get the function which SVFIR Edge located
|
|
431
431
|
const SVFFunction* getFunction(const PAGEdge* pagEdge) const
|
|
432
432
|
{
|
|
433
433
|
PAGEdgeToFunMap::const_iterator it = pagEdgeToFunMap.find(pagEdge);
|
|
434
|
-
assert(it!=pagEdgeToFunMap.end() && "can not find its function, it is a global
|
|
434
|
+
assert(it!=pagEdgeToFunMap.end() && "can not find its function, it is a global SVFIR edge");
|
|
435
435
|
return it->second;
|
|
436
436
|
}
|
|
437
437
|
/// Get Memory Region set
|
|
@@ -465,7 +465,7 @@ public:
|
|
|
465
465
|
return callsiteToModMRsMap[cs];
|
|
466
466
|
}
|
|
467
467
|
//@}
|
|
468
|
-
/// Whether this instruction has
|
|
468
|
+
/// Whether this instruction has SVFIR Edge
|
|
469
469
|
bool hasPAGEdgeList(const Instruction* inst);
|
|
470
470
|
/// Given an instruction, get all its the PAGEdge (statement) in sequence
|
|
471
471
|
PAGEdgeList& getPAGEdgesFromInst(const Instruction* inst);
|
|
@@ -93,8 +93,8 @@ public:
|
|
|
93
93
|
typedef Map<const MemRegion*, std::vector<MRVer*> > MemRegToVerStackMap;
|
|
94
94
|
typedef Map<const MemRegion*, MRVERSION> MemRegToCounterMap;
|
|
95
95
|
|
|
96
|
-
///
|
|
97
|
-
typedef
|
|
96
|
+
/// SVFIR edge list
|
|
97
|
+
typedef SVFIR::PAGEdgeList PAGEdgeList;
|
|
98
98
|
|
|
99
99
|
/// Statistics
|
|
100
100
|
//@{
|
|
@@ -309,8 +309,8 @@ public:
|
|
|
309
309
|
{
|
|
310
310
|
destroy();
|
|
311
311
|
}
|
|
312
|
-
/// Return
|
|
313
|
-
inline
|
|
312
|
+
/// Return SVFIR
|
|
313
|
+
inline SVFIR* getPAG();
|
|
314
314
|
/// Return PTA
|
|
315
315
|
inline BVDataPTAImpl* getPTA() const
|
|
316
316
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===- PAGBuilderFromFile.h -- Building
|
|
1
|
+
//===- PAGBuilderFromFile.h -- Building SVFIR from File--------------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
#ifndef INCLUDE_MEMORYMODEL_PAGBUILDERFROMFILE_H_
|
|
31
31
|
#define INCLUDE_MEMORYMODEL_PAGBUILDERFROMFILE_H_
|
|
32
32
|
|
|
33
|
-
#include "
|
|
33
|
+
#include "MemoryModel/SVFIR.h"
|
|
34
34
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
37
37
|
|
|
38
38
|
/*!
|
|
39
|
-
* Build
|
|
39
|
+
* Build SVFIR from a user specified file (for debugging purpose)
|
|
40
40
|
*/
|
|
41
41
|
class PAGBuilderFromFile
|
|
42
42
|
{
|
|
43
43
|
|
|
44
44
|
private:
|
|
45
|
-
|
|
45
|
+
SVFIR* pag;
|
|
46
46
|
std::string file;
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
49
|
PAGBuilderFromFile(std::string f) :
|
|
50
|
-
pag(
|
|
50
|
+
pag(SVFIR::getPAG(true)), file(f)
|
|
51
51
|
{
|
|
52
52
|
}
|
|
53
53
|
/// Destructor
|
|
@@ -55,8 +55,8 @@ public:
|
|
|
55
55
|
{
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
/// Return
|
|
59
|
-
|
|
58
|
+
/// Return SVFIR
|
|
59
|
+
SVFIR* getPAG() const
|
|
60
60
|
{
|
|
61
61
|
return pag;
|
|
62
62
|
}
|
|
@@ -68,7 +68,7 @@ public:
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/// Start building
|
|
71
|
-
|
|
71
|
+
SVFIR* build();
|
|
72
72
|
|
|
73
73
|
// Add edges
|
|
74
74
|
void addEdge(NodeID nodeSrc, NodeID nodeDst, Size_t offset,
|
|
@@ -57,49 +57,49 @@ public:
|
|
|
57
57
|
static const char* ProcessCopyGepTime; ///< time of processing copys and geps
|
|
58
58
|
static const char* UpdateCallGraphTime; ///< time of updating call graph
|
|
59
59
|
|
|
60
|
-
static const char* TotalNumOfPointers; ///< Total
|
|
61
|
-
static const char* TotalNumOfObjects; ///< Total
|
|
62
|
-
static const char* TotalNumOfFieldObjects; ///< Total
|
|
60
|
+
static const char* TotalNumOfPointers; ///< Total SVFIR value node
|
|
61
|
+
static const char* TotalNumOfObjects; ///< Total SVFIR object node
|
|
62
|
+
static const char* TotalNumOfFieldObjects; ///< Total SVFIR field object node
|
|
63
63
|
static const char* MaxStructSize; ///< Max struct size
|
|
64
|
-
static const char* TotalNumOfEdges; ///< Total
|
|
65
|
-
|
|
66
|
-
static const char* NumOfAddrs; ///<
|
|
67
|
-
static const char* NumOfLoads; ///<
|
|
68
|
-
static const char* NumOfStores; ///<
|
|
69
|
-
static const char* NumOfCopys; ///<
|
|
70
|
-
static const char* NumOfGeps; ///<
|
|
71
|
-
static const char* NumOfCalls; ///<
|
|
72
|
-
static const char* NumOfReturns; ///<
|
|
73
|
-
|
|
74
|
-
static const char* NumOfProcessedAddrs; ///<
|
|
75
|
-
static const char* NumOfProcessedLoads; ///<
|
|
76
|
-
static const char* NumOfProcessedStores; ///<
|
|
77
|
-
static const char* NumOfProcessedCopys; ///<
|
|
78
|
-
static const char* NumOfProcessedGeps; ///<
|
|
64
|
+
static const char* TotalNumOfEdges; ///< Total SVFIR edge number
|
|
65
|
+
|
|
66
|
+
static const char* NumOfAddrs; ///< SVFIR addr edge
|
|
67
|
+
static const char* NumOfLoads; ///< SVFIR load edge
|
|
68
|
+
static const char* NumOfStores; ///< SVFIR store edge
|
|
69
|
+
static const char* NumOfCopys; ///< SVFIR copy edge
|
|
70
|
+
static const char* NumOfGeps; ///< SVFIR gep edge
|
|
71
|
+
static const char* NumOfCalls; ///< SVFIR call edge
|
|
72
|
+
static const char* NumOfReturns; ///< SVFIR return edge
|
|
73
|
+
|
|
74
|
+
static const char* NumOfProcessedAddrs; ///< SVFIR processed addr edge
|
|
75
|
+
static const char* NumOfProcessedLoads; ///< SVFIR processed load edge
|
|
76
|
+
static const char* NumOfProcessedStores; ///< SVFIR processed store edge
|
|
77
|
+
static const char* NumOfProcessedCopys; ///< SVFIR processed copy edge
|
|
78
|
+
static const char* NumOfProcessedGeps; ///< SVFIR processed gep edge
|
|
79
79
|
|
|
80
80
|
static const char* NumOfSfr; ///< num of field representatives
|
|
81
81
|
static const char* NumOfFieldExpand;
|
|
82
82
|
|
|
83
83
|
static const char* NumOfFunctionObjs; ///< Function numbers
|
|
84
|
-
static const char* NumOfGlobalObjs; ///<
|
|
85
|
-
static const char* NumOfHeapObjs; ///<
|
|
86
|
-
static const char* NumOfStackObjs; ///<
|
|
84
|
+
static const char* NumOfGlobalObjs; ///< SVFIR global object node
|
|
85
|
+
static const char* NumOfHeapObjs; ///< SVFIR heap object node
|
|
86
|
+
static const char* NumOfStackObjs; ///< SVFIR stack object node
|
|
87
87
|
|
|
88
|
-
static const char* NumOfObjsHasVarStruct; ///<
|
|
89
|
-
static const char* NumOfObjsHasVarArray; ///<
|
|
90
|
-
static const char* NumOfObjsHasConstStruct; ///<
|
|
91
|
-
static const char* NumOfObjsHasConstArray; ///<
|
|
92
|
-
static const char* NumOfNonPtrObjs; ///<
|
|
93
|
-
static const char* NumOfConstantObjs; ///<
|
|
88
|
+
static const char* NumOfObjsHasVarStruct; ///< SVFIR object node has var struct (maybe nested with array)
|
|
89
|
+
static const char* NumOfObjsHasVarArray; ///< SVFIR object node has var array (maybe nested with struct)
|
|
90
|
+
static const char* NumOfObjsHasConstStruct; ///< SVFIR object node has const struct (maybe nested with array)
|
|
91
|
+
static const char* NumOfObjsHasConstArray; ///< SVFIR object node has const array (maybe nested with struct)
|
|
92
|
+
static const char* NumOfNonPtrObjs; ///< SVFIR object node which is non pointer type object (do not have pts)
|
|
93
|
+
static const char* NumOfConstantObjs; ///< SVFIR object node which is purely constant
|
|
94
94
|
|
|
95
95
|
static const char* NumberOfFieldInsensitiveObj;
|
|
96
96
|
static const char* NumberOfFieldSensitiveObj;
|
|
97
97
|
|
|
98
|
-
static const char* NumOfPointers; ///<
|
|
99
|
-
static const char* NumOfGepFieldPointers; ///<
|
|
98
|
+
static const char* NumOfPointers; ///< SVFIR value node, each of them maps to a llvm value
|
|
99
|
+
static const char* NumOfGepFieldPointers; ///< SVFIR gep value node (field value, dynamically created dummy node)
|
|
100
100
|
|
|
101
|
-
static const char* NumOfMemObjects; ///<
|
|
102
|
-
static const char* NumOfGepFieldObjects; ///<
|
|
101
|
+
static const char* NumOfMemObjects; ///< SVFIR object node, each of them maps to a llvm value
|
|
102
|
+
static const char* NumOfGepFieldObjects; ///< SVFIR gep object node (field obj, dynamically created dummy node)
|
|
103
103
|
|
|
104
104
|
static const char* AveragePointsToSetSize; ///< Average points-to size of all variables
|
|
105
105
|
static const char* AverageTopLevPointsToSetSize; ///< Average points-to size of top-level variables
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
#include <unistd.h>
|
|
34
34
|
#include <signal.h>
|
|
35
35
|
|
|
36
|
-
#include "
|
|
36
|
+
#include "MemoryModel/SVFIR.h"
|
|
37
37
|
#include "MemoryModel/ConditionalPT.h"
|
|
38
38
|
#include "MemoryModel/AbstractPointsToDS.h"
|
|
39
39
|
#include "MemoryModel/MutablePointsToDS.h"
|
|
@@ -106,7 +106,7 @@ public:
|
|
|
106
106
|
//@{
|
|
107
107
|
typedef llvm::AliasAnalysis AliasAnalysis;
|
|
108
108
|
typedef Set<const CallBlockNode*> CallSiteSet;
|
|
109
|
-
typedef
|
|
109
|
+
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
|
|
110
110
|
typedef Set<const SVFFunction*> FunctionSet;
|
|
111
111
|
typedef OrderedMap<const CallBlockNode*, FunctionSet> CallEdgeMap;
|
|
112
112
|
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
@@ -143,8 +143,8 @@ protected:
|
|
|
143
143
|
u32_t OnTheFlyIterBudgetForStat;
|
|
144
144
|
//@}
|
|
145
145
|
|
|
146
|
-
///
|
|
147
|
-
static
|
|
146
|
+
/// SVFIR
|
|
147
|
+
static SVFIR* pag;
|
|
148
148
|
/// Module
|
|
149
149
|
SVFModule* svfMod;
|
|
150
150
|
/// Pointer analysis Type
|
|
@@ -186,7 +186,7 @@ public:
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/// Constructor
|
|
189
|
-
PointerAnalysis(
|
|
189
|
+
PointerAnalysis(SVFIR* pag, PTATY ty = Default_PTA, bool alias_check = true);
|
|
190
190
|
|
|
191
191
|
/// Type of pointer analysis
|
|
192
192
|
inline PTATY getAnalysisTy() const
|
|
@@ -200,9 +200,9 @@ public:
|
|
|
200
200
|
return ptaImplTy;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
/// Get/set
|
|
203
|
+
/// Get/set SVFIR
|
|
204
204
|
///@{
|
|
205
|
-
inline
|
|
205
|
+
inline SVFIR* getPAG() const
|
|
206
206
|
{
|
|
207
207
|
return pag;
|
|
208
208
|
}
|
|
@@ -227,7 +227,7 @@ public:
|
|
|
227
227
|
/// Destructor
|
|
228
228
|
virtual ~PointerAnalysis();
|
|
229
229
|
|
|
230
|
-
/// Initialization of a pointer analysis, including building symbol table and
|
|
230
|
+
/// Initialization of a pointer analysis, including building symbol table and SVFIR etc.
|
|
231
231
|
virtual void initialize();
|
|
232
232
|
|
|
233
233
|
/// Finalization of a pointer analysis, including checking alias correctness
|
|
@@ -344,7 +344,7 @@ public:
|
|
|
344
344
|
///@{
|
|
345
345
|
inline bool isFIObjNode(NodeID id) const
|
|
346
346
|
{
|
|
347
|
-
return (SVFUtil::isa<FIObjPN>(pag->
|
|
347
|
+
return (SVFUtil::isa<FIObjPN>(pag->getGNode(id)));
|
|
348
348
|
}
|
|
349
349
|
inline NodeID getBaseObjNode(NodeID id)
|
|
350
350
|
{
|
|
@@ -68,7 +68,7 @@ public:
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
/// Constructor
|
|
71
|
-
BVDataPTAImpl(
|
|
71
|
+
BVDataPTAImpl(SVFIR* pag, PointerAnalysis::PTATY type, bool alias_check = true);
|
|
72
72
|
|
|
73
73
|
/// Destructor
|
|
74
74
|
virtual ~BVDataPTAImpl()
|
|
@@ -261,7 +261,7 @@ public:
|
|
|
261
261
|
typedef Map<NodeID,CPtSet> PtrToCPtsMap; /// map a pointer to its conditional points-to set
|
|
262
262
|
|
|
263
263
|
/// Constructor
|
|
264
|
-
CondPTAImpl(
|
|
264
|
+
CondPTAImpl(SVFIR* pag, PointerAnalysis::PTATY type) : PointerAnalysis(pag, type), normalized(false)
|
|
265
265
|
{
|
|
266
266
|
if (type == PathS_DDA || type == Cxt_DDA)
|
|
267
267
|
ptD = new MutPTDataTy();
|
|
@@ -574,7 +574,7 @@ public:
|
|
|
574
574
|
{
|
|
575
575
|
for (OrderedNodeSet::iterator nIter = this->getAllValidPtrs().begin(); nIter != this->getAllValidPtrs().end(); ++nIter)
|
|
576
576
|
{
|
|
577
|
-
const PAGNode* node = this->getPAG()->
|
|
577
|
+
const PAGNode* node = this->getPAG()->getGNode(*nIter);
|
|
578
578
|
if (this->getPAG()->isValidTopLevelPtr(node))
|
|
579
579
|
{
|
|
580
580
|
if (SVFUtil::isa<DummyObjPN>(node))
|