aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/IPA
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-16 21:43:55 +0000
committerChris Lattner <sabre@nondot.org>2010-04-16 21:43:55 +0000
commitc93760c3e55db7e5fadbbf0f75fa3587cd8bb9dc (patch)
treef3b68371cd40fe189005312209af8c0284d63834 /lib/Analysis/IPA
parentaef1fea3d38f6793101c96961881eda85adbe1af (diff)
downloadexternal_llvm-c93760c3e55db7e5fadbbf0f75fa3587cd8bb9dc.zip
external_llvm-c93760c3e55db7e5fadbbf0f75fa3587cd8bb9dc.tar.gz
external_llvm-c93760c3e55db7e5fadbbf0f75fa3587cd8bb9dc.tar.bz2
move PrintCallGraphPass out of the middle of CGPassManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101543 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA')
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp76
1 files changed, 43 insertions, 33 deletions
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index fb08041..8a2c03a 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -87,39 +87,10 @@ private:
bool IsCheckingMode);
};
-/// PrintCallGraphPass - Print a Module corresponding to a call graph.
-///
-class PrintCallGraphPass : public CallGraphSCCPass {
-private:
- std::string Banner;
- raw_ostream &Out; // raw_ostream to print on.
-
-public:
- static char ID;
- PrintCallGraphPass() : CallGraphSCCPass(&ID), Out(dbgs()) {}
- PrintCallGraphPass(const std::string &B, raw_ostream &o)
- : CallGraphSCCPass(&ID), Banner(B), Out(o) {}
-
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- }
-
- bool runOnSCC(std::vector<CallGraphNode *> &SCC) {
- Out << Banner;
- for (std::vector<CallGraphNode *>::iterator n = SCC.begin(), ne = SCC.end();
- n != ne;
- ++n) {
- (*n)->getFunction()->print(Out);
- }
- return false;
- }
-};
-
} // end anonymous namespace.
char CGPassManager::ID = 0;
-char PrintCallGraphPass::ID = 0;
bool CGPassManager::RunPassOnSCC(Pass *P, std::vector<CallGraphNode*> &CurSCC,
CallGraph &CG, bool &CallGraphUpToDate) {
@@ -426,10 +397,9 @@ bool CGPassManager::doFinalization(CallGraph &CG) {
return Changed;
}
-Pass *CallGraphSCCPass::createPrinterPass(raw_ostream &O,
- const std::string &Banner) const {
- return new PrintCallGraphPass(Banner, O);
-}
+//===----------------------------------------------------------------------===//
+// CallGraphSCCPass Implementation
+//===----------------------------------------------------------------------===//
/// Assign pass manager to manage this pass.
void CallGraphSCCPass::assignPassManager(PMStack &PMS,
@@ -475,3 +445,43 @@ void CallGraphSCCPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<CallGraph>();
AU.addPreserved<CallGraph>();
}
+
+
+//===----------------------------------------------------------------------===//
+// PrintCallGraphPass Implementation
+//===----------------------------------------------------------------------===//
+
+namespace {
+ /// PrintCallGraphPass - Print a Module corresponding to a call graph.
+ ///
+ class PrintCallGraphPass : public CallGraphSCCPass {
+ std::string Banner;
+ raw_ostream &Out; // raw_ostream to print on.
+
+ public:
+ static char ID;
+ PrintCallGraphPass() : CallGraphSCCPass(&ID), Out(dbgs()) {}
+ PrintCallGraphPass(const std::string &B, raw_ostream &o)
+ : CallGraphSCCPass(&ID), Banner(B), Out(o) {}
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ }
+
+ bool runOnSCC(std::vector<CallGraphNode *> &SCC) {
+ Out << Banner;
+ for (unsigned i = 0, e = SCC.size(); i != e; ++i)
+ SCC[i]->getFunction()->print(Out);
+ return false;
+ }
+ };
+
+} // end anonymous namespace.
+
+char PrintCallGraphPass::ID = 0;
+
+Pass *CallGraphSCCPass::createPrinterPass(raw_ostream &O,
+ const std::string &Banner) const {
+ return new PrintCallGraphPass(Banner, O);
+}
+