* [SH] RFA: Use new rtl iterators in sh_contains_memref_p
@ 2014-10-25 10:05 Richard Sandiford
2014-10-25 18:16 ` Oleg Endo
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-10-25 10:05 UTC (permalink / raw)
To: gcc-patches; +Cc: kkojima, olegendo
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 sh-elf. OK to install?
Thanks,
Richard
gcc/
* config/sh/sh.c (sh_contains_memref_p_1): Delete.
(sh_contains_memref_p): Use FOR_EACH_SUBRTX.
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c 2014-10-25 09:51:27.049897841 +0100
+++ gcc/config/sh/sh.c 2014-10-25 09:51:27.492901789 +0100
@@ -12972,18 +12972,15 @@ shmedia_cleanup_truncate (rtx x)
so we must look at the rtl ourselves to see if any of the feeding
registers is used in a memref.
- Called by sh_contains_memref_p via for_each_rtx. */
-static int
-sh_contains_memref_p_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
-{
- return (MEM_P (*loc));
-}
-
-/* Return true iff INSN contains a MEM. */
+ Return true iff INSN contains a MEM. */
bool
sh_contains_memref_p (rtx insn)
{
- return for_each_rtx (&PATTERN (insn), &sh_contains_memref_p_1, NULL);
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
+ if (MEM_P (*iter))
+ return true;
+ return false;
}
/* Return true iff INSN loads a banked register. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [SH] RFA: Use new rtl iterators in sh_contains_memref_p
2014-10-25 10:05 [SH] RFA: Use new rtl iterators in sh_contains_memref_p Richard Sandiford
@ 2014-10-25 18:16 ` Oleg Endo
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Endo @ 2014-10-25 18:16 UTC (permalink / raw)
To: Richard Sandiford; +Cc: gcc-patches, kkojima, olegendo
On Oct 25, 2014, at 12:03 PM, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> 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 sh-elf. OK to install?
OK with me.
Cheers,
Oleg
> gcc/
> * config/sh/sh.c (sh_contains_memref_p_1): Delete.
> (sh_contains_memref_p): Use FOR_EACH_SUBRTX.
>
> Index: gcc/config/sh/sh.c
> ===================================================================
> --- gcc/config/sh/sh.c 2014-10-25 09:51:27.049897841 +0100
> +++ gcc/config/sh/sh.c 2014-10-25 09:51:27.492901789 +0100
> @@ -12972,18 +12972,15 @@ shmedia_cleanup_truncate (rtx x)
> so we must look at the rtl ourselves to see if any of the feeding
> registers is used in a memref.
>
> - Called by sh_contains_memref_p via for_each_rtx. */
> -static int
> -sh_contains_memref_p_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
> -{
> - return (MEM_P (*loc));
> -}
> -
> -/* Return true iff INSN contains a MEM. */
> + Return true iff INSN contains a MEM. */
> bool
> sh_contains_memref_p (rtx insn)
> {
> - return for_each_rtx (&PATTERN (insn), &sh_contains_memref_p_1, NULL);
> + subrtx_iterator::array_type array;
> + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
> + if (MEM_P (*iter))
> + return true;
> + return false;
> }
>
> /* Return true iff INSN loads a banked register. */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-25 17:56 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:05 [SH] RFA: Use new rtl iterators in sh_contains_memref_p Richard Sandiford
2014-10-25 18:16 ` Oleg Endo
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).