Commit d7111da8 by Richard Sandiford Committed by Richard Sandiford

dse.c: Include rtl-iter.h.

gcc/
	* dse.c: Include rtl-iter.h.
	(check_mem_read_rtx): Change void * parameter to real type.
	Remove return value.
	(check_mem_read_use): Fix comment.  Use FOR_EACH_SUBRTX_PTR instead of
	for_each_rtx.  Don't handle null rtxes.

From-SVN: r214635
parent 42be5456
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* dse.c: Include rtl-iter.h.
(check_mem_read_rtx): Change void * parameter to real type.
Remove return value.
(check_mem_read_use): Fix comment. Use FOR_EACH_SUBRTX_PTR instead of
for_each_rtx. Don't handle null rtxes.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* df-problems.c: Include rtl-iter.h. * df-problems.c: Include rtl-iter.h.
(find_memory): Turn from being a for_each_rtx callback to being (find_memory): Turn from being a for_each_rtx callback to being
a function that examines each subrtx itself. Continue to look for a function that examines each subrtx itself. Continue to look for
......
...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "is-a.h" #include "is-a.h"
#include "gimple.h" #include "gimple.h"
#include "gimple-ssa.h" #include "gimple-ssa.h"
#include "rtl-iter.h"
/* This file contains three techniques for performing Dead Store /* This file contains three techniques for performing Dead Store
Elimination (dse). Elimination (dse).
...@@ -2087,15 +2088,13 @@ replace_read (store_info_t store_info, insn_info_t store_insn, ...@@ -2087,15 +2088,13 @@ replace_read (store_info_t store_info, insn_info_t store_insn,
} }
} }
/* A for_each_rtx callback in which DATA is the bb_info. Check to see /* Check the address of MEM *LOC and kill any appropriate stores that may
if LOC is a mem and if it is look at the address and kill any be active. */
appropriate stores that may be active. */
static int static void
check_mem_read_rtx (rtx *loc, void *data) check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
{ {
rtx mem = *loc, mem_addr; rtx mem = *loc, mem_addr;
bb_info_t bb_info;
insn_info_t insn_info; insn_info_t insn_info;
HOST_WIDE_INT offset = 0; HOST_WIDE_INT offset = 0;
HOST_WIDE_INT width = 0; HOST_WIDE_INT width = 0;
...@@ -2104,10 +2103,6 @@ check_mem_read_rtx (rtx *loc, void *data) ...@@ -2104,10 +2103,6 @@ check_mem_read_rtx (rtx *loc, void *data)
int group_id; int group_id;
read_info_t read_info; read_info_t read_info;
if (!mem || !MEM_P (mem))
return 0;
bb_info = (bb_info_t) data;
insn_info = bb_info->last_insn; insn_info = bb_info->last_insn;
if ((MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER) if ((MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER)
...@@ -2117,20 +2112,20 @@ check_mem_read_rtx (rtx *loc, void *data) ...@@ -2117,20 +2112,20 @@ check_mem_read_rtx (rtx *loc, void *data)
fprintf (dump_file, " adding wild read, volatile or barrier.\n"); fprintf (dump_file, " adding wild read, volatile or barrier.\n");
add_wild_read (bb_info); add_wild_read (bb_info);
insn_info->cannot_delete = true; insn_info->cannot_delete = true;
return 0; return;
} }
/* If it is reading readonly mem, then there can be no conflict with /* If it is reading readonly mem, then there can be no conflict with
another write. */ another write. */
if (MEM_READONLY_P (mem)) if (MEM_READONLY_P (mem))
return 0; return;
if (!canon_address (mem, &spill_alias_set, &group_id, &offset, &base)) if (!canon_address (mem, &spill_alias_set, &group_id, &offset, &base))
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " adding wild read, canon_address failure.\n"); fprintf (dump_file, " adding wild read, canon_address failure.\n");
add_wild_read (bb_info); add_wild_read (bb_info);
return 0; return;
} }
if (GET_MODE (mem) == BLKmode) if (GET_MODE (mem) == BLKmode)
...@@ -2258,7 +2253,7 @@ check_mem_read_rtx (rtx *loc, void *data) ...@@ -2258,7 +2253,7 @@ check_mem_read_rtx (rtx *loc, void *data)
width) width)
&& replace_read (store_info, i_ptr, read_info, && replace_read (store_info, i_ptr, read_info,
insn_info, loc, bb_info->regs_live)) insn_info, loc, bb_info->regs_live))
return 0; return;
/* The bases are the same, just see if the offsets /* The bases are the same, just see if the offsets
overlap. */ overlap. */
...@@ -2325,7 +2320,7 @@ check_mem_read_rtx (rtx *loc, void *data) ...@@ -2325,7 +2320,7 @@ check_mem_read_rtx (rtx *loc, void *data)
offset - store_info->begin, width) offset - store_info->begin, width)
&& replace_read (store_info, i_ptr, read_info, insn_info, loc, && replace_read (store_info, i_ptr, read_info, insn_info, loc,
bb_info->regs_live)) bb_info->regs_live))
return 0; return;
if (!store_info->alias_set) if (!store_info->alias_set)
remove = canon_true_dependence (store_info->mem, remove = canon_true_dependence (store_info->mem,
...@@ -2349,17 +2344,22 @@ check_mem_read_rtx (rtx *loc, void *data) ...@@ -2349,17 +2344,22 @@ check_mem_read_rtx (rtx *loc, void *data)
i_ptr = i_ptr->next_local_store; i_ptr = i_ptr->next_local_store;
} }
} }
return 0;
} }
/* A for_each_rtx callback in which DATA points the INSN_INFO for /* A note_uses callback in which DATA points the INSN_INFO for
as check_mem_read_rtx. Nullify the pointer if i_m_r_m_r returns as check_mem_read_rtx. Nullify the pointer if i_m_r_m_r returns
true for any part of *LOC. */ true for any part of *LOC. */
static void static void
check_mem_read_use (rtx *loc, void *data) check_mem_read_use (rtx *loc, void *data)
{ {
for_each_rtx (loc, check_mem_read_rtx, data); subrtx_ptr_iterator::array_type array;
FOR_EACH_SUBRTX_PTR (iter, array, loc, NONCONST)
{
rtx *loc = *iter;
if (MEM_P (*loc))
check_mem_read_rtx (loc, (bb_info_t) data);
}
} }
......
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