mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
[ARM] Do not generate invalid encoding for stack adjust, even if this is just
temporary. Because of that: 1. The machine verifier was complaining on such code. 2. The generate code worked just because the thumb reduction size pass fixed the opcode. rdar://problem/20749824 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -256,14 +256,19 @@ void llvm::emitT2RegPlusImmediate(MachineBasicBlock &MBB,
|
|||||||
if (Fits) {
|
if (Fits) {
|
||||||
if (isSub) {
|
if (isSub) {
|
||||||
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr), DestReg)
|
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr), DestReg)
|
||||||
.addReg(BaseReg, RegState::Kill)
|
.addReg(BaseReg)
|
||||||
.addReg(DestReg, RegState::Kill)
|
.addReg(DestReg, RegState::Kill)
|
||||||
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
||||||
.setMIFlags(MIFlags);
|
.setMIFlags(MIFlags);
|
||||||
} else {
|
} else {
|
||||||
|
// Here we know that DestReg is not SP but we do not
|
||||||
|
// know anything about BaseReg. t2ADDrr is an invalid
|
||||||
|
// instruction is SP is used as the second argument, but
|
||||||
|
// is fine if SP is the first argument. To be sure we
|
||||||
|
// do not generate invalid encoding, put BaseReg first.
|
||||||
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2ADDrr), DestReg)
|
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2ADDrr), DestReg)
|
||||||
|
.addReg(BaseReg)
|
||||||
.addReg(DestReg, RegState::Kill)
|
.addReg(DestReg, RegState::Kill)
|
||||||
.addReg(BaseReg, RegState::Kill)
|
|
||||||
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
||||||
.setMIFlags(MIFlags);
|
.setMIFlags(MIFlags);
|
||||||
}
|
}
|
||||||
|
3839
test/CodeGen/ARM/thumb-big-stack.ll
Normal file
3839
test/CodeGen/ARM/thumb-big-stack.ll
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user