Commit 42be5456 by Richard Sandiford Committed by Richard Sandiford

df-problems.c: Include rtl-iter.h.

gcc/
	* df-problems.c: Include rtl-iter.h.
	(find_memory): Turn from being a for_each_rtx callback to being
	a function that examines each subrtx itself.  Continue to look for
	volatile references even after a nonvolatile one has been found.
	(can_move_insns_across): Update calls accordingly.

From-SVN: r214634
parent a3aa0813
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* df-problems.c: Include rtl-iter.h.
(find_memory): Turn from being a for_each_rtx callback to being
a function that examines each subrtx itself. Continue to look for
volatile references even after a nonvolatile one has been found.
(can_move_insns_across): Update calls accordingly.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* ddg.c (walk_mems_2, walk_mems_1): Delete. * ddg.c (walk_mems_2, walk_mems_1): Delete.
(insns_may_alias_p): Use FOR_EACH_SUBRTX rather than for_each_rtx (insns_may_alias_p): Use FOR_EACH_SUBRTX rather than for_each_rtx
to iterate over subrtxes. Return a bool rather than an int. to iterate over subrtxes. Return a bool rather than an int.
......
...@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "dce.h" #include "dce.h"
#include "valtrack.h" #include "valtrack.h"
#include "dumpfile.h" #include "dumpfile.h"
#include "rtl-iter.h"
/* Note that turning REG_DEAD_DEBUGGING on will cause /* Note that turning REG_DEAD_DEBUGGING on will cause
gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints
...@@ -3584,25 +3585,27 @@ df_simulate_one_insn_forwards (basic_block bb, rtx_insn *insn, bitmap live) ...@@ -3584,25 +3585,27 @@ df_simulate_one_insn_forwards (basic_block bb, rtx_insn *insn, bitmap live)
#define MEMREF_NORMAL 1 #define MEMREF_NORMAL 1
#define MEMREF_VOLATILE 2 #define MEMREF_VOLATILE 2
/* A subroutine of can_move_insns_across_p called through for_each_rtx. /* Return an OR of MEMREF_NORMAL or MEMREF_VOLATILE for the MEMs in X. */
Return either MEMREF_NORMAL or MEMREF_VOLATILE if a memory is found. */
static int static int
find_memory (rtx *px, void *data ATTRIBUTE_UNUSED) find_memory (rtx insn)
{ {
rtx x = *px; int flags = 0;
subrtx_iterator::array_type array;
if (GET_CODE (x) == ASM_OPERANDS && MEM_VOLATILE_P (x)) FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
return MEMREF_VOLATILE; {
const_rtx x = *iter;
if (!MEM_P (x)) if (GET_CODE (x) == ASM_OPERANDS && MEM_VOLATILE_P (x))
return 0; flags |= MEMREF_VOLATILE;
if (MEM_VOLATILE_P (x)) else if (MEM_P (x))
return MEMREF_VOLATILE; {
if (MEM_READONLY_P (x)) if (MEM_VOLATILE_P (x))
return 0; flags |= MEMREF_VOLATILE;
else if (!MEM_READONLY_P (x))
return MEMREF_NORMAL; flags |= MEMREF_NORMAL;
}
}
return flags;
} }
/* A subroutine of can_move_insns_across_p called through note_stores. /* A subroutine of can_move_insns_across_p called through note_stores.
...@@ -3706,8 +3709,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to, ...@@ -3706,8 +3709,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
{ {
if (volatile_insn_p (PATTERN (insn))) if (volatile_insn_p (PATTERN (insn)))
return false; return false;
memrefs_in_across |= for_each_rtx (&PATTERN (insn), find_memory, memrefs_in_across |= find_memory (insn);
NULL);
note_stores (PATTERN (insn), find_memory_stores, note_stores (PATTERN (insn), find_memory_stores,
&mem_sets_in_across); &mem_sets_in_across);
/* This is used just to find sets of the stack pointer. */ /* This is used just to find sets of the stack pointer. */
...@@ -3789,8 +3791,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to, ...@@ -3789,8 +3791,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
int mem_ref_flags = 0; int mem_ref_flags = 0;
int mem_set_flags = 0; int mem_set_flags = 0;
note_stores (PATTERN (insn), find_memory_stores, &mem_set_flags); note_stores (PATTERN (insn), find_memory_stores, &mem_set_flags);
mem_ref_flags = for_each_rtx (&PATTERN (insn), find_memory, mem_ref_flags = find_memory (insn);
NULL);
/* Catch sets of the stack pointer. */ /* Catch sets of the stack pointer. */
mem_ref_flags |= mem_set_flags; mem_ref_flags |= mem_set_flags;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment