[llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp Function.cpp Globals.cpp Instruction.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 11 15:21:50 PDT 2004
Changes in directory llvm/lib/VMCore:
BasicBlock.cpp updated: 1.49 -> 1.50
Function.cpp updated: 1.78 -> 1.79
Globals.cpp updated: 1.6 -> 1.7
Instruction.cpp updated: 1.38 -> 1.39
---
Log message:
Implement remove/eraseFromParent methods
---
Diffs of the changes: (+33 -2)
Index: llvm/lib/VMCore/BasicBlock.cpp
diff -u llvm/lib/VMCore/BasicBlock.cpp:1.49 llvm/lib/VMCore/BasicBlock.cpp:1.50
--- llvm/lib/VMCore/BasicBlock.cpp:1.49 Wed Sep 1 17:55:36 2004
+++ llvm/lib/VMCore/BasicBlock.cpp Mon Oct 11 17:21:39 2004
@@ -105,6 +105,15 @@
if (P && hasName()) P->getSymbolTable().insert(this);
}
+void BasicBlock::removeFromParent() {
+ getParent()->getBasicBlockList().remove(this);
+}
+
+void BasicBlock::eraseFromParent() {
+ getParent()->getBasicBlockList().erase(this);
+}
+
+
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return 0;
return dyn_cast<TerminatorInst>(&InstList.back());
Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.78 llvm/lib/VMCore/Function.cpp:1.79
--- llvm/lib/VMCore/Function.cpp:1.78 Wed Sep 1 17:55:37 2004
+++ llvm/lib/VMCore/Function.cpp Mon Oct 11 17:21:39 2004
@@ -147,6 +147,14 @@
return getFunctionType()->getReturnType();
}
+void Function::removeFromParent() {
+ getParent()->getFunctionList().remove(this);
+}
+
+void Function::eraseFromParent() {
+ getParent()->getFunctionList().erase(this);
+}
+
// dropAllReferences() - This function causes all the subinstructions to "let
// go" of all references that they are maintaining. This allows one to
// 'delete' a whole class at a time, even though there may be circular
Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.6 llvm/lib/VMCore/Globals.cpp:1.7
--- llvm/lib/VMCore/Globals.cpp:1.6 Wed Sep 1 17:55:37 2004
+++ llvm/lib/VMCore/Globals.cpp Mon Oct 11 17:21:39 2004
@@ -106,9 +106,16 @@
if (P && hasName()) P->getSymbolTable().insert(this);
}
+void GlobalVariable::removeFromParent() {
+ getParent()->getGlobalList().remove(this);
+}
+
+void GlobalVariable::eraseFromParent() {
+ getParent()->getGlobalList().erase(this);
+}
+
void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking )
-{
+ bool DisableChecking) {
// If you call this, then you better know this GVar has a constant
// initializer worth replacing. Enforce that here.
assert(getNumOperands() == 1 &&
Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.38 llvm/lib/VMCore/Instruction.cpp:1.39
--- llvm/lib/VMCore/Instruction.cpp:1.38 Wed Sep 1 17:55:37 2004
+++ llvm/lib/VMCore/Instruction.cpp Mon Oct 11 17:21:39 2004
@@ -72,6 +72,13 @@
if (PP && hasName()) PP->getSymbolTable().insert(this);
}
+void Instruction::removeFromParent() {
+ getParent()->getInstList().remove(this);
+}
+
+void Instruction::eraseFromParent() {
+ getParent()->getInstList().erase(this);
+}
const char *Instruction::getOpcodeName(unsigned OpCode) {
switch (OpCode) {
More information about the llvm-commits
mailing list