From: Richard Sandiford Date: Sat, 14 Feb 2004 13:00:49 +0000 (+0000) Subject: mips-protos.h (mips_load_got_page): Delete. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=544142d816f321328d392eac4ddec58c5348de40;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e28e258ce6..7ddbfafd227 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2004-02-14 Richard Sandiford + + * 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 * config/mips/mips.h (MASK_DEBUG_[ABEFI], TARGET_DEBUG_[ABEFI]_MODE) diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index a2b1d458fc3..222c93d3b3f 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 0a69022d222..6630d58435d 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 3caa677e69d..82b52dea0c2 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.