8000 simplify PR 1640 by bjjwwang · Pull Request #1645 · SVF-tools/SVF · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

simplify PR 1640 #1645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions svf/include/Graphs/SCC.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,17 @@ class SCCDetection
return _T;
}

inline const GNodeStack& topoNodeStack() const
{
return _T;
}

/// Return a handle to the stack of nodes in reverse topological
/// order. This will be used to seed the initial solution
/// and improve efficiency.
inline GNodeStack revTopoNodeStack()
inline FIFOWorkList<NodeID> revTopoNodeStack() const
{
GNodeStack revTopoOrder;
FIFOWorkList<NodeID> revTopoOrder;
GNodeStack topoOrder = topoNodeStack();
while(!topoOrder.empty())
{
Expand Down
2 changes: 0 additions & 2 deletions svf/include/MSSA/MemRegion.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ class MRGenerator
/// Get all the objects in callee's modref escaped via global objects (the chain pts of globals)
void getEscapObjviaGlobals(NodeBS& globs, const NodeBS& pts);

/// Get reverse topo call graph scc
void getCallGraphSCCRevTopoOrder(WorkList& worklist);

protected:
MRGenerator(BVDataPTAImpl* p, bool ptrOnly);
Expand Down
4 changes: 2 additions & 2 deletions svf/include/WPA/WPAFSSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class WPAFSSolver : public WPASolver<GraphType>

/// Both rep and sub nodes need to be processed later.
/// Collect sub nodes from SCCDetector.
NodeStack revTopoStack = this->getSCCDetector()->revTopoNodeStack();
FIFOWorkList<NodeID> revTopoStack = this->getSCCDetector()->revTopoNodeStack();
while (!revTopoStack.empty())
{
NodeID nodeId = revTopoStack.top();
NodeID nodeId = revTopoStack.front();
revTopoStack.pop();
const NodeBS& subNodes = this->getSCCDetector()->subNodes(nodeId);
for (NodeBS::iterator it = subNodes.begin(), eit = subNodes.end(); it != eit; ++it)
Expand Down
20 changes: 3 additions & 17 deletions svf/lib/MSSA/MemRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ void MRGenerator::collectModRefForCall()

DBOUT(DGENERAL, outs() << pasMsg("\t\tPerform Callsite Mod-Ref \n"));

WorkList worklist;
getCallGraphSCCRevTopoOrder(worklist);
WorkList worklist = callGraphSCC->revTopoNodeStack();

while(!worklist.empty())
{
NodeID callGraphNodeID = worklist.pop();
NodeID callGraphNodeID = worklist.front();
worklist.pop();
/// handle all sub scc nodes of this rep node
const NodeBS& subNodes = callGraphSCC->subNodes(callGraphNodeID);
for(NodeBS::iterator it = subNodes.begin(), eit = subNodes.end(); it!=eit; ++it)
Expand Down Expand Up @@ -456,20 +456,6 @@ bool MRGenerator::addModSideEffectOfCallSite(const CallICFGNode* cs, const NodeB
}


/*!
* Get the reverse topo order of scc call graph
*/
void MRGenerator::getCallGraphSCCRevTopoOrder(WorkList& worklist)
{
NodeStack revTopoNodeStack = callGraphSCC->revTopoNodeStack();
while(!revTopoNodeStack.empty())
{
NodeID callgraphNodeID = revTopoNodeStack.top();
revTopoNodeStack.pop();
worklist.push(callgraphNodeID);
}
}

/*!
* Get all objects might pass into and pass out of callee(s) from a callsite
*/
Expand Down
10 changes: 5 additions & 5 deletions svf/lib/WPA/Andersen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,12 @@ inline void Andersen::collapseFields()
*/
void Andersen::mergeSccCycle()
{
NodeStack revTopoOrder = getSCCDetector()->revTopoNodeStack();
while (!revTopoOrder.empty())
{
NodeID repNodeId = revTopoOrder.top();
revTopoOrder.pop();
NodeStack topoOrder = getSCCDetector()->topoNodeStack();

while (!topoOrder.empty())
{
NodeID repNodeId = topoOrder.top();
topoOrder.pop();
const NodeBS& subNodes = getSCCDetector()->subNodes(repNodeId);
// merge sub nodes to rep node
mergeSccNodes(repNodeId, subNodes);
Expand Down
Loading
0