Pseudo-ize the Thumb1 tBfar pattern. rdar://8777974
authorJim Grosbach <grosbach@apple.com>
Thu, 16 Dec 2010 19:11:16 +0000 (19:11 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 16 Dec 2010 19:11:16 +0000 (19:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121990 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/ARM/ARMInstrThumb.td

index 267c5ddf0df5426b39162c4b311e56f7f43e22ae..ae808914c6ddc2e23b97fe4c462705d6fb765472 100644 (file)
@@ -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: {
index 70aeb37eccc77f7bd2a1b8d95c322448ceb4fb45..56356514bdf7f255db17cc119b449d3860fbb7b5 100644 (file)
@@ -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),