svf-lib 1.0.839 → 1.0.843
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/Graphs/ICFG.h +1 -1
- package/SVF-linux/include/Graphs/ICFGEdge.h +39 -17
- package/SVF-linux/include/Graphs/ICFGNode.h +1 -1
- package/SVF-linux/include/MemoryModel/SVFStatements.h +2 -11
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +3 -1
- 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/Graphs/ICFG.h +1 -1
- package/SVF-osx/include/Graphs/ICFGEdge.h +39 -17
- package/SVF-osx/include/Graphs/ICFGNode.h +1 -1
- package/SVF-osx/include/MemoryModel/SVFStatements.h +2 -11
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +3 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -128,7 +128,7 @@ protected:
|
|
|
128
128
|
/// Add control-flow edges for top level pointers
|
|
129
129
|
//@{
|
|
130
130
|
ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
131
|
-
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Value* condition,
|
|
131
|
+
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Value* condition, s64_t branchCondVal);
|
|
132
132
|
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
|
|
133
133
|
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
|
|
134
134
|
//@}
|
|
@@ -34,6 +34,8 @@ namespace SVF
|
|
|
34
34
|
{
|
|
35
35
|
|
|
36
36
|
class ICFGNode;
|
|
37
|
+
class CallPE;
|
|
38
|
+
class RetPE;
|
|
37
39
|
|
|
38
40
|
/*!
|
|
39
41
|
* Interprocedural control-flow and value-flow edge, representing the control- and value-flow dependence between two nodes
|
|
@@ -112,15 +114,8 @@ class IntraCFGEdge : public ICFGEdge
|
|
|
112
114
|
{
|
|
113
115
|
|
|
114
116
|
public:
|
|
115
|
-
/// the first element is a boolean (for if/else) or numeric condition value (for switch)
|
|
116
|
-
/// the second element is the value when this condition should hold to execute this CFGEdge.
|
|
117
|
-
/// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
|
|
118
|
-
/// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
|
|
119
|
-
|
|
120
|
-
typedef std::pair<const Value*,NodeID> BranchCondition;
|
|
121
|
-
|
|
122
117
|
/// Constructor
|
|
123
|
-
IntraCFGEdge(ICFGNode* s, ICFGNode* d): ICFGEdge(s,d,IntraCF)
|
|
118
|
+
IntraCFGEdge(ICFGNode* s, ICFGNode* d): ICFGEdge(s,d,IntraCF), conditionVar(nullptr), branchCondVal(0)
|
|
124
119
|
{
|
|
125
120
|
}
|
|
126
121
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -139,23 +134,31 @@ public:
|
|
|
139
134
|
}
|
|
140
135
|
//@}
|
|
141
136
|
|
|
142
|
-
const
|
|
143
|
-
return
|
|
137
|
+
const Value* getCondition() const{
|
|
138
|
+
return conditionVar;
|
|
144
139
|
}
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
const s64_t getSuccessorCondValue() const{
|
|
142
|
+
assert(getCondition() && "this is not a conditional branch edge");
|
|
143
|
+
return branchCondVal;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
void setBranchCondition(const Value* c, s64_t bVal){
|
|
147
|
+
conditionVar = c;
|
|
148
|
+
branchCondVal = bVal;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
virtual const std::string toString() const;
|
|
151
152
|
|
|
152
153
|
private:
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
/// conditionVar is a boolean (for if/else) or numeric condition variable (for switch)
|
|
155
|
+
/// branchCondVal is the value when this condition should hold to execute this CFGEdge.
|
|
156
|
+
/// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
|
|
157
|
+
/// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
|
|
158
|
+
const Value* conditionVar;
|
|
159
|
+
s64_t branchCondVal;
|
|
155
160
|
};
|
|
156
161
|
|
|
157
|
-
|
|
158
|
-
|
|
159
162
|
/*!
|
|
160
163
|
* Call ICFG edge representing parameter passing/return from a caller to a callee
|
|
161
164
|
*/
|
|
@@ -164,6 +167,7 @@ class CallCFGEdge : public ICFGEdge
|
|
|
164
167
|
|
|
165
168
|
private:
|
|
166
169
|
const Instruction* cs;
|
|
170
|
+
std::vector<const CallPE*> callPEs;
|
|
167
171
|
public:
|
|
168
172
|
/// Constructor
|
|
169
173
|
CallCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
|
|
@@ -175,6 +179,14 @@ public:
|
|
|
175
179
|
{
|
|
176
180
|
return cs;
|
|
177
181
|
}
|
|
182
|
+
/// Add call parameter edge to this CallCFGEdge
|
|
183
|
+
inline void addCallPE(const CallPE* callPE){
|
|
184
|
+
callPEs.push_back(callPE);
|
|
185
|
+
}
|
|
186
|
+
/// Add get parameter edge to this CallCFGEdge
|
|
187
|
+
inline const std::vector<const CallPE*>& getCallPEs() const{
|
|
188
|
+
return callPEs;
|
|
189
|
+
}
|
|
178
190
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
179
191
|
//@{
|
|
180
192
|
static inline bool classof(const CallCFGEdge *)
|
|
@@ -201,10 +213,11 @@ class RetCFGEdge : public ICFGEdge
|
|
|
201
213
|
|
|
202
214
|
private:
|
|
203
215
|
const Instruction* cs;
|
|
216
|
+
const RetPE* retPE;
|
|
204
217
|
public:
|
|
205
218
|
/// Constructor
|
|
206
219
|
RetCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
|
|
207
|
-
ICFGEdge(s,d,RetCF),cs(c)
|
|
220
|
+
ICFGEdge(s,d,RetCF),cs(c),retPE(nullptr)
|
|
208
221
|
{
|
|
209
222
|
}
|
|
210
223
|
/// Return callsite ID
|
|
@@ -212,6 +225,15 @@ public:
|
|
|
212
225
|
{
|
|
213
226
|
return cs;
|
|
214
227
|
}
|
|
228
|
+
/// Add call parameter edge to this CallCFGEdge
|
|
229
|
+
inline void addRetPE(const RetPE* ret){
|
|
230
|
+
assert(retPE==nullptr && "we can only have one retPE for each RetCFGEdge");
|
|
231
|
+
retPE = ret;
|
|
232
|
+
}
|
|
233
|
+
/// Add get parameter edge to this CallCFGEdge
|
|
234
|
+
inline const RetPE* getRetPE() const{
|
|
235
|
+
return retPE;
|
|
236
|
+
}
|
|
215
237
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
216
238
|
//@{
|
|
217
239
|
static inline bool classof(const RetCFGEdge *)
|
|
@@ -639,15 +639,6 @@ public:
|
|
|
639
639
|
{
|
|
640
640
|
return SVFStmt::getDstNode();
|
|
641
641
|
}
|
|
642
|
-
/// Return the position of this op
|
|
643
|
-
const u32_t getOpPos(const SVFVar* op) const{
|
|
644
|
-
for(u32_t i = 0; i < getOpVarNum(); i++){
|
|
645
|
-
if(getOpVar(i)==op)
|
|
646
|
-
return i;
|
|
647
|
-
}
|
|
648
|
-
assert(false && "this operand not found!");
|
|
649
|
-
abort();
|
|
650
|
-
}
|
|
651
642
|
|
|
652
643
|
NodeID getOpVarID(u32_t pos) const;
|
|
653
644
|
NodeID getResID() const;
|
|
@@ -718,8 +709,8 @@ public:
|
|
|
718
709
|
}
|
|
719
710
|
|
|
720
711
|
/// Return the corresponding ICFGNode of this operand
|
|
721
|
-
inline const ICFGNode* getOpICFGNode(
|
|
722
|
-
return opICFGNodes.at(
|
|
712
|
+
inline const ICFGNode* getOpICFGNode(u32_t op_idx) const{
|
|
713
|
+
return opICFGNodes.at(op_idx);
|
|
723
714
|
}
|
|
724
715
|
|
|
725
716
|
/// Return true if this is a phi at the function exit
|
|
@@ -309,7 +309,9 @@ public:
|
|
|
309
309
|
inline PhiStmt* addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
|
|
310
310
|
{
|
|
311
311
|
PhiStmt *edge = pag->addPhiStmt(res,opnd,pred);
|
|
312
|
-
|
|
312
|
+
/// If we already added this phi node, then skip this adding
|
|
313
|
+
if(edge)
|
|
314
|
+
setCurrentBBAndValueForPAGEdge(edge);
|
|
313
315
|
return edge;
|
|
314
316
|
}
|
|
315
317
|
/// Add SelectStmt
|
|
Binary file
|
|
Binary file
|
|
@@ -128,7 +128,7 @@ protected:
|
|
|
128
128
|
/// Add control-flow edges for top level pointers
|
|
129
129
|
//@{
|
|
130
130
|
ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
131
|
-
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Value* condition,
|
|
131
|
+
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Value* condition, s64_t branchCondVal);
|
|
132
132
|
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
|
|
133
133
|
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
|
|
134
134
|
//@}
|
|
@@ -34,6 +34,8 @@ namespace SVF
|
|
|
34
34
|
{
|
|
35
35
|
|
|
36
36
|
class ICFGNode;
|
|
37
|
+
class CallPE;
|
|
38
|
+
class RetPE;
|
|
37
39
|
|
|
38
40
|
/*!
|
|
39
41
|
* Interprocedural control-flow and value-flow edge, representing the control- and value-flow dependence between two nodes
|
|
@@ -112,15 +114,8 @@ class IntraCFGEdge : public ICFGEdge
|
|
|
112
114
|
{
|
|
113
115
|
|
|
114
116
|
public:
|
|
115
|
-
/// the first element is a boolean (for if/else) or numeric condition value (for switch)
|
|
116
|
-
/// the second element is the value when this condition should hold to execute this CFGEdge.
|
|
117
|
-
/// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
|
|
118
|
-
/// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
|
|
119
|
-
|
|
120
|
-
typedef std::pair<const Value*,NodeID> BranchCondition;
|
|
121
|
-
|
|
122
117
|
/// Constructor
|
|
123
|
-
IntraCFGEdge(ICFGNode* s, ICFGNode* d): ICFGEdge(s,d,IntraCF)
|
|
118
|
+
IntraCFGEdge(ICFGNode* s, ICFGNode* d): ICFGEdge(s,d,IntraCF), conditionVar(nullptr), branchCondVal(0)
|
|
124
119
|
{
|
|
125
120
|
}
|
|
126
121
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -139,23 +134,31 @@ public:
|
|
|
139
134
|
}
|
|
140
135
|
//@}
|
|
141
136
|
|
|
142
|
-
const
|
|
143
|
-
return
|
|
137
|
+
const Value* getCondition() const{
|
|
138
|
+
return conditionVar;
|
|
144
139
|
}
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
const s64_t getSuccessorCondValue() const{
|
|
142
|
+
assert(getCondition() && "this is not a conditional branch edge");
|
|
143
|
+
return branchCondVal;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
void setBranchCondition(const Value* c, s64_t bVal){
|
|
147
|
+
conditionVar = c;
|
|
148
|
+
branchCondVal = bVal;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
virtual const std::string toString() const;
|
|
151
152
|
|
|
152
153
|
private:
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
/// conditionVar is a boolean (for if/else) or numeric condition variable (for switch)
|
|
155
|
+
/// branchCondVal is the value when this condition should hold to execute this CFGEdge.
|
|
156
|
+
/// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
|
|
157
|
+
/// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
|
|
158
|
+
const Value* conditionVar;
|
|
159
|
+
s64_t branchCondVal;
|
|
155
160
|
};
|
|
156
161
|
|
|
157
|
-
|
|
158
|
-
|
|
159
162
|
/*!
|
|
160
163
|
* Call ICFG edge representing parameter passing/return from a caller to a callee
|
|
161
164
|
*/
|
|
@@ -164,6 +167,7 @@ class CallCFGEdge : public ICFGEdge
|
|
|
164
167
|
|
|
165
168
|
private:
|
|
166
169
|
const Instruction* cs;
|
|
170
|
+
std::vector<const CallPE*> callPEs;
|
|
167
171
|
public:
|
|
168
172
|
/// Constructor
|
|
169
173
|
CallCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
|
|
@@ -175,6 +179,14 @@ public:
|
|
|
175
179
|
{
|
|
176
180
|
return cs;
|
|
177
181
|
}
|
|
182
|
+
/// Add call parameter edge to this CallCFGEdge
|
|
183
|
+
inline void addCallPE(const CallPE* callPE){
|
|
184
|
+
callPEs.push_back(callPE);
|
|
185
|
+
}
|
|
186
|
+
/// Add get parameter edge to this CallCFGEdge
|
|
187
|
+
inline const std::vector<const CallPE*>& getCallPEs() const{
|
|
188
|
+
return callPEs;
|
|
189
|
+
}
|
|
178
190
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
179
191
|
//@{
|
|
180
192
|
static inline bool classof(const CallCFGEdge *)
|
|
@@ -201,10 +213,11 @@ class RetCFGEdge : public ICFGEdge
|
|
|
201
213
|
|
|
202
214
|
private:
|
|
203
215
|
const Instruction* cs;
|
|
216
|
+
const RetPE* retPE;
|
|
204
217
|
public:
|
|
205
218
|
/// Constructor
|
|
206
219
|
RetCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
|
|
207
|
-
ICFGEdge(s,d,RetCF),cs(c)
|
|
220
|
+
ICFGEdge(s,d,RetCF),cs(c),retPE(nullptr)
|
|
208
221
|
{
|
|
209
222
|
}
|
|
210
223
|
/// Return callsite ID
|
|
@@ -212,6 +225,15 @@ public:
|
|
|
212
225
|
{
|
|
213
226
|
return cs;
|
|
214
227
|
}
|
|
228
|
+
/// Add call parameter edge to this CallCFGEdge
|
|
229
|
+
inline void addRetPE(const RetPE* ret){
|
|
230
|
+
assert(retPE==nullptr && "we can only have one retPE for each RetCFGEdge");
|
|
231
|
+
retPE = ret;
|
|
232
|
+
}
|
|
233
|
+
/// Add get parameter edge to this CallCFGEdge
|
|
234
|
+
inline const RetPE* getRetPE() const{
|
|
235
|
+
return retPE;
|
|
236
|
+
}
|
|
215
237
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
216
238
|
//@{
|
|
217
239
|
static inline bool classof(const RetCFGEdge *)
|
|
@@ -639,15 +639,6 @@ public:
|
|
|
639
639
|
{
|
|
640
640
|
return SVFStmt::getDstNode();
|
|
641
641
|
}
|
|
642
|
-
/// Return the position of this op
|
|
643
|
-
const u32_t getOpPos(const SVFVar* op) const{
|
|
644
|
-
for(u32_t i = 0; i < getOpVarNum(); i++){
|
|
645
|
-
if(getOpVar(i)==op)
|
|
646
|
-
return i;
|
|
647
|
-
}
|
|
648
|
-
assert(false && "this operand not found!");
|
|
649
|
-
abort();
|
|
650
|
-
}
|
|
651
642
|
|
|
652
643
|
NodeID getOpVarID(u32_t pos) const;
|
|
653
644
|
NodeID getResID() const;
|
|
@@ -718,8 +709,8 @@ public:
|
|
|
718
709
|
}
|
|
719
710
|
|
|
720
711
|
/// Return the corresponding ICFGNode of this operand
|
|
721
|
-
inline const ICFGNode* getOpICFGNode(
|
|
722
|
-
return opICFGNodes.at(
|
|
712
|
+
inline const ICFGNode* getOpICFGNode(u32_t op_idx) const{
|
|
713
|
+
return opICFGNodes.at(op_idx);
|
|
723
714
|
}
|
|
724
715
|
|
|
725
716
|
/// Return true if this is a phi at the function exit
|
|
@@ -309,7 +309,9 @@ public:
|
|
|
309
309
|
inline PhiStmt* addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
|
|
310
310
|
{
|
|
311
311
|
PhiStmt *edge = pag->addPhiStmt(res,opnd,pred);
|
|
312
|
-
|
|
312
|
+
/// If we already added this phi node, then skip this adding
|
|
313
|
+
if(edge)
|
|
314
|
+
setCurrentBBAndValueForPAGEdge(edge);
|
|
313
315
|
return edge;
|
|
314
316
|
}
|
|
315
317
|
/// Add SelectStmt
|