diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-30 23:27:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-30 23:27:55 +0000 |
commit | facd752d3afaeca7dee46648f2a2ae209a94e5e9 (patch) | |
tree | b6677643ca539f1e9e35e531a7e2b0367f4d59c6 /include/llvm/Analysis/CallGraph.h | |
parent | 05ad462d1b8e0486879ecd910c3ff4541bd8604c (diff) |
Convert analyses over to new Pass framework
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/CallGraph.h')
-rw-r--r-- | include/llvm/Analysis/CallGraph.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index f5b020269c..6fea49bb6f 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -17,8 +17,7 @@ #define LLVM_ANALYSIS_CALLGRAPH_H #include "Support/GraphTraits.h" -#include <map> -#include <vector> +#include "llvm/Pass.h" class Method; class Module; @@ -62,7 +61,7 @@ private: // Stuff to construct the node, used by CallGraph }; -class CallGraph { +class CallGraph : public Pass { Module *Mod; // The module this call graph represents typedef std::map<const Method *, CallGraphNode *> MethodMapTy; @@ -70,8 +69,10 @@ class CallGraph { CallGraphNode *Root; public: - CallGraph(Module *TheModule); - ~CallGraph(); + static AnalysisID ID; // We are an analysis, we must have an ID + + CallGraph(AnalysisID AID) : Root(0) { assert(AID == ID); } + ~CallGraph() { destroy(); } typedef MethodMapTy::iterator iterator; typedef MethodMapTy::const_iterator const_iterator; @@ -111,7 +112,18 @@ public: return removeMethodFromModule((*this)[Meth]); } + // run - Compute the call graph for the specified module. + virtual bool run(Module *TheModule); + + // getAnalysisUsageInfo - This obviously provides a call graph + virtual void getAnalysisUsageInfo(AnalysisSet &Required, + AnalysisSet &Destroyed, + AnalysisSet &Provided) { + Provided.push_back(ID); + } + private: // Implementation of CallGraph construction + void destroy(); // getNodeFor - Return the node for the specified method or create one if it // does not already exist. |