[llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Mar 6 12:55:50 PST 2005
Changes in directory llvm/include/llvm/Analysis:
LoopInfo.h updated: 1.43 -> 1.44
---
Log message:
new helper method
---
Diffs of the changes: (+15 -0)
LoopInfo.h | 15 +++++++++++++++
1 files changed, 15 insertions(+)
Index: llvm/include/llvm/Analysis/LoopInfo.h
diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.43 llvm/include/llvm/Analysis/LoopInfo.h:1.44
--- llvm/include/llvm/Analysis/LoopInfo.h:1.43 Mon Dec 6 22:03:45 2004
+++ llvm/include/llvm/Analysis/LoopInfo.h Sun Mar 6 14:55:34 2005
@@ -175,6 +175,21 @@
Blocks.push_back(BB);
}
+ /// moveToHeader - This method is used to move BB (which must be part of this
+ /// loop) to be the loop header of the loop (the block that dominates all
+ /// others).
+ void moveToHeader(BasicBlock *BB) {
+ if (Blocks[0] == BB) return;
+ for (unsigned i = 0; ; ++i) {
+ assert(i != Blocks.size() && "Loop does not contain BB!");
+ if (Blocks[i] == BB) {
+ Blocks[i] = Blocks[0];
+ Blocks[0] = BB;
+ return;
+ }
+ }
+ }
+
/// removeBlockFromLoop - This removes the specified basic block from the
/// current loop, updating the Blocks as appropriate. This does not update
/// the mapping in the LoopInfo class.
More information about the llvm-commits
mailing list