aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/CallGraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/CallGraph.h')
-rw-r--r--include/llvm/Analysis/CallGraph.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 5562e9b9465f..4ecacb0f0be2 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -57,6 +57,7 @@
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include <map>
@@ -294,20 +295,27 @@ private:
/// This class implements the concept of an analysis pass used by the \c
/// ModuleAnalysisManager to run an analysis over a module and cache the
/// resulting data.
-class CallGraphAnalysis {
+class CallGraphAnalysis : public AnalysisInfoMixin<CallGraphAnalysis> {
+ friend AnalysisInfoMixin<CallGraphAnalysis>;
+ static char PassID;
+
public:
/// \brief A formulaic typedef to inform clients of the result type.
typedef CallGraph Result;
- static void *ID() { return (void *)&PassID; }
-
/// \brief Compute the \c CallGraph for the module \c M.
///
/// The real work here is done in the \c CallGraph constructor.
- CallGraph run(Module *M) { return CallGraph(*M); }
+ CallGraph run(Module &M, ModuleAnalysisManager &) { return CallGraph(M); }
+};
-private:
- static char PassID;
+/// \brief Printer pass for the \c CallGraphAnalysis results.
+class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
+ raw_ostream &OS;
+
+public:
+ explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
+ PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
};
/// \brief The \c ModulePass which wraps up a \c CallGraph and the logic to