Improve alias analysis on ia64
authorBernd Schmidt <bernds@redhat.com>
Fri, 29 Dec 2000 18:18:50 +0000 (18:18 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Fri, 29 Dec 2000 18:18:50 +0000 (18:18 +0000)
From-SVN: r38549

gcc/ChangeLog
gcc/config/ia64/ia64-protos.h
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.md

index 7da40b92427d4137ed083e3c7ff69b3e39d3cbb7..dcd8be951f7af6e4412caee6ed4185ca94421525 100644 (file)
@@ -1,5 +1,15 @@
 2000-12-29  Bernd Schmidt  <bernds@redhat.com>
 
+       * ia64.c (ia64_expand_load_address): Accept additional scratch
+       register argument.  All callers & prototype changed.
+       Use scratch register when generating load_symptr insns.
+       * ia64.md (movdi_symbolic): Clobber a scratch register.  Use it
+       when calling ia64_expand_load_address.
+       (movdi): Generate movdi_symbolic with additional operand.
+       (load_gprel64): Use pic_offset_table_rtx instead of (reg:DI 1).
+       (load_symptr): Likewise.  Use additional operand as a scratch
+       register instead of generating it here.
+
        * basic-block.h: Add a comment.
        * flow.c (PROP_POSTRELOAD): New macro.
        (update_life_info): Add it to prop_flags.
index cb076c779a48cb6b425ea80e18df10f8c51bff65..d3eefe66abbcbd4d002d53f2625aab70d77a2fca 100644 (file)
@@ -81,7 +81,7 @@ extern void ia64_function_prologue PARAMS((FILE *, int));
 extern void ia64_function_epilogue PARAMS((FILE *, int));
 
 extern int ia64_direct_return PARAMS((void));
-extern void ia64_expand_load_address PARAMS((rtx, rtx));
+extern void ia64_expand_load_address PARAMS((rtx, rtx, rtx));
 extern int ia64_hard_regno_rename_ok PARAMS((int, int));
 
 extern void ia64_initialize_trampoline PARAMS((rtx, rtx, rtx));
index 990fe6279dfe9bdffac2f980e278a21ae8751a6b..d4538664570151363cf34d693e72d1f094971ba9 100644 (file)
@@ -798,8 +798,8 @@ ia64_depz_field_mask (rop, rshift)
 /* ??? Should generalize this, so that we can also support 32 bit pointers.  */
 
 void
-ia64_expand_load_address (dest, src)
-      rtx dest, src;
+ia64_expand_load_address (dest, src, scratch)
+      rtx dest, src, scratch;
 {
   rtx temp;
 
@@ -831,11 +831,22 @@ ia64_expand_load_address (dest, src)
       lo = ((ofs & 0x3fff) ^ 0x2000) - 0x2000;
       hi = ofs - lo;
 
-      emit_insn (gen_load_symptr (subtarget, plus_constant (sym, hi)));
+      if (! scratch)
+       scratch = no_new_pseudos ? subtarget : gen_reg_rtx (DImode);
+
+      emit_insn (gen_load_symptr (subtarget, plus_constant (sym, hi),
+                                 scratch));
       emit_insn (gen_adddi3 (temp, subtarget, GEN_INT (lo)));
     }
   else
-    emit_insn (gen_load_symptr (temp, src));
+    {
+      rtx insn;
+      if (! scratch)
+       scratch = no_new_pseudos ? temp : gen_reg_rtx (DImode);
+
+      insn = emit_insn (gen_load_symptr (temp, src, scratch));
+      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, src, REG_NOTES (insn));
+    }
 
   if (temp != dest)
     emit_move_insn (dest, temp);
index 25660fe1082c8761051ef6bdf78bd093b44396a3..fab94903ca840cea578fb05628238f9d7bf3cb33 100644 (file)
       if (rtx_equal_function_value_matters
          && ! (GET_CODE (operands[1]) == SYMBOL_REF
                && SYMBOL_REF_FLAG (operands[1])))
-       emit_insn (gen_movdi_symbolic (operands[0], operands[1]));
+       emit_insn (gen_movdi_symbolic (operands[0], operands[1], gen_reg_rtx (DImode)));
       else
-        ia64_expand_load_address (operands[0], operands[1]);
+        ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
       DONE;
     }
 }")
 (define_insn_and_split "movdi_symbolic"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (match_operand:DI 1 "symbolic_operand" "s"))
+   (clobber (match_operand:DI  2 "register_operand" "+r"))
    (use (reg:DI 1))]
   ""
   "* abort ();"
   ""
   [(const_int 0)]
-  "ia64_expand_load_address (operands[0], operands[1]); DONE;")
+  "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")
 
 (define_insn "*movdi_internal_astep"
   [(set (match_operand:DI 0 "destination_operand"
   [(const_int 0)]
   "
 {
-  ia64_expand_load_address (operands[0], operands[1]);
+  ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
   DONE;
 }")
 
 
 (define_expand "load_gprel64"
   [(set (match_dup 2)
-       (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))
+       (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
    (set (match_operand:DI 0 "register_operand" "")
-       (plus:DI (reg:DI 1) (match_dup 2)))]
+       (plus:DI (match_dup 3) (match_dup 2)))]
   ""
   "
 {
   operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
+  operands[3] = pic_offset_table_rtx;
 }")
 
 (define_expand "load_symptr"
-  [(set (match_dup 2)
-       (plus:DI (reg:DI 1) (match_operand:DI 1 "got_symbolic_operand" "")))
+  [(set (match_operand:DI 2 "register_operand" "")
+       (plus:DI (match_dup 4) (match_operand:DI 1 "got_symbolic_operand" "")))
    (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
   ""
   "
 {
-  operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
   operands[3] = gen_rtx_MEM (DImode, operands[2]);
+  operands[4] = pic_offset_table_rtx;
   RTX_UNCHANGING_P (operands[3]) = 1;
 }")