aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2004-02-14 13:00:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2004-02-14 13:00:49 +0000
commit544142d816f321328d392eac4ddec58c5348de40 (patch)
tree66a2d79a6650e3b1db199d1ae480bbbc9d00b0ec
parentbe8b2beefb2cf0838601d2e9bb0cb2caefc86daa (diff)
downloadgcc-544142d816f321328d392eac4ddec58c5348de40.zip
gcc-544142d816f321328d392eac4ddec58c5348de40.tar.gz
gcc-544142d816f321328d392eac4ddec58c5348de40.tar.bz2
mips-protos.h (mips_load_got_page): Delete.
* config/mips/mips-protos.h (mips_load_got_page): Delete. (mips_load_got_global): Delete. (mips_gotoff_page): Declare. * config/mips/mips.md (UNSPEC_LOAD_GOT): New constant. (*xgot_lo[sd]i, *got_disp[sd]i, *got_page[sd]i): Build an UNSPEC_LOAD_GOT pattern rather than a MEM. (*load_got[sd]i): New patterns. * config/mips/mips.c (mips_got_alias_set, mips_load_got): Delete. (mips_load_got_page, mips_load_got_global): Delete. (mips_gotoff_page): New function. (override_options): Don't initialize mips_got_alias_set. From-SVN: r77802
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/mips/mips-protos.h3
-rw-r--r--gcc/config/mips/mips.c46
-rw-r--r--gcc/config/mips/mips.md67
4 files changed, 74 insertions, 56 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e28e25..7ddbfaf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
2004-02-14 Richard Sandiford <rsandifo@redhat.com>
+ * config/mips/mips-protos.h (mips_load_got_page): Delete.
+ (mips_load_got_global): Delete.
+ (mips_gotoff_page): Declare.
+ * config/mips/mips.md (UNSPEC_LOAD_GOT): New constant.
+ (*xgot_lo[sd]i, *got_disp[sd]i, *got_page[sd]i): Build an
+ UNSPEC_LOAD_GOT pattern rather than a MEM.
+ (*load_got[sd]i): New patterns.
+ * config/mips/mips.c (mips_got_alias_set, mips_load_got): Delete.
+ (mips_load_got_page, mips_load_got_global): Delete.
+ (mips_gotoff_page): New function.
+ (override_options): Don't initialize mips_got_alias_set.
+
+2004-02-14 Richard Sandiford <rsandifo@redhat.com>
+
* config/mips/mips.h (MASK_DEBUG_[ABEFI], TARGET_DEBUG_[ABEFI]_MODE)
(TARGET_MIPS4100, TARGET_MIPS4300, TARGET_MIPS4KC, TARGET_MIPS5KC)
(TARGET_SB1, TUNE_SB1, TUNE_SR71K, BIGGEST_MAX_ARGS_IN_REGISTERS)
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index a2b1d45..222c93d 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -32,9 +32,8 @@ extern int mips_const_insns (rtx);
extern int mips_fetch_insns (rtx);
extern bool mips_legitimate_address_p (enum machine_mode, rtx, int);
extern bool mips_legitimize_address (rtx *, enum machine_mode);
+extern rtx mips_gotoff_page (rtx);
extern rtx mips_gotoff_global (rtx);
-extern rtx mips_load_got_page (rtx);
-extern rtx mips_load_got_global (rtx, rtx);
extern bool mips_legitimize_move (enum machine_mode, rtx, rtx);
extern int m16_uimm3_b (rtx, enum machine_mode);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 0a69022..6630d58 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -198,7 +198,6 @@ static rtx mips_force_temporary (rtx, rtx);
static rtx mips_split_symbol (rtx, rtx);
static rtx mips_unspec_address (rtx, enum mips_symbol_type);
static rtx mips_unspec_offset_high (rtx, rtx, rtx, enum mips_symbol_type);
-static rtx mips_load_got (rtx, rtx, enum mips_symbol_type);
static rtx mips_add_offset (rtx, HOST_WIDE_INT);
static unsigned int mips_build_shift (struct mips_integer_op *, HOST_WIDE_INT);
static unsigned int mips_build_lower (struct mips_integer_op *,
@@ -537,9 +536,6 @@ char mips_print_operand_punct[256];
/* Map GCC register number to debugger register number. */
int mips_dbx_regno[FIRST_PSEUDO_REGISTER];
-/* An alias set for the GOT. */
-static GTY(()) int mips_got_alias_set;
-
/* A copy of the original flag_delayed_branch: see override_options. */
static int mips_flag_delayed_branch;
@@ -1744,24 +1740,12 @@ mips_unspec_offset_high (rtx temp, rtx base, rtx addr,
}
-/* Return a memory reference for the GOT slot whose offset is given by
- mips_unspec_address (ADDR, SYMBOL_TYPE). Register BASE contains the
- high part of the offset plus $gp. */
+/* Return the offset of a GOT page entry for local address ADDR. */
-static rtx
-mips_load_got (rtx base, rtx addr, enum mips_symbol_type symbol_type)
+rtx
+mips_gotoff_page (rtx addr)
{
- rtx mem, offset;
-
- offset = mips_unspec_address (addr, symbol_type);
- mem = gen_rtx_MEM (ptr_mode, gen_rtx_LO_SUM (Pmode, base, offset));
- set_mem_alias_set (mem, mips_got_alias_set);
-
- /* GOT entries are constant and references to them can't trap. */
- RTX_UNCHANGING_P (mem) = 1;
- MEM_NOTRAP_P (mem) = 1;
-
- return mem;
+ return mips_unspec_address (addr, SYMBOL_GOTOFF_PAGE);
}
@@ -1775,25 +1759,6 @@ mips_gotoff_global (rtx addr)
}
-/* Fetch the high part of local_got_operand ADDR from the GOT. */
-
-rtx
-mips_load_got_page (rtx addr)
-{
- return mips_load_got (pic_offset_table_rtx, addr, SYMBOL_GOTOFF_PAGE);
-}
-
-
-/* Fetch the address of global_got_operand ADDR from the GOT. BASE is a
- register that holds the address _gp + %got_hi(ADDR). */
-
-rtx
-mips_load_got_global (rtx base, rtx addr)
-{
- return mips_load_got (base, addr, SYMBOL_GOTOFF_GLOBAL);
-}
-
-
/* Return a legitimate address for REG + OFFSET. This function will
create a temporary register if OFFSET is not a SMALL_OPERAND. */
@@ -5080,9 +5045,6 @@ override_options (void)
/* Function to allocate machine-dependent function status. */
init_machine_status = &mips_init_machine_status;
- /* Create a unique alias set for GOT references. */
- mips_got_alias_set = new_alias_set ();
-
if (TARGET_EXPLICIT_RELOCS || mips_split_addresses)
{
mips_split_p[SYMBOL_GENERAL] = true;
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 3caa677..82b52de 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -55,6 +55,7 @@
(UNSPEC_SDR 25)
(UNSPEC_LOADGP 26)
(UNSPEC_LOAD_CALL 27)
+ (UNSPEC_LOAD_GOT 28)
(UNSPEC_ADDRESS_FIRST 100)
@@ -4170,8 +4171,9 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 3))]
- { operands[3] = mips_load_got_global (operands[1], operands[2]); }
+ [(set (match_dup 0)
+ (unspec:SI [(match_dup 1) (match_dup 3)] UNSPEC_LOAD_GOT))]
+ { operands[3] = mips_gotoff_global (operands[2]); }
[(set_attr "got" "load")])
(define_insn_and_split "*xgot_hidi"
@@ -4195,8 +4197,9 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 3))]
- { operands[3] = mips_load_got_global (operands[1], operands[2]); }
+ [(set (match_dup 0)
+ (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LOAD_GOT))]
+ { operands[3] = mips_gotoff_global (operands[2]); }
[(set_attr "got" "load")])
;; Insns to fetch a global symbol from a normal GOT.
@@ -4207,8 +4210,12 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS && !TARGET_XGOT"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 2))]
- { operands[2] = mips_load_got_global (pic_offset_table_rtx, operands[1]); }
+ [(set (match_dup 0)
+ (unspec:SI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
+{
+ operands[2] = pic_offset_table_rtx;
+ operands[3] = mips_gotoff_global (operands[1]);
+}
[(set_attr "got" "load")])
(define_insn_and_split "*got_dispdi"
@@ -4217,8 +4224,12 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS && !TARGET_XGOT"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 2))]
- { operands[2] = mips_load_got_global (pic_offset_table_rtx, operands[1]); }
+ [(set (match_dup 0)
+ (unspec:DI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
+{
+ operands[2] = pic_offset_table_rtx;
+ operands[3] = mips_gotoff_global (operands[1]);
+}
[(set_attr "got" "load")])
;; Insns for loading the high part of a local symbol.
@@ -4229,8 +4240,12 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 2))]
- { operands[2] = mips_load_got_page (operands[1]); }
+ [(set (match_dup 0)
+ (unspec:SI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
+{
+ operands[2] = pic_offset_table_rtx;
+ operands[3] = mips_gotoff_page (operands[1]);
+}
[(set_attr "got" "load")])
(define_insn_and_split "*got_pagedi"
@@ -4239,10 +4254,38 @@ dsrl\t%3,%3,1\n\
"TARGET_EXPLICIT_RELOCS"
"#"
"&& reload_completed"
- [(set (match_dup 0) (match_dup 2))]
- { operands[2] = mips_load_got_page (operands[1]); }
+ [(set (match_dup 0)
+ (unspec:DI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
+{
+ operands[2] = pic_offset_table_rtx;
+ operands[3] = mips_gotoff_page (operands[1]);
+}
[(set_attr "got" "load")])
+;; Lower-level instructions for loading an address from the GOT.
+;; We could use MEMs, but an unspec gives more optimization
+;; opportunities.
+
+(define_insn "*load_gotsi"
+ [(set (match_operand:SI 0 "register_operand" "=d")
+ (unspec:SI [(match_operand:SI 1 "register_operand" "d")
+ (match_operand:SI 2 "immediate_operand" "")]
+ UNSPEC_LOAD_GOT))]
+ "TARGET_ABICALLS"
+ "lw\t%0,%R2(%1)"
+ [(set_attr "type" "load")
+ (set_attr "length" "4")])
+
+(define_insn "*load_gotdi"
+ [(set (match_operand:DI 0 "register_operand" "=d")
+ (unspec:DI [(match_operand:DI 1 "register_operand" "d")
+ (match_operand:DI 2 "immediate_operand" "")]
+ UNSPEC_LOAD_GOT))]
+ "TARGET_ABICALLS"
+ "ld\t%0,%R2(%1)"
+ [(set_attr "type" "load")
+ (set_attr "length" "4")])
+
;; Instructions for adding the low 16 bits of an address to a register.
;; Operand 2 is the address: print_operand works out which relocation
;; should be applied.