[LLVMdev] possible thumb bug in constant islands
Jim Grosbach
grosbach at apple.com
Mon Nov 18 18:34:38 PST 2013
On Nov 18, 2013, at 3:49 PM, reed kotler <rkotler at mips.com> wrote:
> I don't know ARM hardly at all but...
>
> This comment does not seem to match the code.
> Or maybe tBfar is a BL?
What does the definition of tBfar say?
>
> Also, how does this work if the destination is greater than 2**21?
>
It doesn’t. IIRC, that’s under the category of “if people start having problems with that limit, we’ll consider complicating the code enough to deal with it."
> /// fixupUnconditionalBr - Fix up an unconditional branch whose destination is
> /// too far away to fit in its displacement field. If the LR register has been
> /// spilled in the epilogue, then we can use BL to implement a far jump.
> /// Otherwise, add an intermediate branch instruction to a branch.
> bool
> ARMConstantIslands::fixupUnconditionalBr(ImmBranch &Br) {
> MachineInstr *MI = Br.MI;
> MachineBasicBlock *MBB = MI->getParent();
> if (!isThumb1)
> llvm_unreachable("fixupUnconditionalBr is Thumb1 only!");
>
> // Use BL to implement far jump.
> Br.MaxDisp = (1 << 21) * 2;
> MI->setDesc(TII->get(ARM::tBfar));
> BBInfo[MBB->getNumber()].Size += 2;
> adjustBBOffsetsAfter(MBB);
> HasFarJump = true;
> ++NumUBrFixed;
>
> DEBUG(dbgs() << " Changed B to long jump " << *MI);
>
> return true;
> }
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list