* 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
This commit is contained in:
Chris Lattner 2001-06-21 05:24:46 +00:00
parent 90c8194425
commit 2100f8cced

View 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