//===- CallGraphSCCPass.cpp - Pass that operates BU on call graph ---------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file implements the CallGraphSCCPass class, which is used for passes
// which are implemented as bottom-up traversals on the call graph. Because
#include "llvm/CallGraphSCCPass.h"
#include "llvm/Analysis/CallGraph.h"
-#include "Support/TarjanSCCIterator.h"
+#include "llvm/ADT/SCCIterator.h"
+using namespace llvm;
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
AU.addPreserved<CallGraph>();
}
-bool CallGraphSCCPass::run(Module &M) {
+bool CallGraphSCCPass::runOnModule(Module &M) {
CallGraph &CG = getAnalysis<CallGraph>();
- bool Changed = false;
- for (TarjanSCC_iterator<CallGraph*> I = tarj_begin(&CG), E = tarj_end(&CG);
+ bool Changed = doInitialization(CG);
+ for (scc_iterator<CallGraph*> I = scc_begin(&CG), E = scc_end(&CG);
I != E; ++I)
Changed = runOnSCC(*I);
- return Changed;
+ return Changed | doFinalization(CG);
}