mips.md (loadgp): Take $25 as a second operand.
authorRichard Sandiford <rsandifo@redhat.com>
Fri, 7 Nov 2003 08:14:32 +0000 (08:14 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 7 Nov 2003 08:14:32 +0000 (08:14 +0000)
* config/mips/mips.md (loadgp): Take $25 as a second operand.
* config/mips/mips.c (mips_expand_prologue): Modify accordingly.

From-SVN: r73330

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/mips/mips.md

index f9c4da7350d17c0b6983aa2ec155fa06a7ba1a49..565c30a472f862989e66678e669b12532e40b5a1 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-07  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips.md (loadgp): Take $25 as a second operand.
+       * config/mips/mips.c (mips_expand_prologue): Modify accordingly.
+
 2003-11-06  Matt Austern <austern@apple.com>
 
        * c-common.c (handle_visibility_attribute): Set DECL_VISIBILITY
index 8d2c780990cbeadf7f4a6ee8b470abecb6239009..9b2bc2f257da47ab166b730978f8d1667cdd70a4 100644 (file)
@@ -6655,11 +6655,12 @@ mips_expand_prologue (void)
   /* If generating n32/n64 abicalls, emit the instructions to load $gp.  */
   if (TARGET_ABICALLS && TARGET_NEWABI && cfun->machine->global_pointer > 0)
     {
-      rtx addr, offset;
+      rtx addr, offset, incoming_address;
 
       addr = XEXP (DECL_RTL (current_function_decl), 0);
       offset = mips_unspec_address (addr, SYMBOL_GOTOFF_LOADGP);
-      emit_insn (gen_loadgp (offset));
+      incoming_address = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
+      emit_insn (gen_loadgp (offset, incoming_address));
       if (!TARGET_EXPLICIT_RELOCS)
        emit_insn (gen_loadgp_blockage ());
     }
index ebe4beb80d84a4eb6eae98a5a6a996c7100a60dd..5a4e89eb8ca35e60f29639eaf2440dca1de4be70 100644 (file)
@@ -5123,20 +5123,23 @@ dsrl\t%3,%3,1\n\
    (set_attr "mode"    "SF")
    (set_attr "length"  "4")])
 
+;; Insn to initialize $gp for n32/n64 abicalls.  Operand 0 is the offset
+;; of _gp from the start of this function.  Operand 1 is the incoming
+;; function address.
 (define_insn_and_split "loadgp"
-  [(unspec_volatile [(match_operand 0 "" "")] UNSPEC_LOADGP)]
+  [(unspec_volatile [(match_operand 0 "" "")
+                    (match_operand 1 "register_operand" "")] UNSPEC_LOADGP)]
   "TARGET_ABICALLS && TARGET_NEWABI"
   "#"
   ""
-  [(set (match_dup 1) (match_dup 2))
-   (set (match_dup 1) (match_dup 3))
-   (set (match_dup 1) (match_dup 4))]
-{
-  operands[1] = pic_offset_table_rtx;
-  operands[2] = gen_rtx_HIGH (Pmode, operands[0]);
-  operands[3] = gen_rtx_PLUS (Pmode, operands[1],
-                             gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM));
-  operands[4] = gen_rtx_LO_SUM (Pmode, operands[1], operands[0]);
+  [(set (match_dup 2) (match_dup 3))
+   (set (match_dup 2) (match_dup 4))
+   (set (match_dup 2) (match_dup 5))]
+{
+  operands[2] = pic_offset_table_rtx;
+  operands[3] = gen_rtx_HIGH (Pmode, operands[0]);
+  operands[4] = gen_rtx_PLUS (Pmode, operands[2], operands[1]);
+  operands[5] = gen_rtx_LO_SUM (Pmode, operands[2], operands[0]);
 }
   [(set_attr "length" "12")])