From: Bill Wendling Date: Wed, 5 Oct 2011 23:28:57 +0000 (+0000) Subject: Get the proper call site numbers for the landing pads. Also remove a magic X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5cbef19a1d9860534a573f446970f5c65758fb66;p=oota-llvm.git Get the proper call site numbers for the landing pads. Also remove a magic number (18) for the proper addressing mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141245 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index c988c4aa0d2..7a085f5a0e3 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -5598,11 +5598,15 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const { if (!II->isEHLabel()) continue; MCSymbol *Sym = II->getOperand(0).getMCSymbol(); - if (!MMI.hasCallSiteBeginLabel(Sym)) continue; - - unsigned CallSiteNum = MMI.getCallSiteBeginLabel(Sym); - CallSiteNumToLPad[CallSiteNum].push_back(BB); - MaxCSNum = std::max(MaxCSNum, CallSiteNum); + if (!MMI.hasCallSiteLandingPad(Sym)) continue; + + SmallVectorImpl &CallSiteIdxs = MMI.getCallSiteLandingPad(Sym); + for (SmallVectorImpl::iterator + CSI = CallSiteIdxs.begin(), CSE = CallSiteIdxs.end(); + CSI != CSE; ++CSI) { + CallSiteNumToLPad[*CSI].push_back(BB); + MaxCSNum = std::max(MaxCSNum, *CSI); + } break; } } @@ -5617,6 +5621,9 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const { LPadList.push_back(*II); } + assert(!LPadList.empty() && + "No landing pad destinations for the dispatch jump table!"); + MachineJumpTableInfo *JTI = MF->getOrCreateJumpTableInfo(MachineJumpTableInfo::EK_Inline); unsigned MJTI = JTI->createJumpTableIndex(LPadList); @@ -5643,16 +5650,21 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const { .addReg(ARM::CPSR); /* - %vreg11 = t2LDRi12 , 4, pred:14, pred:%noreg; mem:Volatile LD4[%sunkaddr131] rGPR:%vreg11 - t2CMPri %vreg11, 6, pred:14, pred:%noreg, %CPSR; rGPR:%vreg11 - t2Bcc , pred:8, pred:%CPSR -*/ -/* - %vreg11 = t2LDRi12 , 4, pred:14, pred:%noreg; mem:Volatile LD4[%sunkaddr131] rGPR:%vreg11 - %vreg12 = t2LEApcrelJT , 0, pred:14, pred:%noreg; rGPR:%vreg12 - %vreg13 = t2ADDrs %vreg12, %vreg11, 18, pred:14, pred:%noreg, opt:%noreg; GPRnopc:%vreg13 rGPR:%vreg12,%vreg11 - t2BR_JT %vreg13, %vreg11, , 0; GPRnopc:%vreg13 rGPR:%vreg11 +BB#32: derived from LLVM BB %eh.sjlj.setjmp.catch + Predecessors according to CFG: BB#0 + %vreg11 = t2LDRi12 , 4, pred:14, pred:%noreg; mem:Volatile LD4[%sunkaddr131] rGPR:%vreg11 + t2CMPri %vreg11, 6, pred:14, pred:%noreg, %CPSR; rGPR:%vreg11 + t2Bcc , pred:8, pred:%CPSR + Successors according to CFG: BB#33 BB#35 + +BB#35: derived from LLVM BB %eh.sjlj.setjmp.catch + Predecessors according to CFG: BB#32 + %vreg12 = t2LEApcrelJT , 0, pred:14, pred:%noreg; rGPR:%vreg12 + %vreg13 = t2ADDrs %vreg12, %vreg11, 18, pred:14, pred:%noreg, opt:%noreg; GPRnopc:%vreg13 rGPR:%vreg12,%vreg11 + t2BR_JT %vreg13, %vreg11, , 0; GPRnopc:%vreg13 rGPR:%vreg11 + Successors according to CFG: BB#3 BB#28 BB#26 BB#24 BB#22 BB#20 BB#31 + */ FIMMO = MF->getMachineMemOperand(MachinePointerInfo::getFixedStack(FI), @@ -5669,7 +5681,7 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const { BuildMI(DispContBB, dl, TII->get(ARM::t2ADDrs), NewVReg3) .addReg(NewVReg2, RegState::Kill) .addReg(NewVReg1) - .addImm(18))); + .addImm(ARM_AM::getSORegOpc(ARM_AM::lsl, 2)))); BuildMI(DispContBB, dl, TII->get(ARM::t2BR_JT)) .addReg(NewVReg3, RegState::Kill)