Skip to content

Commit 63c0e59

Browse files
authored
Merge pull request #59 from bjjwwang/0411
Fix CallPE API breakage: adapt to phi-like MultiOpndStmt refactor
2 parents a124e47 + a411074 commit 63c0e59

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

Assignment-3/CPP/Assignment_3.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,23 @@ void AbstractExecution::updateStateOnCmp(const CmpStmt* cmp) {
254254
}
255255
}
256256

257-
/// Abstract state updates on an CallPE
258-
void AbstractExecution::updateStateOnCall(const CallPE* call) {
259-
const ICFGNode* node = call->getICFGNode();
257+
/// Abstract state updates on an CallPE (phi-like: formal = join(actual1@cs1, actual2@cs2, ...))
258+
void AbstractExecution::updateStateOnCall(const CallPE* callPE) {
259+
const ICFGNode* node = callPE->getICFGNode();
260260
AbstractState& as = getAbsStateFromTrace(node);
261-
NodeID lhs = call->getLHSVarID();
262-
NodeID rhs = call->getRHSVarID();
263-
as[lhs] = as[rhs];
261+
NodeID res = callPE->getResID();
262+
AbstractValue rhs;
263+
for (u32_t i = 0; i < callPE->getOpVarNum(); i++)
264+
{
265+
NodeID curId = callPE->getOpVarID(i);
266+
const ICFGNode* opICFGNode = callPE->getOpCallICFGNode(i);
267+
if (postAbsTrace.count(opICFGNode))
268+
{
269+
AbstractState& opAs = postAbsTrace[opICFGNode];
270+
rhs.join_with(opAs[curId]);
271+
}
272+
}
273+
as[res] = rhs;
264274
}
265275

266276
/// Abstract state updates on an RetPE

0 commit comments

Comments
 (0)