* Added comments
authorChris Lattner <sabre@nondot.org>
Thu, 21 Jun 2001 05:24:46 +0000 (05:24 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 21 Jun 2001 05:24:46 +0000 (05:24 +0000)
* Added prototype for new Interval::isLoop method
* Added destructor to free memory
* Added IntervalPartition::isDegeneratePartition method
* Added IntervalPartition::size() method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/Interval.h

index 3c22f6dc7caf5daa29b3a72b55579b772687f770..b16c7a50391c6441303d21a9133c2c0fcb065954 100644 (file)
@@ -53,14 +53,19 @@ public:
   //
   vector<BasicBlock*> Predecessors;
 
-  inline bool contains(BasicBlock *BB) {
+  // contains - Find out if a basic block is in this interval
+  inline bool contains(BasicBlock *BB) const {
     return find(Nodes.begin(), Nodes.end(), BB) != Nodes.end();
   }
 
-  inline bool isSuccessor(BasicBlock *BB) {
+  // isSuccessor - find out if a basic block is a successor of this Interval
+  inline bool isSuccessor(BasicBlock *BB) const {
     return find(Successors.begin(), Successors.end(), BB) != Successors.end();
   }
 
+  // isLoop - Find out if there is a back edge in this interval...
+  bool isLoop() const;
+
 private:           // Only accessable by IntervalPartition class
   inline Interval(BasicBlock *Header) : HeaderNode(Header) {
     Nodes.push_back(Header);
@@ -117,21 +122,29 @@ public:
   //
   IntervalPartition(IntervalPartition &I, bool);
 
+  // Destructor - Free memory
+  ~IntervalPartition();
+
   // getRootInterval() - Return the root interval that contains the starting
-  // block of the method
+  // block of the method.
   inline Interval *getRootInterval() { return RootInterval; }
 
+  // isDegeneratePartition() - Returns true if the interval partition contains
+  // a single interval, and thus cannot be simplified anymore.
+  bool isDegeneratePartition() { return size() == 1; }
+
+  // TODO: isIrreducible - look for triangle graph.
+
+  // getBlockInterval - Return the interval that a basic block exists in.
   inline Interval *getBlockInterval(BasicBlock *BB) {
     IntervalMapTy::iterator I = IntervalMap.find(BB);
-    if (I != IntervalMap.end()) 
-      return I->second;
-    else
-      return 0;
+    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:
   // ProcessInterval - This method is used during the construction of the