Improve doxygen documentation, patch contributed by Evan Jones!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21393 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-04-21 16:04:49 +00:00
parent 588bbbffa1
commit 0f67dd6237
3 changed files with 59 additions and 59 deletions

View File

@ -30,14 +30,14 @@ class BasicBlock;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// Interval Class - An Interval is a set of nodes defined such that every node /// Interval Class - An Interval is a set of nodes defined such that every node
// in the interval has all of its predecessors in the interval (except for the /// in the interval has all of its predecessors in the interval (except for the
// header) /// header)
// ///
class Interval { class Interval {
// HeaderNode - The header BasicBlock, which dominates all BasicBlocks in this /// HeaderNode - The header BasicBlock, which dominates all BasicBlocks in this
// interval. Also, any loops in this interval must go through the HeaderNode. /// interval. Also, any loops in this interval must go through the HeaderNode.
// ///
BasicBlock *HeaderNode; BasicBlock *HeaderNode;
public: public:
typedef std::vector<BasicBlock*>::iterator succ_iterator; typedef std::vector<BasicBlock*>::iterator succ_iterator;
@ -53,22 +53,22 @@ public:
inline BasicBlock *getHeaderNode() const { return HeaderNode; } inline BasicBlock *getHeaderNode() const { return HeaderNode; }
// Nodes - The basic blocks in this interval. /// Nodes - The basic blocks in this interval.
// ///
std::vector<BasicBlock*> Nodes; std::vector<BasicBlock*> Nodes;
// Successors - List of BasicBlocks that are reachable directly from nodes in /// Successors - List of BasicBlocks that are reachable directly from nodes in
// this interval, but are not in the interval themselves. /// this interval, but are not in the interval themselves.
// These nodes necessarily must be header nodes for other intervals. /// These nodes necessarily must be header nodes for other intervals.
// ///
std::vector<BasicBlock*> Successors; std::vector<BasicBlock*> Successors;
// Predecessors - List of BasicBlocks that have this Interval's header block /// Predecessors - List of BasicBlocks that have this Interval's header block
// as one of their successors. /// as one of their successors.
// ///
std::vector<BasicBlock*> Predecessors; std::vector<BasicBlock*> Predecessors;
// contains - Find out if a basic block is in this interval /// contains - Find out if a basic block is in this interval
inline bool contains(BasicBlock *BB) const { inline bool contains(BasicBlock *BB) const {
for (unsigned i = 0; i < Nodes.size(); ++i) for (unsigned i = 0; i < Nodes.size(); ++i)
if (Nodes[i] == BB) return true; if (Nodes[i] == BB) return true;
@ -77,7 +77,7 @@ public:
//return find(Nodes.begin(), Nodes.end(), BB) != Nodes.end(); //return find(Nodes.begin(), Nodes.end(), BB) != Nodes.end();
} }
// isSuccessor - find out if a basic block is a successor of this Interval /// isSuccessor - find out if a basic block is a successor of this Interval
inline bool isSuccessor(BasicBlock *BB) const { inline bool isSuccessor(BasicBlock *BB) const {
for (unsigned i = 0; i < Successors.size(); ++i) for (unsigned i = 0; i < Successors.size(); ++i)
if (Successors[i] == BB) return true; if (Successors[i] == BB) return true;
@ -86,24 +86,24 @@ public:
//return find(Successors.begin(), Successors.end(), BB) != Successors.end(); //return find(Successors.begin(), Successors.end(), BB) != Successors.end();
} }
// Equality operator. It is only valid to compare two intervals from the same /// Equality operator. It is only valid to compare two intervals from the same
// partition, because of this, all we have to check is the header node for /// partition, because of this, all we have to check is the header node for
// equality. /// equality.
// ///
inline bool operator==(const Interval &I) const { inline bool operator==(const Interval &I) const {
return HeaderNode == I.HeaderNode; return HeaderNode == I.HeaderNode;
} }
// isLoop - Find out if there is a back edge in this interval... /// isLoop - Find out if there is a back edge in this interval...
bool isLoop() const; bool isLoop() const;
// print - Show contents in human readable format... /// print - Show contents in human readable format...
void print(std::ostream &O) const; void print(std::ostream &O) const;
}; };
// succ_begin/succ_end - define methods so that Intervals may be used /// succ_begin/succ_end - define methods so that Intervals may be used
// just like BasicBlocks can with the succ_* functions, and *::succ_iterator. /// just like BasicBlocks can with the succ_* functions, and *::succ_iterator.
// ///
inline Interval::succ_iterator succ_begin(Interval *I) { inline Interval::succ_iterator succ_begin(Interval *I) {
return I->Successors.begin(); return I->Successors.begin();
} }
@ -111,9 +111,9 @@ inline Interval::succ_iterator succ_end(Interval *I) {
return I->Successors.end(); return I->Successors.end();
} }
// pred_begin/pred_end - define methods so that Intervals may be used /// pred_begin/pred_end - define methods so that Intervals may be used
// just like BasicBlocks can with the pred_* functions, and *::pred_iterator. /// just like BasicBlocks can with the pred_* functions, and *::pred_iterator.
// ///
inline Interval::pred_iterator pred_begin(Interval *I) { inline Interval::pred_iterator pred_begin(Interval *I) {
return I->Predecessors.begin(); return I->Predecessors.begin();
} }
@ -127,7 +127,7 @@ template <> struct GraphTraits<Interval*> {
static NodeType *getEntryNode(Interval *I) { return I; } static NodeType *getEntryNode(Interval *I) { return I; }
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph /// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
static inline ChildIteratorType child_begin(NodeType *N) { static inline ChildIteratorType child_begin(NodeType *N) {
return succ_begin(N); return succ_begin(N);
} }

View File

@ -20,9 +20,9 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI) /// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
// with a value, then remove and delete the original instruction. /// with a value, then remove and delete the original instruction.
// ///
void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL, void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL,
BasicBlock::iterator &BI, Value *V) { BasicBlock::iterator &BI, Value *V) {
Instruction &I = *BI; Instruction &I = *BI;
@ -40,10 +40,10 @@ void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL,
} }
// ReplaceInstWithInst - Replace the instruction specified by BI with the /// ReplaceInstWithInst - Replace the instruction specified by BI with the
// instruction specified by I. The original instruction is deleted and BI is /// instruction specified by I. The original instruction is deleted and BI is
// updated to point to the new instruction. /// updated to point to the new instruction.
// ///
void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL, void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL,
BasicBlock::iterator &BI, Instruction *I) { BasicBlock::iterator &BI, Instruction *I) {
assert(I->getParent() == 0 && assert(I->getParent() == 0 &&
@ -59,21 +59,21 @@ void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL,
BI = New; BI = New;
} }
// ReplaceInstWithInst - Replace the instruction specified by From with the /// ReplaceInstWithInst - Replace the instruction specified by From with the
// instruction specified by To. /// instruction specified by To.
// ///
void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) { void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) {
BasicBlock::iterator BI(From); BasicBlock::iterator BI(From);
ReplaceInstWithInst(From->getParent()->getInstList(), BI, To); ReplaceInstWithInst(From->getParent()->getInstList(), BI, To);
} }
// RemoveSuccessor - Change the specified terminator instruction such that its /// RemoveSuccessor - Change the specified terminator instruction such that its
// successor #SuccNum no longer exists. Because this reduces the outgoing /// successor #SuccNum no longer exists. Because this reduces the outgoing
// degree of the current basic block, the actual terminator instruction itself /// degree of the current basic block, the actual terminator instruction itself
// may have to be changed. In the case where the last successor of the block is /// may have to be changed. In the case where the last successor of the block is
// deleted, a return instruction is inserted in its place which can cause a /// deleted, a return instruction is inserted in its place which can cause a
// surprising change in program behavior if it is not expected. /// surprising change in program behavior if it is not expected.
// ///
void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
assert(SuccNum < TI->getNumSuccessors() && assert(SuccNum < TI->getNumSuccessors() &&
"Trying to remove a nonexistant successor!"); "Trying to remove a nonexistant successor!");

View File

@ -195,17 +195,17 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
} }
// splitBasicBlock - This splits a basic block into two at the specified /// splitBasicBlock - This splits a basic block into two at the specified
// instruction. Note that all instructions BEFORE the specified iterator stay /// instruction. Note that all instructions BEFORE the specified iterator stay
// as part of the original basic block, an unconditional branch is added to /// as part of the original basic block, an unconditional branch is added to
// the new BB, and the rest of the instructions in the BB are moved to the new /// the new BB, and the rest of the instructions in the BB are moved to the new
// BB, including the old terminator. This invalidates the iterator. /// BB, including the old terminator. This invalidates the iterator.
// ///
// Note that this only works on well formed basic blocks (must have a /// Note that this only works on well formed basic blocks (must have a
// terminator), and 'I' must not be the end of instruction list (which would /// terminator), and 'I' must not be the end of instruction list (which would
// cause a degenerate basic block to be formed, having a terminator inside of /// cause a degenerate basic block to be formed, having a terminator inside of
// the basic block). /// the basic block).
// ///
BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) {
assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!"); assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!");
assert(I != InstList.end() && assert(I != InstList.end() &&