mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
Add support for using non-pic code for arm and thumb1 when emitting the sjlj
dispatch code. As far as I can tell the thumb2 code is behaving as expected. I was able to compile and run the associated test case for both arm and thumb1. rdar://13066352 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -6332,6 +6332,7 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||
MF->getOrCreateJumpTableInfo(MachineJumpTableInfo::EK_Inline);
|
||||
unsigned MJTI = JTI->createJumpTableIndex(LPadList);
|
||||
unsigned UId = AFI->createJumpTableUId();
|
||||
Reloc::Model RelocM = getTargetMachine().getRelocationModel();
|
||||
|
||||
// Create the MBBs for the dispatch code.
|
||||
|
||||
@@ -6492,11 +6493,14 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||
.addImm(0)
|
||||
.addMemOperand(JTMMOLd));
|
||||
|
||||
unsigned NewVReg6 = MRI->createVirtualRegister(TRC);
|
||||
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::tADDrr), NewVReg6)
|
||||
.addReg(ARM::CPSR, RegState::Define)
|
||||
.addReg(NewVReg5, RegState::Kill)
|
||||
.addReg(NewVReg3));
|
||||
unsigned NewVReg6 = NewVReg5;
|
||||
if (RelocM == Reloc::PIC_) {
|
||||
NewVReg6 = MRI->createVirtualRegister(TRC);
|
||||
AddDefaultPred(BuildMI(DispContBB, dl, TII->get(ARM::tADDrr), NewVReg6)
|
||||
.addReg(ARM::CPSR, RegState::Define)
|
||||
.addReg(NewVReg5, RegState::Kill)
|
||||
.addReg(NewVReg3));
|
||||
}
|
||||
|
||||
BuildMI(DispContBB, dl, TII->get(ARM::tBR_JTr))
|
||||
.addReg(NewVReg6, RegState::Kill)
|
||||
@@ -6576,11 +6580,18 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||
.addImm(0)
|
||||
.addMemOperand(JTMMOLd));
|
||||
|
||||
BuildMI(DispContBB, dl, TII->get(ARM::BR_JTadd))
|
||||
.addReg(NewVReg5, RegState::Kill)
|
||||
.addReg(NewVReg4)
|
||||
.addJumpTableIndex(MJTI)
|
||||
.addImm(UId);
|
||||
if (RelocM == Reloc::PIC_) {
|
||||
BuildMI(DispContBB, dl, TII->get(ARM::BR_JTadd))
|
||||
.addReg(NewVReg5, RegState::Kill)
|
||||
.addReg(NewVReg4)
|
||||
.addJumpTableIndex(MJTI)
|
||||
.addImm(UId);
|
||||
} else {
|
||||
BuildMI(DispContBB, dl, TII->get(ARM::BR_JTr))
|
||||
.addReg(NewVReg5, RegState::Kill)
|
||||
.addJumpTableIndex(MJTI)
|
||||
.addImm(UId);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the jump table entries as successors to the MBB.
|
||||
|
Reference in New Issue
Block a user