* [alpha] RFA: Use new rtl iterators in alpha_set_memflags
@ 2014-10-25 10:15 Richard Sandiford
2014-10-27 15:07 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-10-25 10:15 UTC (permalink / raw)
To: gcc-patches; +Cc: rth
This is part of a series to remove uses of for_each_rtx from the ports.
Tested by making sure there were no code changes for gcc.dg, gcc.c-torture
and g++.dg for alpha-linux-gnu. OK to install?
Thanks,
Richard
gcc/
* config/alpha/alpha.c (alpha_set_memflags_1): Delete.
(alpha_set_memflags): Use FOR_EACH_SUBRTX_VAR.
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c 2014-10-25 09:51:29.006915284 +0100
+++ gcc/config/alpha/alpha.c 2014-10-25 09:51:29.394918743 +0100
@@ -1668,30 +1668,6 @@ alpha_secondary_reload (bool in_p, rtx x
return NO_REGS;
}
\f
-/* Subfunction of the following function. Update the flags of any MEM
- found in part of X. */
-
-static int
-alpha_set_memflags_1 (rtx *xp, void *data)
-{
- rtx x = *xp, orig = (rtx) data;
-
- if (!MEM_P (x))
- return 0;
-
- MEM_VOLATILE_P (x) = MEM_VOLATILE_P (orig);
- MEM_NOTRAP_P (x) = MEM_NOTRAP_P (orig);
- MEM_READONLY_P (x) = MEM_READONLY_P (orig);
-
- /* Sadly, we cannot use alias sets because the extra aliasing
- produced by the AND interferes. Given that two-byte quantities
- are the only thing we would be able to differentiate anyway,
- there does not seem to be any point in convoluting the early
- out of the alias check. */
-
- return -1;
-}
-
/* Given SEQ, which is an INSN list, look for any MEMs in either
a SET_DEST or a SET_SRC and copy the in-struct, unchanging, and
volatile flags from REF into each of the MEMs found. If REF is not
@@ -1713,9 +1689,26 @@ alpha_set_memflags (rtx seq, rtx ref)
&& !MEM_READONLY_P (ref))
return;
+ subrtx_var_iterator::array_type array;
for (insn = as_a <rtx_insn *> (seq); insn; insn = NEXT_INSN (insn))
if (INSN_P (insn))
- for_each_rtx (&PATTERN (insn), alpha_set_memflags_1, (void *) ref);
+ FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (insn), NONCONST)
+ {
+ rtx x = *iter;
+ if (MEM_P (x))
+ {
+ MEM_VOLATILE_P (x) = MEM_VOLATILE_P (ref);
+ MEM_NOTRAP_P (x) = MEM_NOTRAP_P (ref);
+ MEM_READONLY_P (x) = MEM_READONLY_P (ref);
+ /* Sadly, we cannot use alias sets because the extra
+ aliasing produced by the AND interferes. Given that
+ two-byte quantities are the only thing we would be
+ able to differentiate anyway, there does not seem to
+ be any point in convoluting the early out of the
+ alias check. */
+ iter.skip_subrtxes ();
+ }
+ }
else
gcc_unreachable ();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [alpha] RFA: Use new rtl iterators in alpha_set_memflags
2014-10-25 10:15 [alpha] RFA: Use new rtl iterators in alpha_set_memflags Richard Sandiford
@ 2014-10-27 15:07 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2014-10-27 15:07 UTC (permalink / raw)
To: gcc-patches, rdsandiford
On 10/25/2014 03:14 AM, Richard Sandiford wrote:
> gcc/
> * config/alpha/alpha.c (alpha_set_memflags_1): Delete.
> (alpha_set_memflags): Use FOR_EACH_SUBRTX_VAR.
Ok.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-27 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25 10:15 [alpha] RFA: Use new rtl iterators in alpha_set_memflags Richard Sandiford
2014-10-27 15:07 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).