summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-15 01:17:37 +0000
committerDan Gohman <gohman@apple.com>2009-04-15 01:17:37 +0000
commit89892b05c775e632c387d3ed7354980979274b39 (patch)
treea04b13ebd0ebfefd918eb701b91102868114be97 /llvm/lib
parent7ffb7d57286ef55b6e98ccde90ecbbc6ff6bbbd9 (diff)
downloadbcm5719-llvm-89892b05c775e632c387d3ed7354980979274b39.tar.gz
bcm5719-llvm-89892b05c775e632c387d3ed7354980979274b39.zip
Give RemoveRegOperandFromRegInfo a comment and move the
code out of line. llvm-svn: 69124
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index a227f25190a..a934b76b6d5 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -68,6 +68,21 @@ void MachineOperand::AddRegOperandToRegInfo(MachineRegisterInfo *RegInfo) {
*Head = this;
}
+/// RemoveRegOperandFromRegInfo - Remove this register operand from the
+/// MachineRegisterInfo it is linked with.
+void MachineOperand::RemoveRegOperandFromRegInfo() {
+ assert(isOnRegUseList() && "Reg operand is not on a use list");
+ // Unlink this from the doubly linked list of operands.
+ MachineOperand *NextOp = Contents.Reg.Next;
+ *Contents.Reg.Prev = NextOp;
+ if (NextOp) {
+ assert(NextOp->getReg() == getReg() && "Corrupt reg use/def chain!");
+ NextOp->Contents.Reg.Prev = Contents.Reg.Prev;
+ }
+ Contents.Reg.Prev = 0;
+ Contents.Reg.Next = 0;
+}
+
void MachineOperand::setReg(unsigned Reg) {
if (getReg() == Reg) return; // No change.
OpenPOWER on IntegriCloud