This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SH] RFA: Use new rtl iterators in sh_contains_memref_p



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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]