Add a MachineInstr::eraseFromParent convenience method.
authorChris Lattner <sabre@nondot.org>
Mon, 17 Apr 2006 21:35:41 +0000 (21:35 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 17 Apr 2006 21:35:41 +0000 (21:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27775 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index 0351cc2783e2286fef7c148d7b46ef414fd1f9bc..34a2a7d62842aafb2aa7d18b7755b957fe2fa276 100644 (file)
@@ -100,6 +100,15 @@ MachineInstr* MachineInstr::clone() const {
   return new MachineInstr(*this);
 }
 
+/// removeFromParent - This method unlinks 'this' from the containing basic
+/// block, and returns it, but does not delete it.
+MachineInstr *MachineInstr::removeFromParent() {
+  assert(getParent() && "Not embedded in a basic block!");
+  getParent()->remove(this);
+  return this;
+}
+
+
 /// OperandComplete - Return true if it's illegal to add a new operand
 ///
 bool MachineInstr::OperandsComplete() const {