mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
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
This commit is contained in:
parent
aef1fea3d3
commit
c93760c3e5
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user