summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineInstr.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-29 00:37:58 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-29 00:37:58 +0000
commit699ac049517285d978ed607b2735976c5ae97ac0 (patch)
treee8e450ff1a7efcef0c33adf36bde5b5f41b1ee22 /include/llvm/CodeGen/MachineInstr.h
parent14b5bac547ac3f9da2e66d82a8ebc4a8c93af031 (diff)
downloadllvm-699ac049517285d978ed607b2735976c5ae97ac0.tar.gz
llvm-699ac049517285d978ed607b2735976c5ae97ac0.tar.bz2
llvm-699ac049517285d978ed607b2735976c5ae97ac0.tar.xz
Maintain a vaild isTied bit as operands are added and removed.
The isTied bit is set automatically when a tied use is added and MCInstrDesc indicates a tied operand. The tie is broken when one of the tied operands is removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineInstr.h')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 27756abf3f..e88351cb98 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -782,6 +782,11 @@ public:
const TargetInstrInfo *TII,
const TargetRegisterInfo *TRI) const;
+ /// findTiedOperandIdx - Given the index of a tied register operand, find the
+ /// operand it is tied to. Defs are tied to uses and vice versa. Returns the
+ /// index of the tied operand which must exist.
+ unsigned findTiedOperandIdx(unsigned OpIdx) const;
+
/// isRegTiedToUseOperand - Given the index of a register def operand,
/// check if the register def is tied to a source operand, due to either
/// two-address elimination or inline assembly constraints. Returns the
@@ -935,6 +940,13 @@ private:
/// return null.
MachineRegisterInfo *getRegInfo();
+ /// untieRegOperand - Break any tie involving OpIdx.
+ void untieRegOperand(unsigned OpIdx) {
+ const MachineOperand &MO = getOperand(OpIdx);
+ if (MO.isReg() && MO.isTied())
+ getOperand(findTiedOperandIdx(OpIdx)).setIsTied(false);
+ }
+
/// addImplicitDefUseOperands - Add all implicit def and use operands to
/// this instruction.
void addImplicitDefUseOperands();