Restore the library dependency of LLVMgold on LTO; this was removed recently but
[oota-llvm.git] / tools / opt / PrintSCC.cpp
index 11efdcdfd22637886e8aaa0b66533e1a907aeae2..9322cbceec3241463fc72214178803b01e12ff77 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Pass.h"
-#include "llvm/Module.h"
+#include "llvm/ADT/SCCIterator.h"
 #include "llvm/Analysis/CallGraph.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/ADT/SCCIterator.h"
 using namespace llvm;
 
 namespace {
@@ -58,7 +58,7 @@ namespace {
     // getAnalysisUsage - This pass requires the CallGraph.
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
-      AU.addRequired<CallGraph>();
+      AU.addRequired<CallGraphWrapperPass>();
     }
   };
 }
@@ -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<CallGraph>().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(),