From 3efad8fad41f6ba8141befcc3fc6662246b663ad Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Thu, 16 Dec 2010 19:11:16 +0000 Subject: [PATCH] Pseudo-ize the Thumb1 tBfar pattern. rdar://8777974 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121990 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMAsmPrinter.cpp | 8 ++++++++ lib/Target/ARM/ARMInstrThumb.td | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 267c5ddf0df..ae808914c6d 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -746,6 +746,14 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) { } return; } + case ARM::tBfar: { + MCInst TmpInst; + TmpInst.setOpcode(ARM::tBL); + TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::Create( + MI->getOperand(0).getMBB()->getSymbol(), OutContext))); + OutStreamer.EmitInstruction(TmpInst); + return; + } case ARM::LEApcrel: case ARM::tLEApcrel: case ARM::t2LEApcrel: { diff --git a/lib/Target/ARM/ARMInstrThumb.td b/lib/Target/ARM/ARMInstrThumb.td index 70aeb37eccc..56356514bdf 100644 --- a/lib/Target/ARM/ARMInstrThumb.td +++ b/lib/Target/ARM/ARMInstrThumb.td @@ -535,10 +535,11 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1 in { } // Far jump - // FIXME: Encoding. This should probably be a pseudo for tBL + // Just a pseudo for a tBL instruction. Needed to let regalloc know about + // the clobber of LR. let Defs = [LR] in - def tBfar : TIx2<0b11110, 0b11, 1, (outs), (ins brtarget:$target), IIC_Br, - "bl\t$target",[]>; + def tBfar : tPseudoInst<(outs), (ins t_bltarget:$target), + Size4Bytes, IIC_Br, []>; def tBR_JTr : tPseudoInst<(outs), (ins tGPR:$target, i32imm:$jt, i32imm:$id),