Commit 9b3dd001 by Richard Sandiford Committed by Richard Sandiford

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
parent eacbf7bd
2014-10-26 Richard Sandiford <richard.sandiford@arm.com> 2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
* 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 <richard.sandiford@arm.com>
* config/mips/mips.c (mips_kernel_reg_p): Replace with... * config/mips/mips.c (mips_kernel_reg_p): Replace with...
(mips_refers_to_kernel_reg_p): ...this new function. (mips_refers_to_kernel_reg_p): ...this new function.
(mips_expand_prologue): Update accordingly. (mips_expand_prologue): Update accordingly.
...@@ -14778,44 +14778,39 @@ mips16_rewrite_pool_constant (struct mips16_constant_pool *pool, rtx *x) ...@@ -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. /* Rewrite INSN so that constant pool references refer to the constant's
INSN is the instruction we're rewriting and POOL points to the current label instead. */
constant pool. */
struct mips16_rewrite_pool_refs_info {
rtx_insn *insn;
struct mips16_constant_pool *pool;
};
/* 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 static void
mips16_rewrite_pool_refs (rtx *x, void *data) mips16_rewrite_pool_refs (rtx_insn *insn, struct mips16_constant_pool *pool)
{ {
struct mips16_rewrite_pool_refs_info *info = subrtx_ptr_iterator::array_type array;
(struct mips16_rewrite_pool_refs_info *) data; FOR_EACH_SUBRTX_PTR (iter, array, &PATTERN (insn), ALL)
{
rtx *loc = *iter;
if (force_to_mem_operand (*x, Pmode)) if (force_to_mem_operand (*loc, Pmode))
{ {
rtx mem = force_const_mem (GET_MODE (*x), *x); rtx mem = force_const_mem (GET_MODE (*loc), *loc);
validate_change (info->insn, x, mem, false); validate_change (insn, loc, mem, false);
} }
if (MEM_P (*x)) if (MEM_P (*loc))
{ {
mips16_rewrite_pool_constant (info->pool, &XEXP (*x, 0)); mips16_rewrite_pool_constant (pool, &XEXP (*loc, 0));
return -1; iter.skip_subrtxes ();
} }
else
/* Don't rewrite the __mips16_rdwr symbol. */ {
if (GET_CODE (*x) == UNSPEC && XINT (*x, 1) == UNSPEC_TLS_GET_TP)
return -1;
if (TARGET_MIPS16_TEXT_LOADS) if (TARGET_MIPS16_TEXT_LOADS)
mips16_rewrite_pool_constant (info->pool, x); mips16_rewrite_pool_constant (pool, loc);
if (GET_CODE (*loc) == CONST
return GET_CODE (*x) == CONST ? -1 : 0; /* 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. */ /* Return whether CFG is used in mips_reorg. */
...@@ -14834,7 +14829,6 @@ static void ...@@ -14834,7 +14829,6 @@ static void
mips16_lay_out_constants (bool split_p) mips16_lay_out_constants (bool split_p)
{ {
struct mips16_constant_pool pool; struct mips16_constant_pool pool;
struct mips16_rewrite_pool_refs_info info;
rtx_insn *insn, *barrier; rtx_insn *insn, *barrier;
if (!TARGET_MIPS16_PCREL_LOADS) if (!TARGET_MIPS16_PCREL_LOADS)
...@@ -14853,11 +14847,7 @@ mips16_lay_out_constants (bool split_p) ...@@ -14853,11 +14847,7 @@ mips16_lay_out_constants (bool split_p)
{ {
/* Rewrite constant pool references in INSN. */ /* Rewrite constant pool references in INSN. */
if (USEFUL_INSN_P (insn)) if (USEFUL_INSN_P (insn))
{ mips16_rewrite_pool_refs (insn, &pool);
info.insn = insn;
info.pool = &pool;
for_each_rtx (&PATTERN (insn), mips16_rewrite_pool_refs, &info);
}
pool.insn_address += mips16_insn_length (insn); pool.insn_address += mips16_insn_length (insn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment