mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
LDRi12 machine instructions handle negative offset operands normally (simple
integer values), not with the addrmode2 encoding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117429 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1419,8 +1419,15 @@ bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
|
|||||||
if ((unsigned)Offset <= Mask * Scale) {
|
if ((unsigned)Offset <= Mask * Scale) {
|
||||||
// Replace the FrameIndex with sp
|
// Replace the FrameIndex with sp
|
||||||
MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false);
|
MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false);
|
||||||
if (isSub)
|
// FIXME: When addrmode2 goes away, this will simplify (like the
|
||||||
ImmedOffset |= 1 << NumBits;
|
// T2 version), as the LDR.i12 versions don't need the encoding
|
||||||
|
// tricks for the offset value.
|
||||||
|
if (isSub) {
|
||||||
|
if (AddrMode == ARMII::AddrMode_i12)
|
||||||
|
ImmedOffset = -ImmedOffset;
|
||||||
|
else
|
||||||
|
ImmedOffset |= 1 << NumBits;
|
||||||
|
}
|
||||||
ImmOp.ChangeToImmediate(ImmedOffset);
|
ImmOp.ChangeToImmediate(ImmedOffset);
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
return true;
|
return true;
|
||||||
|
@ -612,8 +612,11 @@ void ARMInstPrinter::printAddrModeImm12Operand(const MCInst *MI, unsigned OpNum,
|
|||||||
|
|
||||||
O << "[" << getRegisterName(MO1.getReg());
|
O << "[" << getRegisterName(MO1.getReg());
|
||||||
|
|
||||||
unsigned OffImm = MO2.getImm();
|
int32_t OffImm = (int32_t)MO2.getImm();
|
||||||
if (OffImm) // Don't print +0.
|
// Don't print +0.
|
||||||
|
if (OffImm < 0)
|
||||||
|
O << ", #-" << -OffImm;
|
||||||
|
else if (OffImm > 0)
|
||||||
O << ", #" << OffImm;
|
O << ", #" << OffImm;
|
||||||
O << "]";
|
O << "]";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user