From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18781 invoked by alias); 11 Mar 2011 13:07:05 -0000 Received: (qmail 18771 invoked by uid 22791); 11 Mar 2011 13:07:04 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 13:06:58 +0000 Received: by iyb26 with SMTP id 26so2948330iyb.20 for ; Fri, 11 Mar 2011 05:06:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.43.63.72 with SMTP id xd8mr5765544icb.215.1299848817358; Fri, 11 Mar 2011 05:06:57 -0800 (PST) Received: by 10.231.10.130 with HTTP; Fri, 11 Mar 2011 05:06:57 -0800 (PST) In-Reply-To: <1299817406-16745-7-git-send-email-froydnj@codesourcery.com> References: <1299817406-16745-1-git-send-email-froydnj@codesourcery.com> <1299817406-16745-7-git-send-email-froydnj@codesourcery.com> Date: Fri, 11 Mar 2011 13:07:00 -0000 Message-ID: Subject: Re: [PATCH 06/18] define CASE_CHAIN accessor for CASE_LABEL_EXPR From: Richard Guenther To: Nathan Froyd Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-03/txt/msg00594.txt.bz2 On Fri, Mar 11, 2011 at 5:23 AM, Nathan Froyd wr= ote: > This patch begins a subseries of patches aimed at removing TREE_CHAIN > from expression trees. =A0tree-cfg.c uses TREE_CHAIN for some analysis > steps on CASE_LABEL_EXPRs. =A0I looked at this for a while, thinking it'd > be easy to use VECs instead, but AFAICS, it wasn't. =A0I went for the next > best thing, hiding TREE_CHAIN usage behind CASE_CHAIN; doing this will > enable swapping out the TREE_CHAIN for a TREE_OPERAND at a later point. Ok for 4.7. Thanks, Richard. > -Nathan > > =A0 =A0 =A0 =A0* tree.h (CASE_CHAIN): Define. > =A0 =A0 =A0 =A0* tree-cfg.c (edge_to_cases_cleanup, get_cases_for_edge): = Use it. > =A0 =A0 =A0 =A0(gimple_redirect_edge_and_branch): Likewise. > > diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c > index 1f533a3..bdce4cb 100644 > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -838,8 +838,8 @@ edge_to_cases_cleanup (const void *key ATTRIBUTE_UNUS= ED, void **value, > > =A0 for (t =3D (tree) *value; t; t =3D next) > =A0 =A0 { > - =A0 =A0 =A0next =3D TREE_CHAIN (t); > - =A0 =A0 =A0TREE_CHAIN (t) =3D NULL; > + =A0 =A0 =A0next =3D CASE_CHAIN (t); > + =A0 =A0 =A0CASE_CHAIN (t) =3D NULL; > =A0 =A0 } > > =A0 *value =3D NULL; > @@ -922,7 +922,7 @@ get_cases_for_edge (edge e, gimple t) > =A0 =A0 =A0 /* Add it to the chain of CASE_LABEL_EXPRs referencing E, or = create > =A0 =A0 =A0 =A0 a new chain. =A0*/ > =A0 =A0 =A0 slot =3D pointer_map_insert (edge_to_cases, this_edge); > - =A0 =A0 =A0TREE_CHAIN (elt) =3D (tree) *slot; > + =A0 =A0 =A0CASE_CHAIN (elt) =3D (tree) *slot; > =A0 =A0 =A0 *slot =3D elt; > =A0 =A0 } > > @@ -4900,7 +4900,7 @@ gimple_redirect_edge_and_branch (edge e, basic_bloc= k dest) > =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0last =3D cases; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CASE_LABEL (cases) =3D label; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 cases =3D TREE_CHAIN (cases); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cases =3D CASE_CHAIN (cases); > =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0 =A0 =A0/* If there was already an edge in the CFG, then w= e need > @@ -4909,8 +4909,8 @@ gimple_redirect_edge_and_branch (edge e, basic_bloc= k dest) > =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tree cases2 =3D get_cases_for_edge (e2, st= mt); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_CHAIN (last) =3D TREE_CHAIN (cases2); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_CHAIN (cases2) =3D first; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 CASE_CHAIN (last) =3D CASE_CHAIN (cases2); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 CASE_CHAIN (cases2) =3D first; > =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0bitmap_set_bit (touched_switch_bbs, gimple_bb (stm= t)->index); > =A0 =A0 =A0 =A0 =A0} > diff --git a/gcc/tree.h b/gcc/tree.h > index 35479f9..58b3b9d 100644 > --- a/gcc/tree.h > +++ b/gcc/tree.h > @@ -1689,6 +1689,7 @@ extern void protected_set_expr_location (tree, loca= tion_t); > =A0#define CASE_LOW(NODE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_OPERAND (C= ASE_LABEL_EXPR_CHECK (NODE), 0) > =A0#define CASE_HIGH(NODE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TREE_OPERAND (C= ASE_LABEL_EXPR_CHECK (NODE), 1) > =A0#define CASE_LABEL(NODE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_OPERAND (CAS= E_LABEL_EXPR_CHECK (NODE), 2) > +#define CASE_CHAIN(NODE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_CHAIN (CASE_LA= BEL_EXPR_CHECK (NODE)) > > =A0/* The operands of a TARGET_MEM_REF. =A0Operands 0 and 1 have to match > =A0 =A0corresponding MEM_REF operands. =A0*/ > -- > 1.7.0.4 > >