mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
For Thumb mode, we need to use a constant pool if the value is too large to be
used with the CMP instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bf79f91941
commit
a5871dc104
@ -5809,9 +5809,26 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||
.addImm(1)
|
||||
.addMemOperand(FIMMOLd));
|
||||
|
||||
if (NumLPads < 256) {
|
||||
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::tCMPi8))
|
||||
.addReg(NewVReg1)
|
||||
.addImm(LPadList.size()));
|
||||
.addImm(NumLPads));
|
||||
} else {
|
||||
MachineConstantPool *ConstantPool = MF->getConstantPool();
|
||||
const Constant *C =
|
||||
ConstantInt::get(Type::getInt32Ty(MF->getFunction()->getContext()),
|
||||
NumLPads);
|
||||
unsigned Idx = ConstantPool->getConstantPoolIndex(C, 4);
|
||||
|
||||
unsigned VReg1 = MRI->createVirtualRegister(TRC);
|
||||
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::tLDRpci))
|
||||
.addReg(VReg1, RegState::Define)
|
||||
.addConstantPoolIndex(Idx));
|
||||
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::tCMPr))
|
||||
.addReg(NewVReg1)
|
||||
.addReg(VReg1));
|
||||
}
|
||||
|
||||
BuildMI(DispatchBB, dl, TII->get(ARM::tBcc))
|
||||
.addMBB(TrapBB)
|
||||
.addImm(ARMCC::HI)
|
||||
|
Loading…
Reference in New Issue
Block a user