Commit 750b270a by Richard Sandiford Committed by Richard Sandiford

varasm.c (mark_constant): Replace this for_each_rtx callback with...

gcc/
	* varasm.c (mark_constant): Replace this for_each_rtx callback with...
	(mark_constants_in_pattern): ...this new function to iterate over
	all the subrtxes.
	(mark_constants): Update accordingly.

From-SVN: r214666
parent 11315a95
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* varasm.c (mark_constant): Replace this for_each_rtx callback with...
(mark_constants_in_pattern): ...this new function to iterate over
all the subrtxes.
(mark_constants): Update accordingly.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* varasm.c: Include rtl-iter.h. * varasm.c: Include rtl-iter.h.
(const_rtx_hash_1): Take a const_rtx rather than an rtx *. (const_rtx_hash_1): Take a const_rtx rather than an rtx *.
Remove the pointer to the cumulative hashval_t and just return Remove the pointer to the cumulative hashval_t and just return
...@@ -3871,38 +3871,38 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc, ...@@ -3871,38 +3871,38 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
return; return;
} }
/* Given a SYMBOL_REF CURRENT_RTX, mark it and all constants it refers /* Mark all constants that are referenced by SYMBOL_REFs in X.
to as used. Emit referenced deferred strings. This function can Emit referenced deferred strings. */
be used with for_each_rtx to mark all SYMBOL_REFs in an rtx. */
static int static void
mark_constant (rtx *current_rtx, void *data ATTRIBUTE_UNUSED) mark_constants_in_pattern (rtx insn)
{ {
rtx x = *current_rtx; subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
if (x == NULL_RTX || GET_CODE (x) != SYMBOL_REF)
return 0;
if (CONSTANT_POOL_ADDRESS_P (x))
{
struct constant_descriptor_rtx *desc = SYMBOL_REF_CONSTANT (x);
if (desc->mark == 0)
{
desc->mark = 1;
for_each_rtx (&desc->constant, mark_constant, NULL);
}
}
else if (TREE_CONSTANT_POOL_ADDRESS_P (x))
{ {
tree decl = SYMBOL_REF_DECL (x); const_rtx x = *iter;
if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl))) if (GET_CODE (x) == SYMBOL_REF)
{ {
n_deferred_constants--; if (CONSTANT_POOL_ADDRESS_P (x))
output_constant_def_contents (x); {
struct constant_descriptor_rtx *desc = SYMBOL_REF_CONSTANT (x);
if (desc->mark == 0)
{
desc->mark = 1;
iter.substitute (desc->constant);
}
}
else if (TREE_CONSTANT_POOL_ADDRESS_P (x))
{
tree decl = SYMBOL_REF_DECL (x);
if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl)))
{
n_deferred_constants--;
output_constant_def_contents (CONST_CAST_RTX (x));
}
}
} }
} }
return -1;
} }
/* Look through appropriate parts of INSN, marking all entries in the /* Look through appropriate parts of INSN, marking all entries in the
...@@ -3926,11 +3926,11 @@ mark_constants (rtx_insn *insn) ...@@ -3926,11 +3926,11 @@ mark_constants (rtx_insn *insn)
{ {
rtx subinsn = seq->element (i); rtx subinsn = seq->element (i);
if (INSN_P (subinsn)) if (INSN_P (subinsn))
for_each_rtx (&PATTERN (subinsn), mark_constant, NULL); mark_constants_in_pattern (subinsn);
} }
} }
else else
for_each_rtx (&PATTERN (insn), mark_constant, NULL); mark_constants_in_pattern (insn);
} }
/* Look through the instructions for this function, and mark all the /* Look through the instructions for this function, and mark all the
......
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