mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Generate the dispatch table for ARM mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141327 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e29fa1df55
commit
95ce2e9c52
@ -5685,11 +5685,11 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
|||||||
// context.
|
// context.
|
||||||
SetupEntryBlockForSjLj(MI, MBB, DispatchBB, FI);
|
SetupEntryBlockForSjLj(MI, MBB, DispatchBB, FI);
|
||||||
|
|
||||||
// Grab constant pool and fixed stack memory operands.
|
|
||||||
MachineMemOperand *FIMMOLd =
|
MachineMemOperand *FIMMOLd =
|
||||||
MF->getMachineMemOperand(MachinePointerInfo::getFixedStack(FI),
|
MF->getMachineMemOperand(MachinePointerInfo::getFixedStack(FI),
|
||||||
MachineMemOperand::MOLoad, 4, 4);
|
MachineMemOperand::MOLoad, 4, 4);
|
||||||
|
|
||||||
|
if (Subtarget->isThumb2()) {
|
||||||
unsigned NewVReg1 = MRI->createVirtualRegister(TRC);
|
unsigned NewVReg1 = MRI->createVirtualRegister(TRC);
|
||||||
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::t2LDRi12), NewVReg1)
|
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::t2LDRi12), NewVReg1)
|
||||||
.addFrameIndex(FI)
|
.addFrameIndex(FI)
|
||||||
@ -5704,7 +5704,7 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
|||||||
.addReg(ARM::CPSR);
|
.addReg(ARM::CPSR);
|
||||||
|
|
||||||
unsigned NewVReg2 = MRI->createVirtualRegister(TRC);
|
unsigned NewVReg2 = MRI->createVirtualRegister(TRC);
|
||||||
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::t2LEApcrelJT), NewVReg2)
|
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::t2LEApcrelJT),NewVReg2)
|
||||||
.addJumpTableIndex(MJTI)
|
.addJumpTableIndex(MJTI)
|
||||||
.addImm(UId));
|
.addImm(UId));
|
||||||
|
|
||||||
@ -5721,6 +5721,48 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
|||||||
.addReg(NewVReg1)
|
.addReg(NewVReg1)
|
||||||
.addJumpTableIndex(MJTI)
|
.addJumpTableIndex(MJTI)
|
||||||
.addImm(UId);
|
.addImm(UId);
|
||||||
|
} else if (Subtarget->isThumb()) {
|
||||||
|
} else {
|
||||||
|
unsigned NewVReg1 = MRI->createVirtualRegister(TRC);
|
||||||
|
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::LDRi12), NewVReg1)
|
||||||
|
.addFrameIndex(FI)
|
||||||
|
.addImm(4)
|
||||||
|
.addMemOperand(FIMMOLd));
|
||||||
|
AddDefaultPred(BuildMI(DispatchBB, dl, TII->get(ARM::CMPri))
|
||||||
|
.addReg(NewVReg1)
|
||||||
|
.addImm(LPadList.size()));
|
||||||
|
BuildMI(DispatchBB, dl, TII->get(ARM::Bcc))
|
||||||
|
.addMBB(TrapBB)
|
||||||
|
.addImm(ARMCC::HI)
|
||||||
|
.addReg(ARM::CPSR);
|
||||||
|
|
||||||
|
unsigned NewVReg2 = MRI->createVirtualRegister(TRC);
|
||||||
|
AddDefaultCC(
|
||||||
|
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::MOVsi), NewVReg2)
|
||||||
|
.addReg(NewVReg1)
|
||||||
|
.addImm(ARM_AM::getSORegOpc(ARM_AM::lsl, 2))));
|
||||||
|
unsigned NewVReg3 = MRI->createVirtualRegister(TRC);
|
||||||
|
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::LEApcrelJT), NewVReg3)
|
||||||
|
.addJumpTableIndex(MJTI)
|
||||||
|
.addImm(UId));
|
||||||
|
|
||||||
|
MachineMemOperand *JTMMOLd =
|
||||||
|
MF->getMachineMemOperand(MachinePointerInfo::getJumpTable(),
|
||||||
|
MachineMemOperand::MOLoad, 4, 4);
|
||||||
|
unsigned NewVReg4 = MRI->createVirtualRegister(TRC);
|
||||||
|
AddDefaultPred(
|
||||||
|
BuildMI(DispContBB, dl, TII->get(ARM::LDRrs), NewVReg4)
|
||||||
|
.addReg(NewVReg2, RegState::Kill)
|
||||||
|
.addReg(NewVReg3)
|
||||||
|
.addImm(0)
|
||||||
|
.addMemOperand(JTMMOLd));
|
||||||
|
|
||||||
|
BuildMI(DispContBB, dl, TII->get(ARM::BR_JTadd))
|
||||||
|
.addReg(NewVReg4, RegState::Kill)
|
||||||
|
.addReg(NewVReg3)
|
||||||
|
.addJumpTableIndex(MJTI)
|
||||||
|
.addImm(UId);
|
||||||
|
}
|
||||||
|
|
||||||
// Add the jump table entries as successors to the MBB.
|
// Add the jump table entries as successors to the MBB.
|
||||||
for (std::vector<MachineBasicBlock*>::iterator
|
for (std::vector<MachineBasicBlock*>::iterator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user