public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: dje.gcc@gmail.com, Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 1/6] combine: undo_to_marker
Date: Sun, 10 May 2015 16:14:00 -0000	[thread overview]
Message-ID: <705755bdc5ee76e41032f7b490d134ce88f9256e.1431268135.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <cover.1431268134.git.segher@kernel.crashing.org>
In-Reply-To: <cover.1431268134.git.segher@kernel.crashing.org>

This generalises undo_all to allow undoing only the last some SUBSTs.
This is used by the next patch, but is more generally useful.

Comments?


Segher


2015-05-10  Segher Boessenkool  <segher@kernel.crashing.org>

	* combine.c (get_undo_marker): New function.
	(undo_to_marker): New function, largely factored out from ...
	(undo_all): ... this.  Adjust.

---
 gcc/combine.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index b806959..1e4d65e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4643,15 +4643,25 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
     return newi2pat ? i2 : i3;
 }
 \f
-/* 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)
 	{
@@ -4675,7 +4685,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
-- 
1.8.1.4

  reply	other threads:[~2015-05-10 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-10 16:14 [PATCH 0/6] Getting rid of some zero_ext* patterns Segher Boessenkool
2015-05-10 16:14 ` Segher Boessenkool [this message]
2015-05-11  4:10   ` [PATCH 1/6] combine: undo_to_marker Jeff Law
2015-05-10 16:15 ` [PATCH 2/6] combine: If recog fails, try again with zero_ext{ract,end} simplified Segher Boessenkool
2015-05-11  4:15   ` Jeff Law
2015-05-11  6:18     ` Segher Boessenkool
2015-05-12  8:25   ` Kyrill Tkachov
2015-05-12 11:16     ` Segher Boessenkool
2015-05-10 16:15 ` [PATCH 3/6] rs6000: Don't use zero_extract in the bswap:HI splitter Segher Boessenkool
2015-05-11 15:32   ` David Edelsohn
2015-05-10 16:16 ` [PATCH 5/6] rs6000: Don't use gen_rlwinm Segher Boessenkool
2015-05-11 15:30   ` David Edelsohn
2015-05-10 16:16 ` [PATCH 4/6] rs6000: Delete some now-superfluous zero_ext{end,ract} patterns Segher Boessenkool
2015-05-11 15:29   ` David Edelsohn
2015-05-10 16:16 ` [PATCH 6/6] rs6000: Clean up the various rlwinm patterns Segher Boessenkool
2015-05-10 18:02   ` Maciej W. Rozycki
2015-05-10 19:45     ` Segher Boessenkool
2015-05-11 18:17       ` Maciej W. Rozycki
2015-05-11 15:31   ` David Edelsohn
2015-05-12 14:01 ` [PATCH 0/6] Getting rid of some zero_ext* patterns Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=705755bdc5ee76e41032f7b490d134ce88f9256e.1431268135.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).