diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-20 14:16:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-20 14:16:56 +0000 |
| commit | 2cab237b5dbfe1b3e9c7aa7a3c02d2b98fcf7462 (patch) | |
| tree | 524fe828571f81358bba62fdb6d04c6e5e96a2a4 /contrib/llvm/lib/Analysis/CallGraph.cpp | |
| parent | 6c7828a2807ea5e50c79ca42dbedf2b589ce63b2 (diff) | |
| parent | 044eb2f6afba375a914ac9d8024f8f5142bb912e (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Analysis/CallGraph.cpp')
| -rw-r--r-- | contrib/llvm/lib/Analysis/CallGraph.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/contrib/llvm/lib/Analysis/CallGraph.cpp b/contrib/llvm/lib/Analysis/CallGraph.cpp index ff5242f69a1b..ac3ea2b73fed 100644 --- a/contrib/llvm/lib/Analysis/CallGraph.cpp +++ b/contrib/llvm/lib/Analysis/CallGraph.cpp @@ -8,12 +8,20 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/CallGraph.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/IR/CallSite.h" -#include "llvm/IR/Instructions.h" -#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/Intrinsics.h" +#include "llvm/IR/PassManager.h" +#include "llvm/Pass.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include <algorithm> +#include <cassert> + using namespace llvm; //===----------------------------------------------------------------------===// @@ -125,7 +133,6 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { /// This does not rescan the body of the function, so it is suitable when /// splicing the body of the old function to the new while also updating all /// callers from old to new. -/// void CallGraph::spliceFunction(const Function *From, const Function *To) { assert(FunctionMap.count(From) && "No CallGraphNode for function!"); assert(!FunctionMap.count(To) && @@ -256,7 +263,7 @@ CallGraphWrapperPass::CallGraphWrapperPass() : ModulePass(ID) { initializeCallGraphWrapperPassPass(*PassRegistry::getPassRegistry()); } -CallGraphWrapperPass::~CallGraphWrapperPass() {} +CallGraphWrapperPass::~CallGraphWrapperPass() = default; void CallGraphWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -291,8 +298,10 @@ void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); } #endif namespace { + struct CallGraphPrinterLegacyPass : public ModulePass { static char ID; // Pass ID, replacement for typeid + CallGraphPrinterLegacyPass() : ModulePass(ID) { initializeCallGraphPrinterLegacyPassPass(*PassRegistry::getPassRegistry()); } @@ -301,12 +310,14 @@ struct CallGraphPrinterLegacyPass : public ModulePass { AU.setPreservesAll(); AU.addRequiredTransitive<CallGraphWrapperPass>(); } + bool runOnModule(Module &M) override { getAnalysis<CallGraphWrapperPass>().print(errs(), &M); return false; } }; -} + +} // end anonymous namespace char CallGraphPrinterLegacyPass::ID = 0; |
