flow.c (struct propagate_block_info): Add mem_set_list_len.
authorRichard Henderson <rth@redhat.com>
Tue, 16 Jan 2001 13:57:17 +0000 (05:57 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 16 Jan 2001 13:57:17 +0000 (05:57 -0800)
        * 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
gcc/flow.c

index a4d8d7958d14192262e9aa90ba35dc6e181fa071..063c8d4156285ca448f64850456abc904ee5a7d6 100644 (file)
@@ -1,3 +1,15 @@
+2001-01-16  Richard Henderson  <rth@redhat.com>
+
+       * 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  <rth@redhat.com>
 
        * unroll.c (precondition_loop_p): Fail if no iteration
index 734063848d7e07c11408b64e00c2048d6784568d..acd25f2b410d9e6461cf80bcdcf483b75d6693b3 100644 (file)
@@ -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