This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [SH] RFA: Use new rtl iterators in sh_contains_memref_p
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "kkojima at gcc dot gnu dot org" <kkojima at gcc dot gnu dot org>, "olegendo at gcc dot gnu dot org" <olegendo at gcc dot gnu dot org>
- Date: Sat, 25 Oct 2014 19:56:47 +0200
- Subject: Re: [SH] RFA: Use new rtl iterators in sh_contains_memref_p
- Authentication-results: sourceware.org; auth=none
- References: <87tx2sv532 dot fsf at googlemail dot com>
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. */