Skip to content

Commit

Permalink
[PM] Remove the underspecified 'getRoot' method from CallGraph. It's
Browse files Browse the repository at this point in the history
only user was an ancient SCC printing bit of the opt tool which really
should be walking the call graph the same way the CGSCC pass manager
does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195800 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chandlerc committed Nov 27, 2013
1 parent 823c9c7 commit df13080
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions include/llvm/Analysis/CallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ class CallGraph {

CallGraphNode *getCallsExternalNode() const { return CallsExternalNode; }

/// \brief Returns the root/main method in the module, or some other root
/// node, such as the externalcallingnode.
CallGraphNode *getRoot() { return Root; }
const CallGraphNode *getRoot() const { return Root; }

//===---------------------------------------------------------------------
// Functions to keep a call graph up to date with a function that has been
// modified.
Expand Down Expand Up @@ -342,11 +337,6 @@ class CallGraphWrapperPass : public ModulePass {
return G->getCallsExternalNode();
}

/// \brief Returns the root/main method in the module, or some other root
/// node, such as the externalcallingnode.
CallGraphNode *getRoot() { return G->getRoot(); }
const CallGraphNode *getRoot() const { return G->getRoot(); }

//===---------------------------------------------------------------------
// Functions to keep a call graph up to date with a function that has been
// modified.
Expand Down
6 changes: 3 additions & 3 deletions tools/opt/PrintSCC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ bool CFGSCC::runOnFunction(Function &F) {

// run - Print out SCCs in the call graph for the specified module.
bool CallGraphSCC::runOnModule(Module &M) {
CallGraphNode *rootNode = getAnalysis<CallGraphWrapperPass>().getRoot();
CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
unsigned sccNum = 0;
errs() << "SCCs for the program in PostOrder:";
for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode),
E = scc_end(rootNode); SCCI != E; ++SCCI) {
for (scc_iterator<CallGraph*> SCCI = scc_begin(&CG),
E = scc_end(&CG); SCCI != E; ++SCCI) {
const std::vector<CallGraphNode*> &nextSCC = *SCCI;
errs() << "\nSCC #" << ++sccNum << " : ";
for (std::vector<CallGraphNode*>::const_iterator I = nextSCC.begin(),
Expand Down

0 comments on commit df13080

Please sign in to comment.