From facd752d3afaeca7dee46648f2a2ae209a94e5e9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 30 Jan 2002 23:27:55 +0000 Subject: Convert analyses over to new Pass framework git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1595 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/IntervalPartition.h | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'include/llvm/Analysis/IntervalPartition.h') diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index f05408b022..16b3c9c457 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -17,9 +17,7 @@ #define LLVM_INTERVAL_PARTITION_H #include "llvm/Analysis/Interval.h" -#include - -class Method; +#include "llvm/Pass.h" namespace cfg { @@ -31,7 +29,7 @@ namespace cfg { // BasicBlock is a (possibly nonexistent) loop with a "tail" of non looping // nodes following it. // -class IntervalPartition : public std::vector { +class IntervalPartition : public MethodPass, public std::vector { typedef std::map IntervalMapTy; IntervalMapTy IntervalMap; @@ -39,8 +37,12 @@ class IntervalPartition : public std::vector { Interval *RootInterval; public: - // IntervalPartition ctor - Build the partition for the specified method - IntervalPartition(Method *M); + static AnalysisID ID; // We are an analysis, we must have an ID + + IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); } + + // run - Calculate the interval partition for this method + virtual bool runOnMethod(Method *M); // IntervalPartition ctor - Build a reduced interval partition from an // existing interval graph. This takes an additional boolean parameter to @@ -49,7 +51,7 @@ public: IntervalPartition(IntervalPartition &I, bool); // Destructor - Free memory - ~IntervalPartition(); + ~IntervalPartition() { destroy(); } // getRootInterval() - Return the root interval that contains the starting // block of the method. @@ -67,7 +69,17 @@ public: return I != IntervalMap.end() ? I->second : 0; } + // getAnalysisUsageInfo - Implement the Pass API + virtual void getAnalysisUsageInfo(AnalysisSet &Required, + AnalysisSet &Destroyed, + AnalysisSet &Provided) { + Provided.push_back(ID); + } + private: + // destroy - Reset state back to before method was analyzed + void destroy(); + // addIntervalToPartition - Add an interval to the internal list of intervals, // and then add mappings from all of the basic blocks in the interval to the // interval itself (in the IntervalMap). -- cgit v1.2.3