From 0875baa09e1786e1c6d8daaabcb65b8ee6309184 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 16 Jan 2001 05:57:17 -0800 Subject: [PATCH] flow.c (struct propagate_block_info): Add mem_set_list_len. * flow.c (struct propagate_block_info): Add mem_set_list_len. (MAX_MEM_SET_LIST_LEN): New. (propagate_one_insn): Update mem_set_list_len. (invalidate_mems_from_autoinc): Likewise. (invalidate_mems_from_set): Likewise. (mark_used_regs): Likewise. (init_propagate_block_info): Likewise. Stop collecting memories when we reach MAX_MEM_SET_LIST_LEN. (mark_set_1): Likewise. From-SVN: r39065 --- gcc/ChangeLog | 12 ++++++++++++ gcc/flow.c | 27 ++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4d8d7958d1..063c8d41562 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2001-01-16 Richard Henderson + + * flow.c (struct propagate_block_info): Add mem_set_list_len. + (MAX_MEM_SET_LIST_LEN): New. + (propagate_one_insn): Update mem_set_list_len. + (invalidate_mems_from_autoinc): Likewise. + (invalidate_mems_from_set): Likewise. + (mark_used_regs): Likewise. + (init_propagate_block_info): Likewise. Stop collecting memories + when we reach MAX_MEM_SET_LIST_LEN. + (mark_set_1): Likewise. + 2001-01-16 Richard Henderson * unroll.c (precondition_loop_p): Fail if no iteration diff --git a/gcc/flow.c b/gcc/flow.c index 734063848d7..acd25f2b410 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -316,6 +316,9 @@ struct propagate_block_info regset reg_cond_reg; #endif + /* The length of mem_set_list. */ + int mem_set_list_len; + /* Non-zero if the value of CC0 is live. */ int cc0_live; @@ -323,6 +326,10 @@ struct propagate_block_info int flags; }; +/* Maximum length of pbi->mem_set_list before we start dropping + new elements on the floor. */ +#define MAX_MEM_SET_LIST_LEN 100 + /* Store the data structures necessary for depth-first search. */ struct depth_first_search_dsS { /* stack for backtracking during the algorithm */ @@ -3877,7 +3884,10 @@ propagate_one_insn (pbi, insn) /* Non-constant calls clobber memory. */ if (! CONST_CALL_P (insn)) - free_EXPR_LIST_list (&pbi->mem_set_list); + { + free_EXPR_LIST_list (&pbi->mem_set_list); + pbi->mem_set_list_len = 0; + } /* There may be extra registers to be clobbered. */ for (note = CALL_INSN_FUNCTION_USAGE (insn); @@ -3967,6 +3977,7 @@ init_propagate_block_info (bb, live, local_set, cond_local_set, flags) pbi->bb = bb; pbi->reg_live = live; pbi->mem_set_list = NULL_RTX; + pbi->mem_set_list_len = 0; pbi->local_set = local_set; pbi->cond_local_set = cond_local_set; pbi->cc0_live = 0; @@ -4111,6 +4122,8 @@ init_propagate_block_info (bb, live, local_set, cond_local_set, flags) mem = shallow_copy_rtx (mem); #endif pbi->mem_set_list = alloc_EXPR_LIST (0, mem, pbi->mem_set_list); + if (++pbi->mem_set_list_len >= MAX_MEM_SET_LIST_LEN) + break; } } } @@ -4512,6 +4525,7 @@ invalidate_mems_from_autoinc (pbi, insn) else pbi->mem_set_list = next; free_EXPR_LIST_node (temp); + pbi->mem_set_list_len--; } else prev = temp; @@ -4547,6 +4561,7 @@ invalidate_mems_from_set (pbi, exp) else pbi->mem_set_list = next; free_EXPR_LIST_node (temp); + pbi->mem_set_list_len--; } else prev = temp; @@ -4743,7 +4758,8 @@ mark_set_1 (pbi, code, reg, cond, insn, flags) if (insn && GET_CODE (reg) == MEM) invalidate_mems_from_autoinc (pbi, insn); - if (GET_CODE (reg) == MEM && ! side_effects_p (reg) + if (pbi->mem_set_list_len < MAX_MEM_SET_LIST_LEN + && GET_CODE (reg) == MEM && ! side_effects_p (reg) /* ??? With more effort we could track conditional memory life. */ && ! cond /* We do not know the size of a BLKmode store, so we do not track @@ -4761,6 +4777,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags) reg = shallow_copy_rtx (reg); #endif pbi->mem_set_list = alloc_EXPR_LIST (0, reg, pbi->mem_set_list); + pbi->mem_set_list_len++; } } @@ -5859,6 +5876,7 @@ mark_used_regs (pbi, x, cond, insn) else pbi->mem_set_list = next; free_EXPR_LIST_node (temp); + pbi->mem_set_list_len--; } else prev = temp; @@ -5996,7 +6014,10 @@ mark_used_regs (pbi, x, cond, insn) So for now, just clear the memory set list and mark any regs we can find in ASM_OPERANDS as used. */ if (code != ASM_OPERANDS || MEM_VOLATILE_P (x)) - free_EXPR_LIST_list (&pbi->mem_set_list); + { + free_EXPR_LIST_list (&pbi->mem_set_list); + pbi->mem_set_list_len = 0; + } /* For all ASM_OPERANDS, we must traverse the vector of input operands. We can not just fall through here since then we would be confused -- 2.30.2