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>
* 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.
(const_rtx_hash_1): Take a const_rtx rather than an rtx *.
Remove the pointer to the cumulative hashval_t and just return
......@@ -3871,25 +3871,25 @@ output_constant_pool_1 (struct constant_descriptor_rtx *desc,
return;
}
/* Given a SYMBOL_REF CURRENT_RTX, mark it and all constants it refers
to as used. Emit referenced deferred strings. This function can
be used with for_each_rtx to mark all SYMBOL_REFs in an rtx. */
/* Mark all constants that are referenced by SYMBOL_REFs in X.
Emit referenced deferred strings. */
static int
mark_constant (rtx *current_rtx, void *data ATTRIBUTE_UNUSED)
static void
mark_constants_in_pattern (rtx insn)
{
rtx x = *current_rtx;
if (x == NULL_RTX || GET_CODE (x) != SYMBOL_REF)
return 0;
subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
{
const_rtx x = *iter;
if (GET_CODE (x) == SYMBOL_REF)
{
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);
iter.substitute (desc->constant);
}
}
else if (TREE_CONSTANT_POOL_ADDRESS_P (x))
......@@ -3898,11 +3898,11 @@ mark_constant (rtx *current_rtx, void *data ATTRIBUTE_UNUSED)
if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl)))
{
n_deferred_constants--;
output_constant_def_contents (x);
output_constant_def_contents (CONST_CAST_RTX (x));
}
}
}
}
return -1;
}
/* Look through appropriate parts of INSN, marking all entries in the
......@@ -3926,11 +3926,11 @@ mark_constants (rtx_insn *insn)
{
rtx subinsn = seq->element (i);
if (INSN_P (subinsn))
for_each_rtx (&PATTERN (subinsn), mark_constant, NULL);
mark_constants_in_pattern (subinsn);
}
}
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
......
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