diff options
author | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:17 +0000 |
commit | a59cbb2043c08f3cfb8fb379f0d336e21e070be8 (patch) | |
tree | 19ace2fcd6b60628e49d6c65ca1015cbff960916 /include/llvm/Pass.h | |
parent | 97f51a3024a72ef8500e95b90e6361e6783160fd (diff) | |
download | external_llvm-a59cbb2043c08f3cfb8fb379f0d336e21e070be8.zip external_llvm-a59cbb2043c08f3cfb8fb379f0d336e21e070be8.tar.gz external_llvm-a59cbb2043c08f3cfb8fb379f0d336e21e070be8.tar.bz2 |
* Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID: Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
the analyses themselves.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Pass.h')
-rw-r--r-- | include/llvm/Pass.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 2cf85d4..4f027a4 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -24,16 +24,20 @@ #include <vector> #include <map> +#include <iosfwd> class Value; class BasicBlock; class Function; class Module; class AnalysisUsage; -class AnalysisID; class PassInfo; template<class UnitType> class PassManagerT; struct AnalysisResolver; +// AnalysisID - Use the PassInfo to identify a pass... +typedef const PassInfo* AnalysisID; + + //===----------------------------------------------------------------------===// // Pass interface - Implemented by all 'passes'. Subclass this if you are an // interprocedural optimization or you do not fit into any of the more @@ -61,6 +65,18 @@ public: // virtual bool run(Module &M) = 0; + // print - Print out the internal state of the pass. This is called by + // Analyze to print out the contents of an analysis. Otherwise it is not + // neccesary to implement this method. Beware that the module pointer MAY be + // null. This automatically forwards to a virtual function that does not + // provide the Module* in case the analysis doesn't need it it can just be + // ignored. + // + virtual void print(std::ostream &O, const Module *M) const { print(O); } + virtual void print(std::ostream &O) const; + void dump() const; // dump - call print(std::cerr, 0); + + // getAnalysisUsage - This function should be overriden by passes that need // analysis information to do their job. If a pass specifies that it uses a // particular analysis result to this function, it can then use the @@ -117,6 +133,9 @@ private: virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU); }; +inline std::ostream &operator<<(std::ostream &OS, const Pass &P) { + P.print(OS, 0); return OS; +} //===----------------------------------------------------------------------===// // FunctionPass class - This class is used to implement most global |