diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-14 23:49:37 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-14 23:49:37 +0000 |
| commit | e7d3f441b50d5d87cf4bbb447a990467b9313a50 (patch) | |
| tree | c28ffb514b285d17768e31d441b05067d12c9706 | |
| parent | fab5201e22669601cc1752c6145e7d1d88631219 (diff) | |
| download | bcm5719-llvm-e7d3f441b50d5d87cf4bbb447a990467b9313a50.tar.gz bcm5719-llvm-e7d3f441b50d5d87cf4bbb447a990467b9313a50.zip | |
Handle regmasks in findRegisterDefOperandIdx().
Only accept register masks when looking for an 'overlapping' def. When
Overlap is not set, the function searches for a proper definition of
Reg.
This means MI->modifiesRegister() considers register masks, but
MI->definesRegister() doesn't.
llvm-svn: 150529
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstr.h | 1 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index 9a8ac7c029e..7f29d316ea8 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -702,6 +702,7 @@ public: /// that are not dead are skipped. If Overlap is true, then it also looks for /// defs that merely overlap the specified register. If TargetRegisterInfo is /// non-null, then it also checks if there is a def of a super-register. + /// This may also return a register mask operand when Overlap is true. int findRegisterDefOperandIdx(unsigned Reg, bool isDead = false, bool Overlap = false, const TargetRegisterInfo *TRI = NULL) const; diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 0a657341ac8..ff32a66b14c 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1045,6 +1045,10 @@ MachineInstr::findRegisterDefOperandIdx(unsigned Reg, bool isDead, bool Overlap, bool isPhys = TargetRegisterInfo::isPhysicalRegister(Reg); for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i); + // Accept regmask operands when Overlap is set. + // Ignore them when looking for a specific def operand (Overlap == false). + if (isPhys && Overlap && MO.isRegMask() && MO.clobbersPhysReg(Reg)) + return i; if (!MO.isReg() || !MO.isDef()) continue; unsigned MOReg = MO.getReg(); |

