mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-20 21:14:28 +00:00
[CG] Actually hoist up the generic CallGraphPrinter pass from a weird
location in the opt tool to live along side the analysis in LLVM's libraries. No functionality changed here, but this will allow me to port the printer to the new pass manager as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
562873f9be
commit
7a06f63f10
@ -82,6 +82,7 @@ void initializeBranchFolderPassPass(PassRegistry&);
|
||||
void initializeBranchProbabilityInfoWrapperPassPass(PassRegistry&);
|
||||
void initializeBreakCriticalEdgesPass(PassRegistry&);
|
||||
void initializeCallGraphDOTPrinterPass(PassRegistry&);
|
||||
void initializeCallGraphPrinterLegacyPassPass(PassRegistry&);
|
||||
void initializeCallGraphViewerPass(PassRegistry&);
|
||||
void initializeCFGOnlyPrinterPass(PassRegistry&);
|
||||
void initializeCFGOnlyViewerPass(PassRegistry&);
|
||||
|
@ -27,6 +27,7 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
|
||||
initializeBranchProbabilityInfoWrapperPassPass(Registry);
|
||||
initializeCallGraphWrapperPassPass(Registry);
|
||||
initializeCallGraphDOTPrinterPass(Registry);
|
||||
initializeCallGraphPrinterLegacyPassPass(Registry);
|
||||
initializeCallGraphViewerPass(Registry);
|
||||
initializeCostModelAnalysisPass(Registry);
|
||||
initializeCFGViewerPass(Registry);
|
||||
|
@ -302,3 +302,29 @@ void CallGraphWrapperPass::print(raw_ostream &OS, const Module *) const {
|
||||
|
||||
LLVM_DUMP_METHOD
|
||||
void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
|
||||
|
||||
namespace {
|
||||
struct CallGraphPrinterLegacyPass : public ModulePass {
|
||||
static char ID; // Pass ID, replacement for typeid
|
||||
CallGraphPrinterLegacyPass() : ModulePass(ID) {
|
||||
initializeCallGraphPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequiredTransitive<CallGraphWrapperPass>();
|
||||
}
|
||||
bool runOnModule(Module &M) override {
|
||||
getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
char CallGraphPrinterLegacyPass::ID = 0;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(CallGraphPrinterLegacyPass, "print-callgraph",
|
||||
"Print a call graph", true, true)
|
||||
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
|
||||
INITIALIZE_PASS_END(CallGraphPrinterLegacyPass, "print-callgraph",
|
||||
"Print a call graph", true, true)
|
||||
|
@ -71,23 +71,3 @@ char ExternalFunctionsPassedConstants::ID = 0;
|
||||
static RegisterPass<ExternalFunctionsPassedConstants>
|
||||
P1("print-externalfnconstants",
|
||||
"Print external fn callsites passed constants");
|
||||
|
||||
namespace {
|
||||
struct CallGraphPrinter : public ModulePass {
|
||||
static char ID; // Pass ID, replacement for typeid
|
||||
CallGraphPrinter() : ModulePass(ID) {}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequiredTransitive<CallGraphWrapperPass>();
|
||||
}
|
||||
bool runOnModule(Module &M) override {
|
||||
getAnalysis<CallGraphWrapperPass>().print(errs(), &M);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
char CallGraphPrinter::ID = 0;
|
||||
static RegisterPass<CallGraphPrinter>
|
||||
P2("print-callgraph", "Print a call graph");
|
||||
|
Loading…
x
Reference in New Issue
Block a user