[Darwin, PPC, Mode Iterators 2/n] Eliminate picbase expanders.
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 26 Sep 2019 18:50:55 +0000 (18:50 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Thu, 26 Sep 2019 18:50:55 +0000 (18:50 +0000)
We can use the mode iterators directly with an @pattern to avoid the
need for an expander that was only there to pass the mode through.

gcc/ChangeLog:

2019-09-26  Iain Sandoe  <iain@sandoe.co.uk>

* config/rs6000/darwin.md: Replace the expanders for
load_macho_picbase and reload_macho_picbase with use of '@'
in their respective define_insns.
(nonlocal_goto_receiver): Pass Pmode to gen_reload_macho_picbase.
* config/rs6000/rs6000-logue.c (rs6000_emit_prologue): Pass
Pmode to gen_load_macho_picbase.
* config/rs6000/rs6000.md: Likewise.

From-SVN: r276159

gcc/ChangeLog
gcc/config/rs6000/darwin.md
gcc/config/rs6000/rs6000-logue.c
gcc/config/rs6000/rs6000.md

index 1358d4b..9bbae7a 100644 (file)
@@ -1,3 +1,13 @@
+2019-09-26  Iain Sandoe  <iain@sandoe.co.uk>
+
+       * config/rs6000/darwin.md: Replace the expanders for
+       load_macho_picbase and reload_macho_picbase with use of '@'
+       and <mode> in their respective define_insns.
+       (nonlocal_goto_receiver): Pass Pmode to gen_reload_macho_picbase.
+       * config/rs6000/rs6000-logue.c (rs6000_emit_prologue): Pass
+       Pmode to gen_load_macho_picbase.
+       * config/rs6000/rs6000.md: Likewise.
+
 2019-09-25  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/91896
index 4a28421..a5c5a3a 100644 (file)
@@ -216,21 +216,7 @@ You should have received a copy of the GNU General Public License
        (match_dup 2))]
   "")
 
-(define_expand "load_macho_picbase"
-  [(set (reg LR_REGNO)
-        (unspec [(match_operand 0 "")]
-                   UNSPEC_LD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
-{
-  if (TARGET_32BIT)
-    emit_insn (gen_load_macho_picbase_si (operands[0]));
-  else
-    emit_insn (gen_load_macho_picbase_di (operands[0]));
-
-  DONE;
-})
-
-(define_insn "load_macho_picbase_<mode>"
+(define_insn "@load_macho_picbase_<mode>"
   [(set (reg:P LR_REGNO)
        (unspec:P [(match_operand:P 0 "immediate_operand" "s")
                    (pc)] UNSPEC_LD_MPIC))]
@@ -284,21 +270,7 @@ You should have received a copy of the GNU General Public License
   "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
   [(set_attr "length" "8")])
 
-(define_expand "reload_macho_picbase"
-  [(set (reg LR_REGNO)
-        (unspec [(match_operand 0 "")]
-                   UNSPEC_RELD_MPIC))]
-  "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
-{
-  if (TARGET_32BIT)
-    emit_insn (gen_reload_macho_picbase_si (operands[0]));
-  else
-    emit_insn (gen_reload_macho_picbase_di (operands[0]));
-
-  DONE;
-})
-
-(define_insn "reload_macho_picbase_<mode>"
+(define_insn "@reload_macho_picbase_<mode>"
   [(set (reg:P LR_REGNO)
         (unspec:P [(match_operand:P 0 "immediate_operand" "s")
                    (pc)] UNSPEC_RELD_MPIC))]
@@ -342,7 +314,7 @@ You should have received a copy of the GNU General Public License
       ASM_GENERATE_INTERNAL_LABEL(tmplab, "Lnlgr", ++n);
       tmplrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
 
-      emit_insn (gen_reload_macho_picbase (tmplrtx));
+      emit_insn (gen_reload_macho_picbase (Pmode, tmplrtx));
       emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
       emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplrtx));
     }
index 633a253..e98893a 100644 (file)
@@ -3809,7 +3809,7 @@ rs6000_emit_prologue (void)
       if (!info->lr_save_p)
        emit_move_insn (gen_rtx_REG (Pmode, 0), lr);
 
-      emit_insn (gen_load_macho_picbase (src));
+      emit_insn (gen_load_macho_picbase (Pmode, src));
 
       emit_move_insn (gen_rtx_REG (Pmode,
                                   RS6000_PIC_OFFSET_TABLE_REGNUM),
index 4dbf85b..c5443ba 100644 (file)
                                  CODE_LABEL_NUMBER (operands[0]));
       tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
 
-      emit_insn (gen_load_macho_picbase (tmplabrtx));
+      emit_insn (gen_load_macho_picbase (Pmode, tmplabrtx));
       emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
       emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
     }