mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Change MachineInstrBuilder::addDisp to copy over target flags by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -176,15 +176,24 @@ public:
|
||||
}
|
||||
|
||||
// Add a displacement from an existing MachineOperand with an added offset.
|
||||
const MachineInstrBuilder &addDisp(const MachineOperand &Disp,
|
||||
int64_t off) const {
|
||||
const MachineInstrBuilder &addDisp(const MachineOperand &Disp, int64_t off,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
switch (Disp.getType()) {
|
||||
default:
|
||||
llvm_unreachable("Unhandled operand type in addDisp()");
|
||||
case MachineOperand::MO_Immediate:
|
||||
return addImm(Disp.getImm() + off);
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
return addGlobalAddress(Disp.getGlobal(), Disp.getOffset() + off);
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user