svf-lib 1.0.993 → 1.0.994
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-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-osx/include/CFL/CFLAlias.h +26 -15
- package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
- package/SVF-osx/include/CFL/CFLSolver.h +9 -5
- package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-osx/include/CUDD/cudd.h +20 -11
- package/SVF-osx/include/CUDD/cuddInt.h +48 -31
- package/SVF-osx/include/CUDD/epd.h +35 -29
- package/SVF-osx/include/CUDD/mtr.h +4 -3
- package/SVF-osx/include/CUDD/st.h +7 -4
- package/SVF-osx/include/CUDD/util.h +6 -6
- package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
- package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/ConsG.h +2 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
- package/SVF-osx/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
- package/SVF-osx/include/Graphs/IRGraph.h +10 -6
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +4 -3
- package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-osx/include/Graphs/VFG.h +45 -39
- package/SVF-osx/include/Graphs/VFGNode.h +8 -4
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/FSMPTA.h +55 -44
- package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
- package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
- package/SVF-osx/include/MTA/MHP.h +17 -13
- package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-osx/include/MTA/PCG.h +9 -7
- package/SVF-osx/include/MTA/TCT.h +27 -22
- package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-osx/include/SABER/ProgSlice.h +2 -1
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-osx/include/Util/BDDExpr.h +32 -16
- package/SVF-osx/include/Util/BasicTypes.h +77 -25
- package/SVF-osx/include/Util/CoreBitVector.h +2 -1
- package/SVF-osx/include/Util/CxtStmt.h +37 -27
- package/SVF-osx/include/Util/ExeState.h +42 -22
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-osx/include/Util/Options.h +3 -3
- package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-osx/include/Util/SVFModule.h +5 -5
- package/SVF-osx/include/Util/SVFUtil.h +12 -9
- package/SVF-osx/include/Util/Z3Expr.h +191 -144
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -32,20 +32,23 @@
|
|
|
32
32
|
|
|
33
33
|
#include "CFLGrammar.h"
|
|
34
34
|
|
|
35
|
-
namespace SVF
|
|
35
|
+
namespace SVF
|
|
36
|
+
{
|
|
36
37
|
|
|
37
38
|
/*!
|
|
38
39
|
* Normalize Grammar from a grammarbase
|
|
39
40
|
*/
|
|
40
41
|
|
|
41
|
-
class CFGNormalizer
|
|
42
|
+
class CFGNormalizer
|
|
43
|
+
{
|
|
42
44
|
|
|
43
45
|
public:
|
|
44
46
|
typedef u32_t Symbol;
|
|
45
47
|
typedef std::vector<Symbol> Production;
|
|
46
48
|
typedef Set<Production> Productions;
|
|
47
49
|
|
|
48
|
-
CFGNormalizer()
|
|
50
|
+
CFGNormalizer()
|
|
51
|
+
{
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
/// Start Normalize (BIN Only)
|
|
@@ -35,30 +35,36 @@
|
|
|
35
35
|
#include "Graphs/ConsG.h"
|
|
36
36
|
#include "Util/Options.h"
|
|
37
37
|
|
|
38
|
-
namespace SVF
|
|
38
|
+
namespace SVF
|
|
39
|
+
{
|
|
39
40
|
|
|
40
|
-
class CFLAlias : public PointerAnalysis
|
|
41
|
+
class CFLAlias : public PointerAnalysis
|
|
42
|
+
{
|
|
41
43
|
|
|
42
44
|
public:
|
|
43
|
-
CFLAlias(SVFIR* ir) : PointerAnalysis(ir, PointerAnalysis::CFLFICI_WPA), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
45
|
+
CFLAlias(SVFIR* ir) : PointerAnalysis(ir, PointerAnalysis::CFLFICI_WPA), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
46
|
+
{
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
/// Destructor
|
|
47
|
-
virtual ~CFLAlias()
|
|
50
|
+
virtual ~CFLAlias()
|
|
51
|
+
{
|
|
48
52
|
delete graph;
|
|
49
53
|
delete grammar;
|
|
50
54
|
delete solver;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
/// Start Analysis here (main part of pointer analysis).
|
|
54
|
-
virtual void analyze()
|
|
57
|
+
/// Start Analysis here (main part of pointer analysis).
|
|
58
|
+
virtual void analyze()
|
|
59
|
+
{
|
|
55
60
|
PointerAnalysis::initialize();
|
|
56
61
|
GrammarBuilder * gReader = new GrammarBuilder(Options::GrammarFilename);
|
|
57
62
|
CFGNormalizer *normalizer = new CFGNormalizer();
|
|
58
|
-
|
|
63
|
+
|
|
59
64
|
graph = new CFLGraph();
|
|
60
|
-
if (Options::GraphIsFromDot == false)
|
|
61
|
-
|
|
65
|
+
if (Options::GraphIsFromDot == false)
|
|
66
|
+
{
|
|
67
|
+
// Maybe could put in SVFIR Class
|
|
62
68
|
// In memory Graph does not have string type label
|
|
63
69
|
Map<std::string, SVF::CFLGraph::Symbol> ConstMap = {{"Addr",0}, {"Copy", 1},{"Store", 2},{"Load", 3},{"Gep", 4},{"Vgep", 5},{"Addrbar",6}, {"Copybar", 7},{"Storebar", 8},{"Loadbar", 9},{"Gepbar", 10},{"Vgepbar", 11}};
|
|
64
70
|
ConstraintGraph *consCG = new ConstraintGraph(svfir);
|
|
@@ -72,11 +78,12 @@ public:
|
|
|
72
78
|
grammar = normalizer->normalize(generalGrammar);
|
|
73
79
|
graph->setMap(&grammar->terminals, &grammar->nonterminals);
|
|
74
80
|
}
|
|
75
|
-
else
|
|
81
|
+
else
|
|
82
|
+
{
|
|
76
83
|
GrammarBase *generalGrammar = gReader->build();
|
|
77
84
|
grammar = normalizer->normalize(generalGrammar);
|
|
78
85
|
graph->setMap(&grammar->terminals, &grammar->nonterminals);
|
|
79
|
-
graph->buildFromDot(Options::InputFilename);
|
|
86
|
+
graph->buildFromDot(Options::InputFilename);
|
|
80
87
|
}
|
|
81
88
|
graph->startSymbol = grammar->startSymbol;
|
|
82
89
|
solver = new CFLSolver(graph, grammar);
|
|
@@ -86,14 +93,16 @@ public:
|
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
/// Interface exposed to users of our pointer analysis, given Value infos
|
|
89
|
-
virtual AliasResult alias(const Value* v1, const Value* v2)
|
|
96
|
+
virtual AliasResult alias(const Value* v1, const Value* v2)
|
|
97
|
+
{
|
|
90
98
|
NodeID n1 = svfir->getValueNode(v1);
|
|
91
99
|
NodeID n2 = svfir->getValueNode(v2);
|
|
92
100
|
return alias(n1,n2);
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
/// Interface exposed to users of our pointer analysis, given PAGNodeID
|
|
96
|
-
virtual AliasResult alias(NodeID node1, NodeID node2)
|
|
104
|
+
virtual AliasResult alias(NodeID node1, NodeID node2)
|
|
105
|
+
{
|
|
97
106
|
/// TODO:: Fix the edge label for a reachable alias relation if it is not 1;
|
|
98
107
|
if(graph->hasEdge(graph->getGNode(node1), graph->getGNode(node2), graph->startSymbol))
|
|
99
108
|
return AliasResult::MayAlias;
|
|
@@ -102,14 +111,16 @@ public:
|
|
|
102
111
|
}
|
|
103
112
|
|
|
104
113
|
/// Get points-to targets of a pointer.
|
|
105
|
-
virtual const PointsTo& getPts(NodeID ptr)
|
|
114
|
+
virtual const PointsTo& getPts(NodeID ptr)
|
|
115
|
+
{
|
|
106
116
|
/// Check Outgoing edge Dst of ptr
|
|
107
117
|
//PointsTo * ps;
|
|
108
118
|
abort(); // to be implemented
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
/// Given an object, get all the nodes having whose pointsto contains the object
|
|
112
|
-
virtual const NodeSet& getRevPts(NodeID nodeId)
|
|
122
|
+
virtual const NodeSet& getRevPts(NodeID nodeId)
|
|
123
|
+
{
|
|
113
124
|
/// Check Outgoing flowtobar edge dst of ptr
|
|
114
125
|
abort(); // to be implemented
|
|
115
126
|
}
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
#ifndef CFLGrammar_H_
|
|
30
|
-
#define CFLGrammar_H_
|
|
30
|
+
#define CFLGrammar_H_
|
|
31
31
|
#include "Util/BasicTypes.h"
|
|
32
32
|
|
|
33
|
-
namespace SVF
|
|
33
|
+
namespace SVF
|
|
34
|
+
{
|
|
34
35
|
|
|
35
|
-
class GrammarBase
|
|
36
|
+
class GrammarBase
|
|
37
|
+
{
|
|
36
38
|
public:
|
|
37
39
|
typedef u32_t Symbol;
|
|
38
40
|
typedef std::vector<Symbol> Production;
|
|
@@ -41,10 +43,11 @@ public:
|
|
|
41
43
|
Map<std::string, Symbol> nonterminals;
|
|
42
44
|
|
|
43
45
|
Symbol str2Sym(std::string str) const;
|
|
44
|
-
|
|
46
|
+
|
|
45
47
|
std::string sym2Str(Symbol sym) const;
|
|
46
48
|
|
|
47
|
-
Symbol getSymbol(const Production& prod, u32_t pos)
|
|
49
|
+
Symbol getSymbol(const Production& prod, u32_t pos)
|
|
50
|
+
{
|
|
48
51
|
return prod.at(pos);
|
|
49
52
|
}
|
|
50
53
|
|
|
@@ -56,7 +59,8 @@ public:
|
|
|
56
59
|
Map<Symbol, Productions> rawProductions;
|
|
57
60
|
};
|
|
58
61
|
|
|
59
|
-
class CFLGrammar : public GrammarBase
|
|
62
|
+
class CFLGrammar : public GrammarBase
|
|
63
|
+
{
|
|
60
64
|
|
|
61
65
|
public:
|
|
62
66
|
Set<Production > epsilonProds;
|
|
@@ -66,52 +70,62 @@ public:
|
|
|
66
70
|
Symbol newTerminalSubscript;
|
|
67
71
|
CFLGrammar();
|
|
68
72
|
|
|
69
|
-
const Productions& getEpsilonProds() const
|
|
73
|
+
const Productions& getEpsilonProds() const
|
|
74
|
+
{
|
|
70
75
|
return epsilonProds;
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
const bool hasProdsFromFirstRHS(Symbol sym) const
|
|
78
|
+
const bool hasProdsFromFirstRHS(Symbol sym) const
|
|
79
|
+
{
|
|
74
80
|
auto it = firstRHS2Prods.find(sym);
|
|
75
81
|
return it!=firstRHS2Prods.end();
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
const bool hasProdsFromSingleRHS(Symbol sym) const
|
|
84
|
+
const bool hasProdsFromSingleRHS(Symbol sym) const
|
|
85
|
+
{
|
|
79
86
|
auto it = singleRHS2Prods.find(sym);
|
|
80
87
|
return it!=singleRHS2Prods.end();
|
|
81
88
|
}
|
|
82
89
|
|
|
83
|
-
const bool hasProdsFromSecondRHS(Symbol sym) const
|
|
90
|
+
const bool hasProdsFromSecondRHS(Symbol sym) const
|
|
91
|
+
{
|
|
84
92
|
auto it = secondRHS2Prods.find(sym);
|
|
85
93
|
return it!=secondRHS2Prods.end();
|
|
86
94
|
}
|
|
87
95
|
|
|
88
|
-
const Productions& getProdsFromSingleRHS(Symbol sym) const
|
|
96
|
+
const Productions& getProdsFromSingleRHS(Symbol sym) const
|
|
97
|
+
{
|
|
89
98
|
auto it = singleRHS2Prods.find(sym);
|
|
90
99
|
assert(it!=singleRHS2Prods.end() && "production (X -> sym) not found for sym!!");
|
|
91
100
|
return it->second;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
|
-
const Productions& getProdsFromFirstRHS(Symbol sym) const
|
|
103
|
+
const Productions& getProdsFromFirstRHS(Symbol sym) const
|
|
104
|
+
{
|
|
95
105
|
auto it = firstRHS2Prods.find(sym);
|
|
96
106
|
assert(it!=firstRHS2Prods.end() && "production (X -> sym Y) not found for sym!!");
|
|
97
107
|
return it->second;
|
|
98
108
|
}
|
|
99
109
|
|
|
100
|
-
const Productions& getProdsFromSecondRHS(Symbol sym) const
|
|
110
|
+
const Productions& getProdsFromSecondRHS(Symbol sym) const
|
|
111
|
+
{
|
|
101
112
|
auto it = secondRHS2Prods.find(sym);
|
|
102
113
|
assert(it!=secondRHS2Prods.end() && "production (X -> Y sym) not found for sym!!");
|
|
103
114
|
return it->second;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
|
-
Symbol getLHSSymbol(const Production& prod)
|
|
117
|
+
Symbol getLHSSymbol(const Production& prod)
|
|
118
|
+
{
|
|
107
119
|
return prod.at(0);
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
Symbol getFirstRHSSymbol(const Production& prod)
|
|
122
|
+
Symbol getFirstRHSSymbol(const Production& prod)
|
|
123
|
+
{
|
|
111
124
|
return prod.at(1);
|
|
112
125
|
}
|
|
113
126
|
|
|
114
|
-
Symbol getSecondRHSSymbol(const Production& prod)
|
|
127
|
+
Symbol getSecondRHSSymbol(const Production& prod)
|
|
128
|
+
{
|
|
115
129
|
return prod.at(2);
|
|
116
130
|
}
|
|
117
131
|
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
#include "Util/WorkList.h"
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
namespace SVF
|
|
35
|
+
namespace SVF
|
|
36
|
+
{
|
|
36
37
|
|
|
37
|
-
class CFLSolver
|
|
38
|
+
class CFLSolver
|
|
39
|
+
{
|
|
38
40
|
|
|
39
41
|
public:
|
|
40
42
|
/// Define worklist
|
|
@@ -54,12 +56,14 @@ public:
|
|
|
54
56
|
void solve();
|
|
55
57
|
|
|
56
58
|
/// Return CFL Graph
|
|
57
|
-
inline const CFLGraph* getGraph() const
|
|
59
|
+
inline const CFLGraph* getGraph() const
|
|
60
|
+
{
|
|
58
61
|
return graph;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
/// Return CFL Grammar
|
|
62
|
-
inline const CFLGrammar* getGrammar() const
|
|
65
|
+
inline const CFLGrammar* getGrammar() const
|
|
66
|
+
{
|
|
63
67
|
return grammar;
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -84,7 +88,7 @@ protected:
|
|
|
84
88
|
}
|
|
85
89
|
//@}
|
|
86
90
|
|
|
87
|
-
private:
|
|
91
|
+
private:
|
|
88
92
|
CFLGraph* graph;
|
|
89
93
|
CFLGrammar* grammar;
|
|
90
94
|
/// Worklist for resolution
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
#include "CFL/CFLGrammar.h"
|
|
32
32
|
#include "Graphs/CFLGraph.h"
|
|
33
33
|
|
|
34
|
-
namespace SVF
|
|
34
|
+
namespace SVF
|
|
35
|
+
{
|
|
35
36
|
|
|
36
37
|
/*!
|
|
37
38
|
* Build Grammar from a user specified grammar text
|
|
38
39
|
* Input Format:
|
|
39
40
|
* Start: // Special string 'epsilon' for empty RHS
|
|
40
|
-
* M // Specify Start Symbol in Second Line
|
|
41
|
+
* M // Specify Start Symbol in Second Line
|
|
41
42
|
* Productions: // Each Symbol seperate by 'Space', production end with ';'
|
|
42
43
|
* M -> V d; // Terminal in NonCapital
|
|
43
44
|
* M -> dbar V d; // NonTerminal in Capital
|
|
@@ -45,21 +46,23 @@ namespace SVF{
|
|
|
45
46
|
* V -> ( M ? abar ) * M ? ( a M ? ) *; // Support '(' ')' '?' '*' four regular expression sign
|
|
46
47
|
* Note:
|
|
47
48
|
* When provide EBNF form text (i.e Last production above),
|
|
48
|
-
* Please specify -ebnf flag, otherwise regular experssion sign will treat as NonTerminal.
|
|
49
|
+
* Please specify -ebnf flag, otherwise regular experssion sign will treat as NonTerminal.
|
|
49
50
|
*/
|
|
50
51
|
|
|
51
|
-
class GrammarBuilder
|
|
52
|
+
class GrammarBuilder
|
|
53
|
+
{
|
|
52
54
|
public:
|
|
53
55
|
std::string fileName;
|
|
54
56
|
GrammarBase *grammar;
|
|
55
57
|
|
|
56
|
-
GrammarBuilder(std::string fileName): fileName(fileName), grammar(nullptr)
|
|
58
|
+
GrammarBuilder(std::string fileName): fileName(fileName), grammar(nullptr)
|
|
59
|
+
{
|
|
57
60
|
grammar = new GrammarBase();
|
|
58
61
|
};
|
|
59
62
|
|
|
60
|
-
GrammarBase* build();
|
|
63
|
+
GrammarBase* build();
|
|
61
64
|
|
|
62
65
|
GrammarBase* build(Map<std::string, SVF::CFLGraph::Symbol> *preMap);
|
|
63
66
|
};
|
|
64
67
|
|
|
65
|
-
} // SVF
|
|
68
|
+
} // SVF
|
|
@@ -138,7 +138,8 @@ extern "C" {
|
|
|
138
138
|
Description [Type of reordering algorithm.]
|
|
139
139
|
|
|
140
140
|
******************************************************************************/
|
|
141
|
-
typedef enum
|
|
141
|
+
typedef enum
|
|
142
|
+
{
|
|
142
143
|
CUDD_REORDER_SAME,
|
|
143
144
|
CUDD_REORDER_NONE,
|
|
144
145
|
CUDD_REORDER_RANDOM,
|
|
@@ -171,7 +172,8 @@ typedef enum {
|
|
|
171
172
|
Description [Type of aggregation methods.]
|
|
172
173
|
|
|
173
174
|
******************************************************************************/
|
|
174
|
-
typedef enum
|
|
175
|
+
typedef enum
|
|
176
|
+
{
|
|
175
177
|
CUDD_NO_CHECK,
|
|
176
178
|
CUDD_GROUP_CHECK,
|
|
177
179
|
CUDD_GROUP_CHECK2,
|
|
@@ -192,7 +194,8 @@ typedef enum {
|
|
|
192
194
|
Description [Type of hooks.]
|
|
193
195
|
|
|
194
196
|
******************************************************************************/
|
|
195
|
-
typedef enum
|
|
197
|
+
typedef enum
|
|
198
|
+
{
|
|
196
199
|
CUDD_PRE_GC_HOOK,
|
|
197
200
|
CUDD_POST_GC_HOOK,
|
|
198
201
|
CUDD_PRE_REORDERING_HOOK,
|
|
@@ -207,7 +210,8 @@ typedef enum {
|
|
|
207
210
|
Description [Type of error codes.]
|
|
208
211
|
|
|
209
212
|
******************************************************************************/
|
|
210
|
-
typedef enum
|
|
213
|
+
typedef enum
|
|
214
|
+
{
|
|
211
215
|
CUDD_NO_ERROR,
|
|
212
216
|
CUDD_MEMORY_OUT,
|
|
213
217
|
CUDD_TOO_MANY_NODES,
|
|
@@ -225,7 +229,8 @@ typedef enum {
|
|
|
225
229
|
Description [Group type for lazy sifting.]
|
|
226
230
|
|
|
227
231
|
******************************************************************************/
|
|
228
|
-
typedef enum
|
|
232
|
+
typedef enum
|
|
233
|
+
{
|
|
229
234
|
CUDD_LAZY_NONE,
|
|
230
235
|
CUDD_LAZY_SOFT_GROUP,
|
|
231
236
|
CUDD_LAZY_HARD_GROUP,
|
|
@@ -240,7 +245,8 @@ typedef enum {
|
|
|
240
245
|
Description [Variable type. Currently used only in lazy sifting.]
|
|
241
246
|
|
|
242
247
|
******************************************************************************/
|
|
243
|
-
typedef enum
|
|
248
|
+
typedef enum
|
|
249
|
+
{
|
|
244
250
|
CUDD_VAR_PRIMARY_INPUT,
|
|
245
251
|
CUDD_VAR_PRESENT_STATE,
|
|
246
252
|
CUDD_VAR_NEXT_STATE
|
|
@@ -255,19 +261,22 @@ typedef unsigned short DdHalfWord;
|
|
|
255
261
|
|
|
256
262
|
typedef struct DdNode DdNode;
|
|
257
263
|
|
|
258
|
-
typedef struct DdChildren
|
|
264
|
+
typedef struct DdChildren
|
|
265
|
+
{
|
|
259
266
|
struct DdNode *T;
|
|
260
267
|
struct DdNode *E;
|
|
261
268
|
} DdChildren;
|
|
262
269
|
|
|
263
270
|
/* The DdNode structure is the only one exported out of the package */
|
|
264
|
-
struct DdNode
|
|
271
|
+
struct DdNode
|
|
272
|
+
{
|
|
265
273
|
DdHalfWord index;
|
|
266
274
|
DdHalfWord ref; /* reference count */
|
|
267
275
|
DdNode *next; /* next pointer for unique table */
|
|
268
|
-
union
|
|
269
|
-
|
|
270
|
-
|
|
276
|
+
union
|
|
277
|
+
{
|
|
278
|
+
CUDD_VALUE_TYPE value; /* for constant nodes */
|
|
279
|
+
DdChildren kids; /* for internal nodes */
|
|
271
280
|
} type;
|
|
272
281
|
};
|
|
273
282
|
|
|
@@ -101,7 +101,7 @@ extern "C" {
|
|
|
101
101
|
#define DD_MAXREF ((DdHalfWord) ~0)
|
|
102
102
|
|
|
103
103
|
#define DD_DEFAULT_RESIZE 10 /* how many extra variables */
|
|
104
|
-
|
|
104
|
+
/* should be added when resizing */
|
|
105
105
|
#define DD_MEM_CHUNK 1022
|
|
106
106
|
|
|
107
107
|
/* These definitions work for CUDD_VALUE_TYPE == double */
|
|
@@ -188,7 +188,7 @@ extern "C" {
|
|
|
188
188
|
#define DD_ADD_OUT_SUM_TAG 0x6e
|
|
189
189
|
#define DD_BDD_LEQ_UNLESS_TAG 0x82
|
|
190
190
|
#define DD_ADD_TRIANGLE_TAG 0x86
|
|
191
|
-
#define DD_BDD_MAX_EXP_TAG 0x8a
|
|
191
|
+
#define DD_BDD_MAX_EXP_TAG 0x8a
|
|
192
192
|
|
|
193
193
|
/* Generator constants. */
|
|
194
194
|
#define CUDD_GEN_CUBES 0
|
|
@@ -203,26 +203,32 @@ extern "C" {
|
|
|
203
203
|
/* Stucture declarations */
|
|
204
204
|
/*---------------------------------------------------------------------------*/
|
|
205
205
|
|
|
206
|
-
struct DdGen
|
|
206
|
+
struct DdGen
|
|
207
|
+
{
|
|
207
208
|
DdManager *manager;
|
|
208
209
|
int type;
|
|
209
210
|
int status;
|
|
210
|
-
union
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
211
|
+
union
|
|
212
|
+
{
|
|
213
|
+
struct
|
|
214
|
+
{
|
|
215
|
+
int *cube;
|
|
216
|
+
CUDD_VALUE_TYPE value;
|
|
217
|
+
} cubes;
|
|
218
|
+
struct
|
|
219
|
+
{
|
|
220
|
+
int *cube;
|
|
221
|
+
DdNode *ub;
|
|
222
|
+
} primes;
|
|
223
|
+
struct
|
|
224
|
+
{
|
|
225
|
+
int size;
|
|
226
|
+
} nodes;
|
|
222
227
|
} gen;
|
|
223
|
-
struct
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
struct
|
|
229
|
+
{
|
|
230
|
+
int sp;
|
|
231
|
+
DdNode **stack;
|
|
226
232
|
} stack;
|
|
227
233
|
DdNode *node;
|
|
228
234
|
};
|
|
@@ -237,7 +243,8 @@ struct DdGen {
|
|
|
237
243
|
** are passed the manager as argument; they should return 1 if
|
|
238
244
|
** successful and 0 otherwise.
|
|
239
245
|
*/
|
|
240
|
-
typedef struct DdHook
|
|
246
|
+
typedef struct DdHook /* hook list element */
|
|
247
|
+
{
|
|
241
248
|
DD_HFP f; /* function to be called */
|
|
242
249
|
struct DdHook *next; /* next element in the list */
|
|
243
250
|
} DdHook;
|
|
@@ -253,7 +260,8 @@ typedef unsigned int ptruint;
|
|
|
253
260
|
typedef DdNode *DdNodePtr;
|
|
254
261
|
|
|
255
262
|
/* Generic local cache item. */
|
|
256
|
-
typedef struct DdLocalCacheItem
|
|
263
|
+
typedef struct DdLocalCacheItem
|
|
264
|
+
{
|
|
257
265
|
DdNode *value;
|
|
258
266
|
#ifdef DD_CACHE_PROFILE
|
|
259
267
|
ptrint count;
|
|
@@ -262,7 +270,8 @@ typedef struct DdLocalCacheItem {
|
|
|
262
270
|
} DdLocalCacheItem;
|
|
263
271
|
|
|
264
272
|
/* Local cache. */
|
|
265
|
-
typedef struct DdLocalCache
|
|
273
|
+
typedef struct DdLocalCache
|
|
274
|
+
{
|
|
266
275
|
DdLocalCacheItem *item;
|
|
267
276
|
unsigned int itemsize;
|
|
268
277
|
unsigned int keysize;
|
|
@@ -277,7 +286,8 @@ typedef struct DdLocalCache {
|
|
|
277
286
|
} DdLocalCache;
|
|
278
287
|
|
|
279
288
|
/* Generic hash item. */
|
|
280
|
-
typedef struct DdHashItem
|
|
289
|
+
typedef struct DdHashItem
|
|
290
|
+
{
|
|
281
291
|
struct DdHashItem *next;
|
|
282
292
|
ptrint count;
|
|
283
293
|
DdNode *value;
|
|
@@ -285,7 +295,8 @@ typedef struct DdHashItem {
|
|
|
285
295
|
} DdHashItem;
|
|
286
296
|
|
|
287
297
|
/* Local hash table */
|
|
288
|
-
typedef struct DdHashTable
|
|
298
|
+
typedef struct DdHashTable
|
|
299
|
+
{
|
|
289
300
|
unsigned int keysize;
|
|
290
301
|
unsigned int itemsize;
|
|
291
302
|
DdHashItem **bucket;
|
|
@@ -298,7 +309,8 @@ typedef struct DdHashTable {
|
|
|
298
309
|
DdManager *manager;
|
|
299
310
|
} DdHashTable;
|
|
300
311
|
|
|
301
|
-
typedef struct DdCache
|
|
312
|
+
typedef struct DdCache
|
|
313
|
+
{
|
|
302
314
|
DdNode *f,*g; /* DDs */
|
|
303
315
|
ptruint h; /* either operator or DD */
|
|
304
316
|
DdNode *data; /* already constructed DD */
|
|
@@ -307,7 +319,8 @@ typedef struct DdCache {
|
|
|
307
319
|
#endif
|
|
308
320
|
} DdCache;
|
|
309
321
|
|
|
310
|
-
typedef struct DdSubtable
|
|
322
|
+
typedef struct DdSubtable /* subtable for one index */
|
|
323
|
+
{
|
|
311
324
|
DdNode **nodelist; /* hash table */
|
|
312
325
|
int shift; /* shift for hash function */
|
|
313
326
|
unsigned int slots; /* size of the hash table */
|
|
@@ -323,7 +336,8 @@ typedef struct DdSubtable { /* subtable for one index */
|
|
|
323
336
|
Cudd_LazyGroupType varToBeGrouped; /* tells what grouping to apply */
|
|
324
337
|
} DdSubtable;
|
|
325
338
|
|
|
326
|
-
struct DdManager
|
|
339
|
+
struct DdManager /* specialized DD symbol table */
|
|
340
|
+
{
|
|
327
341
|
/* Constants */
|
|
328
342
|
DdNode sentinel; /* for collision lists */
|
|
329
343
|
DdNode *one; /* constant 1 */
|
|
@@ -359,11 +373,11 @@ struct DdManager { /* specialized DD symbol table */
|
|
|
359
373
|
double gcFrac; /* gc when this fraction is dead */
|
|
360
374
|
int gcEnabled; /* gc is enabled */
|
|
361
375
|
unsigned int looseUpTo; /* slow growth beyond this limit */
|
|
362
|
-
|
|
376
|
+
/* (measured w.r.t. slots, not keys) */
|
|
363
377
|
unsigned int initSlots; /* initial size of a subtable */
|
|
364
378
|
DdNode **stack; /* stack for iterative procedures */
|
|
365
379
|
double allocated; /* number of nodes allocated */
|
|
366
|
-
|
|
380
|
+
/* (not during reordering) */
|
|
367
381
|
double reclaimed; /* number of nodes brought back from the dead */
|
|
368
382
|
int isolated; /* isolated projection functions */
|
|
369
383
|
int *perm; /* current variable perm. (index to level) */
|
|
@@ -466,7 +480,8 @@ struct DdManager { /* specialized DD symbol table */
|
|
|
466
480
|
#endif
|
|
467
481
|
};
|
|
468
482
|
|
|
469
|
-
typedef struct Move
|
|
483
|
+
typedef struct Move
|
|
484
|
+
{
|
|
470
485
|
DdHalfWord x;
|
|
471
486
|
DdHalfWord y;
|
|
472
487
|
unsigned int flags;
|
|
@@ -475,14 +490,16 @@ typedef struct Move {
|
|
|
475
490
|
} Move;
|
|
476
491
|
|
|
477
492
|
/* Generic level queue item. */
|
|
478
|
-
typedef struct DdQueueItem
|
|
493
|
+
typedef struct DdQueueItem
|
|
494
|
+
{
|
|
479
495
|
struct DdQueueItem *next;
|
|
480
496
|
struct DdQueueItem *cnext;
|
|
481
497
|
void *key;
|
|
482
498
|
} DdQueueItem;
|
|
483
499
|
|
|
484
500
|
/* Level queue. */
|
|
485
|
-
typedef struct DdLevelQueue
|
|
501
|
+
typedef struct DdLevelQueue
|
|
502
|
+
{
|
|
486
503
|
void *first;
|
|
487
504
|
DdQueueItem **last;
|
|
488
505
|
DdQueueItem *freelist;
|