From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30839 invoked by alias); 10 May 2015 16:14:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30622 invoked by uid 89); 10 May 2015 16:14:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 10 May 2015 16:14:44 +0000 Received: from gcc1-power7.osuosl.org (localhost [127.0.0.1]) by gcc1-power7.osuosl.org (8.14.6/8.14.6) with ESMTP id t4AGEg85011049; Sun, 10 May 2015 09:14:42 -0700 Received: (from segher@localhost) by gcc1-power7.osuosl.org (8.14.6/8.14.6/Submit) id t4AGEgKH010719; Sun, 10 May 2015 09:14:42 -0700 From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH 1/6] combine: undo_to_marker Date: Sun, 10 May 2015 16:14:00 -0000 Message-Id: <705755bdc5ee76e41032f7b490d134ce88f9256e.1431268135.git.segher@kernel.crashing.org> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00848.txt.bz2 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 * 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; } -/* 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