forked from OSchip/llvm-project
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
This commit is contained in:
parent
fab5201e22
commit
e7d3f441b5
|
@ -702,6 +702,7 @@ public:
|
||||||
/// that are not dead are skipped. If Overlap is true, then it also looks for
|
/// 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
|
/// 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.
|
/// 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,
|
int findRegisterDefOperandIdx(unsigned Reg,
|
||||||
bool isDead = false, bool Overlap = false,
|
bool isDead = false, bool Overlap = false,
|
||||||
const TargetRegisterInfo *TRI = NULL) const;
|
const TargetRegisterInfo *TRI = NULL) const;
|
||||||
|
|
|
@ -1045,6 +1045,10 @@ MachineInstr::findRegisterDefOperandIdx(unsigned Reg, bool isDead, bool Overlap,
|
||||||
bool isPhys = TargetRegisterInfo::isPhysicalRegister(Reg);
|
bool isPhys = TargetRegisterInfo::isPhysicalRegister(Reg);
|
||||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
||||||
const MachineOperand &MO = getOperand(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())
|
if (!MO.isReg() || !MO.isDef())
|
||||||
continue;
|
continue;
|
||||||
unsigned MOReg = MO.getReg();
|
unsigned MOReg = MO.getReg();
|
||||||
|
|
Loading…
Reference in New Issue