From a49e015180bf85e1ffd934dbc94c0deda60873f6 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 3 Jul 2001 15:28:08 +0000 Subject: [PATCH] IntervalPartition was changed to inherit from vector instead of contain it so that it would have full iterator access without much work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/IntervalPartition.h | 11 +---------- include/llvm/Analysis/Writer.h | 7 +++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 796c840b9a8..494ccd20976 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -31,17 +31,13 @@ namespace cfg { // BasicBlock is a (possibly nonexistent) loop with a "tail" of non looping // nodes following it. // -class IntervalPartition { +class IntervalPartition : public vector { typedef map IntervalMapTy; IntervalMapTy IntervalMap; typedef vector IntervalListTy; - IntervalListTy IntervalList; Interval *RootInterval; -public: - typedef IntervalListTy::iterator iterator; - public: // IntervalPartition ctor - Build the partition for the specified method IntervalPartition(Method *M); @@ -71,11 +67,6 @@ public: return I != IntervalMap.end() ? I->second : 0; } - // Iterators to iterate over all of the intervals in the method - inline iterator begin() { return IntervalList.begin(); } - inline iterator end() { return IntervalList.end(); } - inline unsigned size() { return IntervalList.size(); } - private: // 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 diff --git a/include/llvm/Analysis/Writer.h b/include/llvm/Analysis/Writer.h index 4d668380946..f6a41015d0e 100644 --- a/include/llvm/Analysis/Writer.h +++ b/include/llvm/Analysis/Writer.h @@ -14,11 +14,18 @@ namespace cfg { // This library provides support for printing out Intervals. class Interval; + class IntervalPartition; + void WriteToOutput(const Interval *I, ostream &o); inline ostream &operator <<(ostream &o, const Interval *I) { WriteToOutput(I, o); return o; } + void WriteToOutput(const IntervalPartition &IP, ostream &o); + inline ostream &operator <<(ostream &o, const IntervalPartition &IP) { + WriteToOutput(IP, o); return o; + } + // Stuff for printing out Dominator data structures... class DominatorSet; class ImmediateDominators;