aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-08-28 06:25:14 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-08-28 06:25:14 +0000
commit750b270a1dd7a1c617f9dfa48a24b68216abf1c2 (patch)
treeea3a965fd9bc0e3f148f19ea174b28c61402aca4 /gcc/varasm.c
parent11315a95c7e729d82c8016e287d5a21b6fde4dc2 (diff)
downloadgcc-750b270a1dd7a1c617f9dfa48a24b68216abf1c2.zip
gcc-750b270a1dd7a1c617f9dfa48a24b68216abf1c2.tar.gz
gcc-750b270a1dd7a1c617f9dfa48a24b68216abf1c2.tar.bz2
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
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index ce3442a..8cc0633 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3871,38 +3871,38 @@ 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;
-
- 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))
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
{
- tree decl = SYMBOL_REF_DECL (x);
- if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl)))
+ const_rtx x = *iter;
+ if (GET_CODE (x) == SYMBOL_REF)
{
- n_deferred_constants--;
- output_constant_def_contents (x);
+ if (CONSTANT_POOL_ADDRESS_P (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
@@ -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