Commit 01e752d3 by Jeffrey A Law Committed by Jeff Law

cse.c (flush_hash_table): New function.

        * cse.c (flush_hash_table): New function.
        (cse_insn): Flush the hash table when we encounter a volatile asm.
        (cse_basic_block): Use flush_hash_table instead of doing it
        inline.
        * reload1.c (reload_cse_regs_1): Flush known register values if
        we encounter a volatile asm.

From-SVN: r26304
parent 3fb2a045
Thu Apr 8 19:20:18 1999 Jeffrey A Law (law@cygnus.com) Thu Apr 8 19:20:18 1999 Jeffrey A Law (law@cygnus.com)
* cse.c (flush_hash_table): New function.
(cse_insn): Flush the hash table when we encounter a volatile asm.
(cse_basic_block): Use flush_hash_table instead of doing it
inline.
* reload1.c (reload_cse_regs_1): Flush known register values if
we encounter a volatile asm.
* loop.c (strength_reduce): Re-enable Joern's loop improvements. * loop.c (strength_reduce): Re-enable Joern's loop improvements.
Thu Apr 8 09:37:40 1999 Nick Clifton <nickc@cygnus.com> Thu Apr 8 09:37:40 1999 Nick Clifton <nickc@cygnus.com>
......
...@@ -691,6 +691,7 @@ extern void dump_class PROTO((struct table_elt*)); ...@@ -691,6 +691,7 @@ extern void dump_class PROTO((struct table_elt*));
static void check_fold_consts PROTO((PTR)); static void check_fold_consts PROTO((PTR));
static struct cse_reg_info* get_cse_reg_info PROTO((int)); static struct cse_reg_info* get_cse_reg_info PROTO((int));
static void free_cse_reg_info PROTO((splay_tree_value)); static void free_cse_reg_info PROTO((splay_tree_value));
static void flush_hash_table PROTO((void));
extern int rtx_equal_function_value_matters; extern int rtx_equal_function_value_matters;
...@@ -1666,6 +1667,28 @@ merge_equiv_classes (class1, class2) ...@@ -1666,6 +1667,28 @@ merge_equiv_classes (class1, class2)
} }
} }
/* Flush the entire hash table. */
static void
flush_hash_table ()
{
int i;
struct table_elt *p;
for (i = 0; i < NBUCKETS; i++)
for (p = table[i]; p; p = table[i])
{
/* Note that invalidate can remove elements
after P in the current hash chain. */
if (GET_CODE (p->exp) == REG)
invalidate (p->exp, p->mode);
else
remove_from_table (p, i);
}
}
/* Remove from the hash table, or mark as invalid, /* Remove from the hash table, or mark as invalid,
all expressions whose values could be altered by storing in X. all expressions whose values could be altered by storing in X.
X is a register, a subreg, or a memory reference with nonvarying address X is a register, a subreg, or a memory reference with nonvarying address
...@@ -7648,6 +7671,12 @@ cse_insn (insn, libcall_insn) ...@@ -7648,6 +7671,12 @@ cse_insn (insn, libcall_insn)
invalidate (XEXP (dest, 0), GET_MODE (dest)); invalidate (XEXP (dest, 0), GET_MODE (dest));
} }
/* A volatile ASM invalidates everything. */
if (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == ASM_OPERANDS
&& MEM_VOLATILE_P (PATTERN (insn)))
flush_hash_table ();
/* Make sure registers mentioned in destinations /* Make sure registers mentioned in destinations
are safe for use in an expression to be inserted. are safe for use in an expression to be inserted.
This removes from the hash table This removes from the hash table
...@@ -8855,8 +8884,6 @@ cse_basic_block (from, to, next_branch, around_loop) ...@@ -8855,8 +8884,6 @@ cse_basic_block (from, to, next_branch, around_loop)
for (insn = from; insn != to; insn = NEXT_INSN (insn)) for (insn = from; insn != to; insn = NEXT_INSN (insn))
{ {
register enum rtx_code code = GET_CODE (insn); register enum rtx_code code = GET_CODE (insn);
int i;
struct table_elt *p;
/* If we have processed 1,000 insns, flush the hash table to /* If we have processed 1,000 insns, flush the hash table to
avoid extreme quadratic behavior. We must not include NOTEs avoid extreme quadratic behavior. We must not include NOTEs
...@@ -8869,17 +8896,7 @@ cse_basic_block (from, to, next_branch, around_loop) ...@@ -8869,17 +8896,7 @@ cse_basic_block (from, to, next_branch, around_loop)
Perhaps for 2.9. */ Perhaps for 2.9. */
if (code != NOTE && num_insns++ > 1000) if (code != NOTE && num_insns++ > 1000)
{ {
for (i = 0; i < NBUCKETS; i++) flush_hash_table ();
for (p = table[i]; p; p = table[i])
{
/* Note that invalidate can remove elements
after P in the current hash chain. */
if (GET_CODE (p->exp) == REG)
invalidate (p->exp, p->mode);
else
remove_from_table (p, i);
}
num_insns = 0; num_insns = 0;
} }
......
...@@ -8740,6 +8740,14 @@ reload_cse_regs_1 (first) ...@@ -8740,6 +8740,14 @@ reload_cse_regs_1 (first)
reload_cse_invalidate_mem (callmem); reload_cse_invalidate_mem (callmem);
} }
/* Forget all the register values at a volatile asm. */
if (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == ASM_OPERANDS
&& MEM_VOLATILE_P (PATTERN (insn)))
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
reg_values[i] = 0;
body = PATTERN (insn); body = PATTERN (insn);
if (GET_CODE (body) == SET) if (GET_CODE (body) == SET)
{ {
......
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