//===- PrintSCC.cpp - Enumerate SCCs in some key graphs -------------------===//
+//
+// 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 provides passes to print out SCCs in a CFG or a CallGraph.
// Normally, you would not use these passes; instead, you would use the
#include "llvm/Module.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Support/CFG.h"
-#include "Support/SCCIterator.h"
+#include "llvm/ADT/SCCIterator.h"
+#include <iostream>
+using namespace llvm;
namespace {
struct CFGSCC : public FunctionPass {
bool runOnFunction(Function& func);
- void print(std::ostream &O) const { }
+ void print(std::ostream &O, const Module* = 0) const { }
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
};
- struct CallGraphSCC : public Pass {
+ struct CallGraphSCC : public ModulePass {
// run - Print out SCCs in the call graph for the specified module.
- bool run(Module &M);
+ bool runOnModule(Module &M);
- void print(std::ostream &O) const { }
+ void print(std::ostream &O, const Module* = 0) const { }
// getAnalysisUsage - This pass requires the CallGraph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
// run - Print out SCCs in the call graph for the specified module.
-bool CallGraphSCC::run(Module &M) {
+bool CallGraphSCC::runOnModule(Module &M) {
CallGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
unsigned sccNum = 0;
std::cout << "SCCs for the program in PostOrder:";