Commit c7a99fc6 by Alan Modra Committed by Alan Modra

ira.c tidies: validate_equiv_mem_from_store

	* ira.c (struct equiv_mem_data): New.
	(equiv_mem, equiv_mem_modified): Delete static vars.
	(validate_equiv_mem_from_store): Use "data" param to communicate..
	(validate_equiv_mem): ..from here.

From-SVN: r235658
parent 42ae0d7f
2016-04-30 Alan Modra <amodra@gmail.com> 2016-04-30 Alan Modra <amodra@gmail.com>
* ira.c (struct equiv_mem_data): New.
(equiv_mem, equiv_mem_modified): Delete static vars.
(validate_equiv_mem_from_store): Use "data" param to communicate..
(validate_equiv_mem): ..from here.
2016-04-30 Alan Modra <amodra@gmail.com>
* ira.c (add_store_equivs, combine_and_move_insns): New functions, * ira.c (add_store_equivs, combine_and_move_insns): New functions,
split out from.. split out from..
(update_reg_equivs): ..here. Move allocation and freeing of (update_reg_equivs): ..here. Move allocation and freeing of
......
...@@ -2926,24 +2926,29 @@ struct equivalence ...@@ -2926,24 +2926,29 @@ struct equivalence
structure for that register. */ structure for that register. */
static struct equivalence *reg_equiv; static struct equivalence *reg_equiv;
/* Used for communication between the following two functions: contains /* Used for communication between the following two functions. */
a MEM that we wish to ensure remains unchanged. */ struct equiv_mem_data
static rtx equiv_mem; {
/* A MEM that we wish to ensure remains unchanged. */
rtx equiv_mem;
/* Set nonzero if EQUIV_MEM is modified. */ /* Set true if EQUIV_MEM is modified. */
static int equiv_mem_modified; bool equiv_mem_modified;
};
/* If EQUIV_MEM is modified by modifying DEST, indicate that it is modified. /* If EQUIV_MEM is modified by modifying DEST, indicate that it is modified.
Called via note_stores. */ Called via note_stores. */
static void static void
validate_equiv_mem_from_store (rtx dest, const_rtx set ATTRIBUTE_UNUSED, validate_equiv_mem_from_store (rtx dest, const_rtx set ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED) void *data)
{ {
struct equiv_mem_data *info = (struct equiv_mem_data *) data;
if ((REG_P (dest) if ((REG_P (dest)
&& reg_overlap_mentioned_p (dest, equiv_mem)) && reg_overlap_mentioned_p (dest, info->equiv_mem))
|| (MEM_P (dest) || (MEM_P (dest)
&& anti_dependence (equiv_mem, dest))) && anti_dependence (info->equiv_mem, dest)))
equiv_mem_modified = 1; info->equiv_mem_modified = true;
} }
/* Verify that no store between START and the death of REG invalidates /* Verify that no store between START and the death of REG invalidates
...@@ -2957,16 +2962,14 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref) ...@@ -2957,16 +2962,14 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref)
{ {
rtx_insn *insn; rtx_insn *insn;
rtx note; rtx note;
struct equiv_mem_data info = { memref, false };
equiv_mem = memref;
equiv_mem_modified = 0;
/* If the memory reference has side effects or is volatile, it isn't a /* If the memory reference has side effects or is volatile, it isn't a
valid equivalence. */ valid equivalence. */
if (side_effects_p (memref)) if (side_effects_p (memref))
return 0; return 0;
for (insn = start; insn && ! equiv_mem_modified; insn = NEXT_INSN (insn)) for (insn = start; insn; insn = NEXT_INSN (insn))
{ {
if (! INSN_P (insn)) if (! INSN_P (insn))
continue; continue;
...@@ -2982,7 +2985,9 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref) ...@@ -2982,7 +2985,9 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref)
if (CALL_P (insn)) if (CALL_P (insn))
return 0; return 0;
note_stores (PATTERN (insn), validate_equiv_mem_from_store, NULL); note_stores (PATTERN (insn), validate_equiv_mem_from_store, &info);
if (info.equiv_mem_modified)
return 0;
/* If a register mentioned in MEMREF is modified via an /* If a register mentioned in MEMREF is modified via an
auto-increment, we lose the equivalence. Do the same if one auto-increment, we lose the equivalence. Do the same if one
......
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