aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2015-05-12 15:37:53 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2015-05-12 15:37:53 +0200
commit1bcc1e4102b64d93441c0318c537a182923c331b (patch)
treefefaa7df646c708b7dc67856d04b5bd746df6058 /gcc/combine.c
parent7e37fe6f628dc0063a36fbed59a2dcf74e88cce5 (diff)
downloadgcc-1bcc1e4102b64d93441c0318c537a182923c331b.zip
gcc-1bcc1e4102b64d93441c0318c537a182923c331b.tar.gz
gcc-1bcc1e4102b64d93441c0318c537a182923c331b.tar.bz2
combine.c (get_undo_marker): New function.
* combine.c (get_undo_marker): New function. (undo_to_marker): New function, largely factored out from ... (undo_all): ... this. Adjust. From-SVN: r223066
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 274a2d9..4b6e39f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4673,15 +4673,25 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
return newi2pat ? i2 : i3;
}
-/* Undo all the modifications recorded in undobuf. */
+/* Get a marker for undoing to the current state. */
+
+static void *
+get_undo_marker (void)
+{
+ return undobuf.undos;
+}
+
+/* Undo the modifications up to the marker. */
static void
-undo_all (void)
+undo_to_marker (void *marker)
{
struct undo *undo, *next;
- for (undo = undobuf.undos; undo; undo = next)
+ for (undo = undobuf.undos; undo != marker; undo = next)
{
+ gcc_assert (undo);
+
next = undo->next;
switch (undo->kind)
{
@@ -4705,7 +4715,15 @@ undo_all (void)
undobuf.frees = undo;
}
- undobuf.undos = 0;
+ undobuf.undos = (struct undo *) marker;
+}
+
+/* Undo all the modifications recorded in undobuf. */
+
+static void
+undo_all (void)
+{
+ undo_to_marker (0);
}
/* We've committed to accepting the changes we made. Move all