diff options
author | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-07-27 01:12:15 +0000 |
commit | 97f51a3024a72ef8500e95b90e6361e6783160fd (patch) | |
tree | 4fab9417a9dc40dd475d7503281ef4e1c3a545d9 /include/llvm/Analysis | |
parent | 9a740fdf2165e263da98480d9c24f1803f94ef0c (diff) | |
download | external_llvm-97f51a3024a72ef8500e95b90e6361e6783160fd.zip external_llvm-97f51a3024a72ef8500e95b90e6361e6783160fd.tar.gz external_llvm-97f51a3024a72ef8500e95b90e6361e6783160fd.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@3115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r-- | include/llvm/Analysis/DataStructure.h | 6 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure/DataStructure.h | 6 | ||||
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 12 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUnsafePointerTypes.h | 5 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUsedTypes.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/InductionVariable.h | 3 | ||||
-rw-r--r-- | include/llvm/Analysis/Interval.h | 4 | ||||
-rw-r--r-- | include/llvm/Analysis/IntervalPartition.h | 3 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/Writer.h | 76 |
10 files changed, 33 insertions, 86 deletions
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index c611574..dda0adb 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -342,7 +342,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); @@ -377,7 +377,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); @@ -419,7 +419,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index c611574..dda0adb 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -342,7 +342,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); @@ -377,7 +377,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); @@ -419,7 +419,7 @@ public: } // print - Print out the analysis results... - void print(std::ostream &O, Module *M) const; + void print(std::ostream &O, const Module *M) const; // If the pass pipeline is done with this pass, we can release our memory... virtual void releaseMemory(); diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 154b31d..8c9df64 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -82,6 +82,9 @@ public: return getDominators(B).count(A) != 0; } + // print - Convert to human readable form + virtual void print(std::ostream &OS) const; + // dominates - Return true if A dominates B. This performs the special checks // neccesary if A and B are in the same basic block. // @@ -157,6 +160,9 @@ public: std::map<BasicBlock*, BasicBlock*>::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } + + // print - Convert to human readable form + virtual void print(std::ostream &OS) const; }; //===------------------------------------- @@ -259,6 +265,9 @@ public: NodeMapType::const_iterator i = Nodes.find(BB); return (i != Nodes.end()) ? i->second : 0; } + + // print - Convert to human readable form + virtual void print(std::ostream &OS) const; }; @@ -336,6 +345,9 @@ public: inline const_iterator begin() const { return Frontiers.begin(); } inline const_iterator end() const { return Frontiers.end(); } inline const_iterator find(BasicBlock* B) const { return Frontiers.find(B); } + + // print - Convert to human readable form + virtual void print(std::ostream &OS) const; }; diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 038d763..59fc78e 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -39,10 +39,9 @@ public: // virtual bool run(Module &M); - // printResults - Loop over the results of the analysis, printing out unsafe - // types. + // print - Loop over the results of the analysis, printing out unsafe types. // - void printResults(const Module *Mod, std::ostream &o) const; + void print(std::ostream &o, const Module *Mod) const; // getAnalysisUsage - Of course, we provide ourself... // diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 4888dda..2f3e81c 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -29,7 +29,7 @@ public: // passed in, then the types are printed symbolically if possible, using the // symbol table from the module. // - void printTypes(std::ostream &o, const Module *M = 0) const; + void print(std::ostream &o, const Module *M) const; private: // IncorporateType - Incorporate one type and all of its subtypes into the diff --git a/include/llvm/Analysis/InductionVariable.h b/include/llvm/Analysis/InductionVariable.h index 951ac05..36dcaeb 100644 --- a/include/llvm/Analysis/InductionVariable.h +++ b/include/llvm/Analysis/InductionVariable.h @@ -19,6 +19,7 @@ #ifndef LLVM_ANALYSIS_INDUCTIONVARIABLE_H #define LLVM_ANALYSIS_INDUCTIONVARIABLE_H +#include <iosfwd> class Value; class PHINode; class Instruction; @@ -45,6 +46,8 @@ public: // Classify Induction static enum iType Classify(const Value *Start, const Value *Step, const Loop *L = 0); + + void print(std::ostream &OS) const; }; #endif diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h index b297441..13a6f45 100644 --- a/include/llvm/Analysis/Interval.h +++ b/include/llvm/Analysis/Interval.h @@ -14,6 +14,7 @@ #define LLVM_INTERVAL_H #include <vector> +#include <iosfwd> class BasicBlock; @@ -85,6 +86,9 @@ public: // isLoop - Find out if there is a back edge in this interval... bool isLoop() const; + + // print - Show contents in human readable format... + void print(std::ostream &O) const; }; // succ_begin/succ_end - define methods so that Intervals may be used diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index f21083f..4fd388e 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -51,6 +51,9 @@ public: // Destructor - Free memory ~IntervalPartition() { destroy(); } + // print - Show contents in human readable format... + virtual void print(std::ostream &O) const; + // getRootInterval() - Return the root interval that contains the starting // block of the function. inline Interval *getRootInterval() { return RootInterval; } diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 03eda29..ae150d4 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -40,6 +40,7 @@ public: inline const std::vector<Loop*> &getSubLoops() const { return SubLoops; } inline const std::vector<BasicBlock*> &getBlocks() const { return Blocks; } + void print(std::ostream &O) const; private: friend class LoopInfo; inline Loop(BasicBlock *BB) { Blocks.push_back(BB); LoopDepth = 0; } @@ -105,6 +106,7 @@ public: virtual bool runOnFunction(Function &F); virtual void releaseMemory(); + void print(std::ostream &O) const; // getAnalysisUsage - Provide loop info, require dominator set // diff --git a/include/llvm/Analysis/Writer.h b/include/llvm/Analysis/Writer.h deleted file mode 100644 index b005094..0000000 --- a/include/llvm/Analysis/Writer.h +++ /dev/null @@ -1,76 +0,0 @@ -//===-- llvm/Analysis/Writer.h - Printer for Analysis routines ---*- C++ -*--=// -// -// This library provides routines to print out various analysis results to -// an output stream. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_WRITER_H -#define LLVM_ANALYSIS_WRITER_H - -#include <iosfwd> - -// This library provides support for printing out Intervals. -class Interval; -class IntervalPartition; - -void WriteToOutput(const Interval *I, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const Interval *I) { - WriteToOutput(I, o); return o; -} - -void WriteToOutput(const IntervalPartition &IP, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, - const IntervalPartition &IP) { - WriteToOutput(IP, o); return o; -} - -// Stuff for printing out Dominator data structures... -class DominatorSetBase; -class ImmediateDominatorsBase; -class DominatorTreeBase; -class DominanceFrontierBase; - -void WriteToOutput(const DominatorSetBase &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const DominatorSetBase &DS) { - WriteToOutput(DS, o); return o; -} - -void WriteToOutput(const ImmediateDominatorsBase &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, - const ImmediateDominatorsBase &ID) { - WriteToOutput(ID, o); return o; -} - -void WriteToOutput(const DominatorTreeBase &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const DominatorTreeBase &DT) { - WriteToOutput(DT, o); return o; -} - -void WriteToOutput(const DominanceFrontierBase &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, - const DominanceFrontierBase &DF) { - WriteToOutput(DF, o); return o; -} - -// Stuff for printing out Loop information -class Loop; -class LoopInfo; - -void WriteToOutput(const LoopInfo &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const LoopInfo &LI) { - WriteToOutput(LI, o); return o; -} - -void WriteToOutput(const Loop *, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const Loop *L) { - WriteToOutput(L, o); return o; -} - -class InductionVariable; -void WriteToOutput(const InductionVariable &, std::ostream &o); -inline std::ostream &operator <<(std::ostream &o, const InductionVariable &IV) { - WriteToOutput(IV, o); return o; -} - -#endif |