summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/IntervalPartition.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-01-30 23:27:55 +0000
committerChris Lattner <sabre@nondot.org>2002-01-30 23:27:55 +0000
commitfacd752d3afaeca7dee46648f2a2ae209a94e5e9 (patch)
treeb6677643ca539f1e9e35e531a7e2b0367f4d59c6 /include/llvm/Analysis/IntervalPartition.h
parent05ad462d1b8e0486879ecd910c3ff4541bd8604c (diff)
downloadllvm-facd752d3afaeca7dee46648f2a2ae209a94e5e9.tar.gz
llvm-facd752d3afaeca7dee46648f2a2ae209a94e5e9.tar.bz2
llvm-facd752d3afaeca7dee46648f2a2ae209a94e5e9.tar.xz
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/IntervalPartition.h')
-rw-r--r--include/llvm/Analysis/IntervalPartition.h26
1 files changed, 19 insertions, 7 deletions
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 <map>
-
-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<Interval*> {
+class IntervalPartition : public MethodPass, public std::vector<Interval*> {
typedef std::map<BasicBlock*, Interval*> IntervalMapTy;
IntervalMapTy IntervalMap;
@@ -39,8 +37,12 @@ class IntervalPartition : public std::vector<Interval*> {
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).