forked from OSchip/llvm-project
Change MachineInstrBuilder::addDisp to copy over target flags by default.
llvm-svn: 165677
This commit is contained in:
parent
e15fb77df8
commit
60a25a571e
|
@ -176,15 +176,24 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a displacement from an existing MachineOperand with an added offset.
|
// Add a displacement from an existing MachineOperand with an added offset.
|
||||||
const MachineInstrBuilder &addDisp(const MachineOperand &Disp,
|
const MachineInstrBuilder &addDisp(const MachineOperand &Disp, int64_t off,
|
||||||
int64_t off) const {
|
unsigned char TargetFlags = 0) const {
|
||||||
switch (Disp.getType()) {
|
switch (Disp.getType()) {
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unhandled operand type in addDisp()");
|
llvm_unreachable("Unhandled operand type in addDisp()");
|
||||||
case MachineOperand::MO_Immediate:
|
case MachineOperand::MO_Immediate:
|
||||||
return addImm(Disp.getImm() + off);
|
return addImm(Disp.getImm() + off);
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress: {
|
||||||
return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off);
|
// If caller specifies new TargetFlags then use it, otherwise the
|
||||||
|
// default behavior is to copy the target flags from the existing
|
||||||
|
// MachineOperand. This means if the caller wants to clear the
|
||||||
|
// target flags it needs to do so explicitly.
|
||||||
|
if (TargetFlags)
|
||||||
|
return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off,
|
||||||
|
TargetFlags);
|
||||||
|
return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off,
|
||||||
|
Disp.getTargetFlags());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -12329,12 +12329,9 @@ X86TargetLowering::EmitAtomicLoadArith6432(MachineInstr *MI,
|
||||||
// Hi
|
// Hi
|
||||||
MIB = BuildMI(thisMBB, DL, TII->get(LOADOpc), X86::EDX);
|
MIB = BuildMI(thisMBB, DL, TII->get(LOADOpc), X86::EDX);
|
||||||
for (unsigned i = 0; i < X86::AddrNumOperands; ++i) {
|
for (unsigned i = 0; i < X86::AddrNumOperands; ++i) {
|
||||||
if (i == X86::AddrDisp) {
|
if (i == X86::AddrDisp)
|
||||||
MIB.addDisp(MI->getOperand(MemOpndSlot + i), 4); // 4 == sizeof(i32)
|
MIB.addDisp(MI->getOperand(MemOpndSlot + i), 4); // 4 == sizeof(i32)
|
||||||
// Don't forget to transfer the target flag.
|
else
|
||||||
MachineOperand &MO = MIB->getOperand(MIB->getNumOperands()-1);
|
|
||||||
MO.setTargetFlags(MI->getOperand(MemOpndSlot + i).getTargetFlags());
|
|
||||||
} else
|
|
||||||
MIB.addOperand(MI->getOperand(MemOpndSlot + i));
|
MIB.addOperand(MI->getOperand(MemOpndSlot + i));
|
||||||
}
|
}
|
||||||
MIB.setMemRefs(MMOBegin, MMOEnd);
|
MIB.setMemRefs(MMOBegin, MMOEnd);
|
||||||
|
|
Loading…
Reference in New Issue