diff options
author | Dan Gohman <gohman@apple.com> | 2009-04-15 01:17:37 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-04-15 01:17:37 +0000 |
commit | 3bc1a3735f216f4a122fe4a05d39f63888ab205a (patch) | |
tree | f9d085203487f03bee6e4d5edadca35c59fa691f /lib/CodeGen | |
parent | dd1f9e4bf6e7d427fd581728f3d2e431e12e6e71 (diff) | |
download | external_llvm-3bc1a3735f216f4a122fe4a05d39f63888ab205a.zip external_llvm-3bc1a3735f216f4a122fe4a05d39f63888ab205a.tar.gz external_llvm-3bc1a3735f216f4a122fe4a05d39f63888ab205a.tar.bz2 |
Give RemoveRegOperandFromRegInfo a comment and move the
code out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index a227f25..a934b76 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/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. |