The immediate operands of an LDRi12 instruction doesn't need the addrmode2

encoding tricks. Handle the 'imm doesn't fit in the insn' case.

llvm-svn: 117454
This commit is contained in:
Jim Grosbach 2010-10-27 16:50:31 +00:00
parent e4992c88a4
commit 8bf1483a3d
1 changed files with 6 additions and 2 deletions

View File

@ -1435,8 +1435,12 @@ bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
// Otherwise, it didn't fit. Pull in what we can to simplify the immed.
ImmedOffset = ImmedOffset & Mask;
if (isSub)
ImmedOffset |= 1 << NumBits;
if (isSub) {
if (AddrMode == ARMII::AddrMode_i12)
ImmedOffset = -ImmedOffset;
else
ImmedOffset |= 1 << NumBits;
}
ImmOp.ChangeToImmediate(ImmedOffset);
Offset &= ~(Mask*Scale);
}