From: Richard Sandiford Date: Sun, 26 Oct 2014 10:41:22 +0000 (+0000) Subject: mips.c (mips16_rewrite_pool_refs_info): Delete. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b3dd001d52421b68aaf581018ff2bdf5b5ac5e0;p=gcc.git mips.c (mips16_rewrite_pool_refs_info): Delete. gcc/ * config/mips/mips.c (mips16_rewrite_pool_refs_info): Delete. (mips16_rewrite_pool_refs): Take the insn and constant pool as parameters. Iterate over the instruction's pattern and return void. (mips16_lay_out_constants): Update accordingly. From-SVN: r216710 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47b122066eb..a903abf060c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-10-26 Richard Sandiford + + * config/mips/mips.c (mips16_rewrite_pool_refs_info): Delete. + (mips16_rewrite_pool_refs): Take the insn and constant pool as + parameters. Iterate over the instruction's pattern and return void. + (mips16_lay_out_constants): Update accordingly. + 2014-10-26 Richard Sandiford * config/mips/mips.c (mips_kernel_reg_p): Replace with... diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index dd8a4c59115..c3a981fb5c1 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -14778,44 +14778,39 @@ mips16_rewrite_pool_constant (struct mips16_constant_pool *pool, rtx *x) } } -/* This structure is used to communicate with mips16_rewrite_pool_refs. - INSN is the instruction we're rewriting and POOL points to the current - constant pool. */ -struct mips16_rewrite_pool_refs_info { - rtx_insn *insn; - struct mips16_constant_pool *pool; -}; +/* Rewrite INSN so that constant pool references refer to the constant's + label instead. */ -/* Rewrite *X so that constant pool references refer to the constant's - label instead. DATA points to a mips16_rewrite_pool_refs_info - structure. */ - -static int -mips16_rewrite_pool_refs (rtx *x, void *data) +static void +mips16_rewrite_pool_refs (rtx_insn *insn, struct mips16_constant_pool *pool) { - struct mips16_rewrite_pool_refs_info *info = - (struct mips16_rewrite_pool_refs_info *) data; - - if (force_to_mem_operand (*x, Pmode)) - { - rtx mem = force_const_mem (GET_MODE (*x), *x); - validate_change (info->insn, x, mem, false); - } - - if (MEM_P (*x)) + subrtx_ptr_iterator::array_type array; + FOR_EACH_SUBRTX_PTR (iter, array, &PATTERN (insn), ALL) { - mips16_rewrite_pool_constant (info->pool, &XEXP (*x, 0)); - return -1; - } - - /* Don't rewrite the __mips16_rdwr symbol. */ - if (GET_CODE (*x) == UNSPEC && XINT (*x, 1) == UNSPEC_TLS_GET_TP) - return -1; + rtx *loc = *iter; - if (TARGET_MIPS16_TEXT_LOADS) - mips16_rewrite_pool_constant (info->pool, x); + if (force_to_mem_operand (*loc, Pmode)) + { + rtx mem = force_const_mem (GET_MODE (*loc), *loc); + validate_change (insn, loc, mem, false); + } - return GET_CODE (*x) == CONST ? -1 : 0; + if (MEM_P (*loc)) + { + mips16_rewrite_pool_constant (pool, &XEXP (*loc, 0)); + iter.skip_subrtxes (); + } + else + { + if (TARGET_MIPS16_TEXT_LOADS) + mips16_rewrite_pool_constant (pool, loc); + if (GET_CODE (*loc) == CONST + /* Don't rewrite the __mips16_rdwr symbol. */ + || (GET_CODE (*loc) == UNSPEC + && XINT (*loc, 1) == UNSPEC_TLS_GET_TP)) + iter.skip_subrtxes (); + } + } } /* Return whether CFG is used in mips_reorg. */ @@ -14834,7 +14829,6 @@ static void mips16_lay_out_constants (bool split_p) { struct mips16_constant_pool pool; - struct mips16_rewrite_pool_refs_info info; rtx_insn *insn, *barrier; if (!TARGET_MIPS16_PCREL_LOADS) @@ -14853,11 +14847,7 @@ mips16_lay_out_constants (bool split_p) { /* Rewrite constant pool references in INSN. */ if (USEFUL_INSN_P (insn)) - { - info.insn = insn; - info.pool = &pool; - for_each_rtx (&PATTERN (insn), mips16_rewrite_pool_refs, &info); - } + mips16_rewrite_pool_refs (insn, &pool); pool.insn_address += mips16_insn_length (insn);