[llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 26 00:04:01 PDT 2002
Changes in directory llvm/lib/VMCore:
BasicBlock.cpp updated: 1.25 -> 1.26
---
Log message:
- Add new ctor to BasicBlock to allow insertion before any BB, not just at
the end of the function.
---
Diffs of the changes:
Index: llvm/lib/VMCore/BasicBlock.cpp
diff -u llvm/lib/VMCore/BasicBlock.cpp:1.25 llvm/lib/VMCore/BasicBlock.cpp:1.26
--- llvm/lib/VMCore/BasicBlock.cpp:1.25 Sun Sep 8 13:59:34 2002
+++ llvm/lib/VMCore/BasicBlock.cpp Thu Sep 26 00:03:22 2002
@@ -67,6 +67,26 @@
Parent->getBasicBlockList().push_back(this);
}
+/// BasicBlock ctor - If the InsertBefore parameter is specified, the basic
+/// block is automatically inserted right before the specified block.
+///
+BasicBlock::BasicBlock(const std::string &Name, BasicBlock *InsertBefore)
+ : Value(Type::LabelTy, Value::BasicBlockVal, Name) {
+ // Initialize the instlist...
+ InstList.setItemParent(this);
+
+ // Make sure that we get added to a function
+ LeakDetector::addGarbageObject(this);
+
+ if (InsertBefore) {
+ assert(InsertBefore->getParent() &&
+ "Cannot insert block before another block that is not embedded into"
+ " a function yet!");
+ InsertBefore->getParent()->getBasicBlockList().insert(InsertBefore, this);
+ }
+}
+
+
BasicBlock::~BasicBlock() {
dropAllReferences();
InstList.clear();
More information about the llvm-commits
mailing list