]> gcc.gnu.org Git - gcc.git/commitdiff
bitmap.h (BITMAP_XFREE): New.
authorRichard Henderson <rth@cygnus.com>
Fri, 5 Nov 1999 00:49:03 +0000 (16:49 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 5 Nov 1999 00:49:03 +0000 (16:49 -0800)
        * bitmap.h (BITMAP_XFREE): New.
        * flow.c (life_analysis): Use it.
        (life_analysis_1): Free blocks.

        * combine.c (undo_commit): New.
        (try_combine): Use it.  Don't zap undobuf.undos.
        (combine_instructions): Don't zap undobuf.undos; free the
        undobuf.frees list.

        * local-alloc.c (local_alloc): Free qty_phys_num_sugg.

        * stmt.c (cost_table_): New.
        (estimate_case_costs): Use it instead of xmalloc.

        * toplev.c (compile_file): Reuse dumpname memory instead
        of strdup'ing it.

From-SVN: r30404

gcc/ChangeLog
gcc/bitmap.h
gcc/combine.c
gcc/flow.c
gcc/local-alloc.c
gcc/stmt.c
gcc/toplev.c

index e9800db97833c8685271652bb2acec61f7fbabfd..512eabaa706a95c2c89c305f8674a23210981d0c 100644 (file)
@@ -1,3 +1,22 @@
+Thu Nov  4 16:44:53 1999  Richard Henderson  <rth@cygnus.com>
+
+       * bitmap.h (BITMAP_XFREE): New.
+       * flow.c (life_analysis): Use it.
+       (life_analysis_1): Free blocks.
+
+       * combine.c (undo_commit): New.
+       (try_combine): Use it.  Don't zap undobuf.undos.
+       (combine_instructions): Don't zap undobuf.undos; free the
+       undobuf.frees list.
+
+       * local-alloc.c (local_alloc): Free qty_phys_num_sugg.
+
+       * stmt.c (cost_table_): New.
+       (estimate_case_costs): Use it instead of xmalloc.
+
+       * toplev.c (compile_file): Reuse dumpname memory instead
+       of strdup'ing it.
+
 Thu Nov  4 16:36:44 1999  Richard Henderson  <rth@cygnus.com>
 
        * reg-stack.c (convert_regs_1): Initialize target_stack->top
index 9b8875a01853e9c4864bac6159dd526ae15622a1..99f45492e22b0ea03c6383d5a372cc7b6611022c 100644 (file)
@@ -119,13 +119,24 @@ extern void debug_bitmap PROTO((bitmap));
   bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head)))
 
 /* Do any cleanup needed on a bitmap when it is no longer used.  */
-#define BITMAP_FREE(BITMAP)                                    \
-do {                           \
-  if (BITMAP)                  \
-    {                          \
-      bitmap_clear (BITMAP);   \
-      (BITMAP) = 0;            \
-    }                                                                  \
+#define BITMAP_FREE(BITMAP)                    \
+do {                                           \
+  if (BITMAP)                                  \
+    {                                          \
+      bitmap_clear (BITMAP);                   \
+      (BITMAP) = 0;                            \
+    }                                          \
+} while (0)
+
+/* Do any cleanup needed on an xmalloced bitmap when it is no longer used.  */
+#define BITMAP_XFREE(BITMAP)                   \
+do {                                           \
+  if (BITMAP)                                  \
+    {                                          \
+      bitmap_clear (BITMAP);                   \
+      free (BITMAP);                           \
+      (BITMAP) = 0;                            \
+    }                                          \
 } while (0)
 
 /* Do any one-time initializations needed for bitmaps.  */
index 951930d048a27bd3c544a8a18d31799ddf4e23fb..4a1cb0ee62c8d36d4722e349572719debee561d2 100644 (file)
@@ -361,6 +361,7 @@ static int combinable_i3pat PROTO((rtx, rtx *, rtx, rtx, int, rtx *));
 static int contains_muldiv     PROTO((rtx));
 static rtx try_combine         PROTO((rtx, rtx, rtx));
 static void undo_all           PROTO((void));
+static void undo_commit                PROTO((void));
 static rtx *find_split_point   PROTO((rtx *, rtx));
 static rtx subst               PROTO((rtx, rtx, rtx, int, int));
 static rtx combine_simplify_rtx        PROTO((rtx, enum machine_mode, int, int));
@@ -495,7 +496,6 @@ combine_instructions (f, nregs)
   combine_merges = 0;
   combine_extras = 0;
   combine_successes = 0;
-  undobuf.undos = undobuf.previous_undos = 0;
 
   combine_max_regno = nregs;
 
@@ -717,6 +717,16 @@ combine_instructions (f, nregs)
   free (reg_last_set_sign_bit_copies);
   free (uid_cuid);
 
+  {
+    struct undo *undo, *next;
+    for (undo = undobuf.frees; undo; undo = next)
+      {
+       next = undo->next;
+       free (undo);
+      }
+    undobuf.frees = 0;
+  }
+
   total_attempts += combine_attempts;
   total_merges += combine_merges;
   total_extras += combine_extras;
@@ -1461,8 +1471,6 @@ try_combine (i3, i2, i1)
     return 0;
 
   combine_attempts++;
-
-  undobuf.undos = undobuf.previous_undos = 0;
   undobuf.other_insn = 0;
 
   /* Save the current high-water-mark so we can free storage if we didn't
@@ -2620,6 +2628,7 @@ try_combine (i3, i2, i1)
   }
 
   combine_successes++;
+  undo_commit ();
 
   /* Clear this here, so that subsequent get_last_value calls are not
      affected.  */
@@ -2659,6 +2668,24 @@ undo_all ()
      affected.  */
   subst_prev_insn = NULL_RTX;
 }
+
+/* We've committed to accepting the changes we made.  Move all
+   of the undos to the free list.  */
+
+static void
+undo_commit ()
+{
+  struct undo *undo, *next;
+
+  for (undo = undobuf.undos; undo; undo = next)
+    {
+      next = undo->next;
+      undo->next = undobuf.frees;
+      undobuf.frees = undo;
+    }
+  undobuf.undos = undobuf.previous_undos = 0;
+}
+
 \f
 /* Find the innermost point within the rtx at LOC, possibly LOC itself,
    where we have an arithmetic expression and return that point.  LOC will
index d2d50914b10d62d1e0bcdd9e9090ed3b4e596740..43688ae11d3ef53f339c278686692a7c1730b606 100644 (file)
@@ -2466,8 +2466,7 @@ life_analysis (f, nregs, file, remove_dead_code)
   if (file)
     dump_flow_info (file);
 
-  BITMAP_FREE (uid_volatile);
-  free (uid_volatile);
+  BITMAP_XFREE (uid_volatile);
   free_basic_block_vars (1);
 }
 
@@ -2940,6 +2939,7 @@ life_analysis_1 (f, nregs, flags)
     blocks = sbitmap_alloc (n_basic_blocks);
     sbitmap_ones (blocks);
     calculate_global_regs_live (blocks, blocks, flags & PROP_SCAN_DEAD_CODE);
+    sbitmap_free (blocks);
   }
 
   /* The only pseudos that are live at the beginning of the function are
index 3578f859794dfa545ecd21e2291e3fb7deab479b..a135cad07d7a73044ff688c4d55a792e7672c453 100644 (file)
@@ -420,6 +420,7 @@ local_alloc ()
   free (qty_phys_copy_sugg);
   free (qty_phys_num_copy_sugg);
   free (qty_phys_sugg);
+  free (qty_phys_num_sugg);
   free (qty_birth);
   free (qty_death);
   free (qty_first_reg);
index f38b94fc942177c57894b0ad8eb2ab3e30c45c04..17a2402c37cb88975d80e5d64d213165e256b19a 100644 (file)
@@ -106,6 +106,7 @@ typedef struct case_node *case_node_ptr;
 /* These are used by estimate_case_costs and balance_case_nodes.  */
 
 /* This must be a signed type, and non-ANSI compilers lack signed char.  */
+static short cost_table_[129];
 static short *cost_table;
 static int use_cost_table;
 \f
@@ -5694,7 +5695,7 @@ estimate_case_costs (node)
 
   if (cost_table == NULL)
     {
-      cost_table = ((short *) xcalloc (129, sizeof (short))) + 1;
+      cost_table = cost_table_ + 1;
 
       for (i = 0; i < 128; i++)
        {
index 5e7dbc0a272f33a938a04294a18085d86afd6030..89bef06d70facde4901385e69c898e596f349591 100644 (file)
@@ -3053,13 +3053,15 @@ compile_file (name)
        asm_out_file = stdout;
       else
        {
-         int len = strlen (dump_base_name);
-         register char *dumpname = (char *) xmalloc (len + 6);
-         strcpy (dumpname, dump_base_name);
-         strip_off_ending (dumpname, len);
-         strcat (dumpname, ".s");
          if (asm_file_name == 0)
-           asm_file_name = xstrdup (dumpname);
+           {
+             int len = strlen (dump_base_name);
+             char *dumpname = (char *) xmalloc (len + 6);
+             memcpy (dumpname, dump_base_name, len + 1);
+             strip_off_ending (dumpname, len);
+             strcat (dumpname, ".s");
+             asm_file_name = dumpname;
+           }
          if (!strcmp (asm_file_name, "-"))
            asm_out_file = stdout;
          else
This page took 0.087922 seconds and 5 git commands to generate.