Skip to content

Commit

Permalink
MSSA: allocate mssa on heap instead of a local instance. Leave a rele…
Browse files Browse the repository at this point in the history
…aseMemory to be called by users
  • Loading branch information
yuleisui committed Apr 29, 2017
1 parent 14d9b9f commit f752075
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/MSSA/SVFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class SVFG : public GenericSVFGGraphTy {

/// Clear MSSA
inline void clearMSSA() {
delete mssa;
mssa = NULL;
}

Expand Down
15 changes: 8 additions & 7 deletions lib/MSSA/SVFGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void SVFGBuilder::releaseMemory(SVFG* vfg) {
*/
bool SVFGBuilder::build(SVFG* graph,BVDataPTAImpl* pta) {

MemSSA mssa(pta);
MemSSA* mssa = new MemSSA(pta);

DBOUT(DGENERAL, outs() << pasMsg("Build Memory SSA \n"));

Expand All @@ -102,20 +102,21 @@ bool SVFGBuilder::build(SVFG* graph,BVDataPTAImpl* pta) {
dt.recalculate(fun);
df.runOnDT(dt);

mssa.buildMemSSA(fun, &df, &dt);
mssa->buildMemSSA(fun, &df, &dt);
}

mssa.performStat();
mssa.dumpMSSA();
mssa->performStat();
mssa->dumpMSSA();

DBOUT(DGENERAL, outs() << pasMsg("Build Sparse Value-Flow Graph \n"));

createSVFG(&mssa, graph);
createSVFG(mssa, graph);

if(SVFGWithIndirectCall || SVFGWithIndCall)
updateCallGraph(mssa.getPTA());
updateCallGraph(mssa->getPTA());

releaseMemory(graph);
//delete MSSA when required (on-call)
//releaseMemory(graph);

return false;
}
Expand Down

0 comments on commit f752075

Please sign in to comment.