aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-11-04 16:49:03 -0800
committerRichard Henderson <rth@gcc.gnu.org>1999-11-04 16:49:03 -0800
commite7749837caaa5c7a7fddea3e8eb90b852cead3d6 (patch)
tree36caca6632c74bf9cd783c44f1c99239c1b55570 /gcc/combine.c
parent920a303df913c5bcc6912ce722bee38e8fc04197 (diff)
downloadgcc-e7749837caaa5c7a7fddea3e8eb90b852cead3d6.zip
gcc-e7749837caaa5c7a7fddea3e8eb90b852cead3d6.tar.gz
gcc-e7749837caaa5c7a7fddea3e8eb90b852cead3d6.tar.bz2
bitmap.h (BITMAP_XFREE): New.
* 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
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 951930d..4a1cb0e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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;
+}
+
/* Find the innermost point within the rtx at LOC, possibly LOC itself,
where we have an arithmetic expression and return that point. LOC will