diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-21 05:24:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-21 05:24:46 +0000 |
commit | 2100f8cceddcffff65008db79ac036551a0e4846 (patch) | |
tree | 8b70089a1db18f528e5e4e75b1880a18134f5498 | |
parent | 90c8194425f06ad2fb23270693812885d5a37f24 (diff) |
* 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
-rw-r--r-- | include/llvm/Analysis/Interval.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h index 3c22f6dc7c..b16c7a5039 100644 --- a/include/llvm/Analysis/Interval.h +++ b/include/llvm/Analysis/Interval.h @@ -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 |