From: Chris Lattner Date: Thu, 21 Jun 2001 05:24:46 +0000 (+0000) Subject: * Added comments X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=2100f8cceddcffff65008db79ac036551a0e4846 * Added comments * 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 --- diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h index 3c22f6dc7ca..b16c7a50391 100644 --- a/include/llvm/Analysis/Interval.h +++ b/include/llvm/Analysis/Interval.h @@ -53,14 +53,19 @@ public: // vector 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