Commit 3854efe8 by Richard Sandiford Committed by Richard Sandiford

mips.c (mips_rewrite_small_data_1): Take the context as a parameter instead of the containing MEM.

gcc/
	* config/mips/mips.c (mips_rewrite_small_data_1): Take the context
	as a parameter instead of the containing MEM.  Iterate over all
	subrtxes.  Don't return a value.
	(mips_rewrite_small_data): Update call accordingly.

From-SVN: r216708
parent 187804d4
2014-10-26 Richard Sandiford <richard.sandiford@arm.com> 2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
* config/mips/mips.c (mips_rewrite_small_data_1): Take the context
as a parameter instead of the containing MEM. Iterate over all
subrtxes. Don't return a value.
(mips_rewrite_small_data): Update call accordingly.
2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
* config/mips/mips.c: Include rtl-iter.h. * config/mips/mips.c: Include rtl-iter.h.
(mips_small_data_pattern_1): Take an rtx rather than an rtx pointer. (mips_small_data_pattern_1): Take an rtx rather than an rtx pointer.
Take the context as a parameter instead of the containing MEM. Take the context as a parameter instead of the containing MEM.
...@@ -3487,28 +3487,29 @@ mips_small_data_pattern_p (rtx op) ...@@ -3487,28 +3487,29 @@ mips_small_data_pattern_p (rtx op)
return mips_small_data_pattern_1 (op, SYMBOL_CONTEXT_LEA); return mips_small_data_pattern_1 (op, SYMBOL_CONTEXT_LEA);
} }
/* A for_each_rtx callback, used by mips_rewrite_small_data. /* Rewrite *LOC so that it refers to small data using explicit
DATA is the containing MEM, or null if none. */ relocations. CONTEXT is the context in which *LOC appears. */
static int static void
mips_rewrite_small_data_1 (rtx *loc, void *data) mips_rewrite_small_data_1 (rtx *loc, enum mips_symbol_context context)
{ {
enum mips_symbol_context context; subrtx_ptr_iterator::array_type array;
FOR_EACH_SUBRTX_PTR (iter, array, loc, ALL)
{
rtx *loc = *iter;
if (MEM_P (*loc)) if (MEM_P (*loc))
{ {
for_each_rtx (&XEXP (*loc, 0), mips_rewrite_small_data_1, *loc); mips_rewrite_small_data_1 (&XEXP (*loc, 0), SYMBOL_CONTEXT_MEM);
return -1; iter.skip_subrtxes ();
} }
else if (mips_rewrite_small_data_p (*loc, context))
context = data ? SYMBOL_CONTEXT_MEM : SYMBOL_CONTEXT_LEA; {
if (mips_rewrite_small_data_p (*loc, context))
*loc = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, *loc); *loc = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, *loc);
iter.skip_subrtxes ();
if (GET_CODE (*loc) == LO_SUM) }
return -1; else if (GET_CODE (*loc) == LO_SUM)
iter.skip_subrtxes ();
return 0; }
} }
/* Rewrite instruction pattern PATTERN so that it refers to small data /* Rewrite instruction pattern PATTERN so that it refers to small data
...@@ -3518,7 +3519,7 @@ rtx ...@@ -3518,7 +3519,7 @@ rtx
mips_rewrite_small_data (rtx pattern) mips_rewrite_small_data (rtx pattern)
{ {
pattern = copy_insn (pattern); pattern = copy_insn (pattern);
for_each_rtx (&pattern, mips_rewrite_small_data_1, NULL); mips_rewrite_small_data_1 (&pattern, SYMBOL_CONTEXT_LEA);
return pattern; return pattern;
} }
......
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