mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +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:
parent
6ff3ac67e0
commit
131da40ffd
@ -256,14 +256,19 @@ void llvm::emitT2RegPlusImmediate(MachineBasicBlock &MBB,
|
||||
if (Fits) {
|
||||
if (isSub) {
|
||||
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr), DestReg)
|
||||
.addReg(BaseReg, RegState::Kill)
|
||||
.addReg(BaseReg)
|
||||
.addReg(DestReg, RegState::Kill)
|
||||
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
||||
.setMIFlags(MIFlags);
|
||||
} 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)
|
||||
.addReg(BaseReg)
|
||||
.addReg(DestReg, RegState::Kill)
|
||||
.addReg(BaseReg, RegState::Kill)
|
||||
.addImm((unsigned)Pred).addReg(PredReg).addReg(0)
|
||||
.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
Loading…
Reference in New Issue
Block a user