diff mbox

[AArch64] Use contains_mem_rtx_p to detect memory sub-rtxes

Message ID 58A1D665.8090700@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov Feb. 13, 2017, 3:53 p.m. UTC
Hi all,

We recently (well, within the last year or two) introduced a general function to detect MEM sub-rtxes in rtlanal.c: contains_mem_rtx_p.
We can use that in aarch64.c and remove the custom has_memory_op that is defined in the same way (except that it takes an rtx_insn * instead of an rtx).

Bootstrapped and tested on aarch64-none-linux-gnu.
Committing as obvious.

Thanks,
Kyrill

2016-02-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/aarch64.c (has_memory_op): Delete.
     (aarch64_madd_needs_nop): Use contains_mem_rtx_p instead of
     has_memory_op.

Comments

Kyrill Tkachov Feb. 13, 2017, 3:55 p.m. UTC | #1
On 13/02/17 15:53, Kyrill Tkachov wrote:
> Hi all,
>
> We recently (well, within the last year or two) introduced a general function to detect MEM sub-rtxes in rtlanal.c: contains_mem_rtx_p.
> We can use that in aarch64.c and remove the custom has_memory_op that is defined in the same way (except that it takes an rtx_insn * instead of an rtx).
>
> Bootstrapped and tested on aarch64-none-linux-gnu.
> Committing as obvious.
>
> Thanks,
> Kyrill
>
> 2016-02-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * config/aarch64/aarch64.c (has_memory_op): Delete.
>     (aarch64_madd_needs_nop): Use contains_mem_rtx_p instead of
>     has_memory_op.

Committed as r245391 with the ChangeLog year fixed to the correct 2017.

Kyrill
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f72e4c4423d28af66f3bd8068eeb83060d541839..e0289dd3559f07572d581d533212105c4ca90619 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -10965,21 +10965,6 @@  aarch64_mangle_type (const_tree type)
   return NULL;
 }
 
-
-/* Return true if the rtx_insn contains a MEM RTX somewhere
-   in it.  */
-
-static bool
-has_memory_op (rtx_insn *mem_insn)
-{
-  subrtx_iterator::array_type array;
-  FOR_EACH_SUBRTX (iter, array, PATTERN (mem_insn), ALL)
-    if (MEM_P (*iter))
-      return true;
-
-  return false;
-}
-
 /* Find the first rtx_insn before insn that will generate an assembly
    instruction.  */
 
@@ -11072,7 +11057,7 @@  aarch64_madd_needs_nop (rtx_insn* insn)
      Restore recog state to INSN to avoid state corruption.  */
   extract_constrain_insn_cached (insn);
 
-  if (!prev || !has_memory_op (prev))
+  if (!prev || !contains_mem_rtx_p (PATTERN (prev)))
     return false;
 
   body = single_set (prev);