[llvm-commits] [llvm] r76889 - in /llvm/trunk/lib/Target/ARM: ARMInstrThumb.td ARMInstrThumb2.td

Evan Cheng evan.cheng at apple.com
Thu Jul 23 11:26:10 PDT 2009


Author: evancheng
Date: Thu Jul 23 13:26:03 2009
New Revision: 76889

URL: http://llvm.org/viewvc/llvm-project?rev=76889&view=rev
Log:
Since we have moved unified assembly, switch to ADR instruction instead of a the difficult-to-read .set + add syntax to materialize pc-relative address.

Turns out this also fixed a poor code selection on Thumb1. I have no idea why we were using a mov + add to do the same thing as ADR before.

Modified:
    llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
    llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td

Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=76889&r1=76888&r2=76889&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Thu Jul 23 13:26:03 2009
@@ -552,22 +552,11 @@
 
 // tLEApcrel - Load a pc-relative address into a register without offending the
 // assembler.
-let Defs = [CPSR] in {
-def tLEApcrel : T1Ix2<(outs tGPR:$dst), (ins i32imm:$label),
-               !strconcat(!strconcat(".set ${:private}PCRELV${:uid}, ($label-(",
-                                     "${:private}PCRELL${:uid}+4))\n"),
-                          !strconcat("\tmovs $dst, #${:private}PCRELV${:uid}\n",
-                             "${:private}PCRELL${:uid}:\n\tadd $dst, pc")),
-                    []>;
-
-def tLEApcrelJT : T1Ix2<(outs tGPR:$dst), (ins i32imm:$label, i32imm:$id),
-          !strconcat(!strconcat(".set ${:private}PCRELV${:uid},"
-                                " (${label}_${id:no_hash}-(",
-                                         "${:private}PCRELL${:uid}+4))\n"),
-                     !strconcat("\tmovs $dst, #${:private}PCRELV${:uid}\n",
-                                "${:private}PCRELL${:uid}:\n\tadd $dst, pc")),
-                    []>;
-}
+def tLEApcrel : T1I<(outs tGPR:$dst), (ins i32imm:$label),
+                    "adr $dst, #$label", []>;
+
+def tLEApcrelJT : T1I<(outs tGPR:$dst), (ins i32imm:$label, i32imm:$id),
+                      "adr $dst, #${label}_${id:no_hash}", []>;
 
 //===----------------------------------------------------------------------===//
 // TLS Instructions

Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=76889&r1=76888&r2=76889&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Thu Jul 23 13:26:03 2009
@@ -450,20 +450,11 @@
 // LEApcrel - Load a pc-relative address into a register without offending the
 // assembler.
 def t2LEApcrel : T2XI<(outs GPR:$dst), (ins i32imm:$label, pred:$p),
-                   !strconcat(!strconcat(".set ${:private}PCRELV${:uid}, ($label-(",
-                                         "${:private}PCRELL${:uid}+8))\n"),
-                              !strconcat("${:private}PCRELL${:uid}:\n\t",
-                                         "add$p $dst, pc, #${:private}PCRELV${:uid}")),
-                   []>;
+                      "adr$p $dst, #$label", []>;
 
 def t2LEApcrelJT : T2XI<(outs GPR:$dst),
-                       (ins i32imm:$label, i32imm:$id, pred:$p),
-   !strconcat(!strconcat(".set ${:private}PCRELV${:uid},"
-                         " (${label}_${id:no_hash}-(",
-                                  "${:private}PCRELL${:uid}+8))\n"),
-                       !strconcat("${:private}PCRELL${:uid}:\n\t",
-                                  "add$p $dst, pc, #${:private}PCRELV${:uid}")),
-                   []>;
+                        (ins i32imm:$label, i32imm:$id, pred:$p),
+                        "adr$p $dst, #${label}_${id:no_hash}", []>;
 
 // ADD rd, sp, #so_imm
 def t2ADDrSPi : T2XI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm),





More information about the llvm-commits mailing list