From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31518 invoked by alias); 31 Oct 2013 16:27:21 -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 31434 invoked by uid 89); 31 Oct 2013 16:27:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Oct 2013 16:27:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9VGREtt012089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 31 Oct 2013 12:27:14 -0400 Received: from surprise.bos.redhat.com ([10.18.25.13]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9VGRCmR021743; Thu, 31 Oct 2013 12:27:14 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org, Andrew MacLeod Cc: David Malcolm Subject: [PATCH 2/6] Hand-written port of various accessors within gimple.h Date: Thu, 31 Oct 2013 16:27:00 -0000 Message-Id: <1383236801-13234-3-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1383236801-13234-1-git-send-email-dmalcolm@redhat.com> References: <5271CBF9.2070005@redhat.com> <1383236801-13234-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg02704.txt.bz2 * gimple.h (gimple_use_ops): Port from union to usage of dyn_cast. (gimple_set_use_ops): Port from union to usage of as_a. (gimple_set_vuse): Likewise. (gimple_set_vdef): Likewise. (gimple_call_internal_fn): Port from union to a static_cast, given that the type has already been asserted. (gimple_omp_body_ptr): Port from unchecked union usage to a static_cast. (gimple_omp_set_body): Likewise. --- gcc/gimple.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/gcc/gimple.h b/gcc/gimple.h index f288e81..6ff7602 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1467,9 +1467,11 @@ gimple_has_mem_ops (const_gimple g) static inline struct use_optype_d * gimple_use_ops (const_gimple g) { - if (!gimple_has_ops (g)) + const gimple_statement_with_ops *ops_stmt = + dyn_cast (g); + if (!ops_stmt) return NULL; - return g->gsops.opbase.use_ops; + return ops_stmt->use_ops; } @@ -1478,8 +1480,9 @@ gimple_use_ops (const_gimple g) static inline void gimple_set_use_ops (gimple g, struct use_optype_d *use) { - gcc_gimple_checking_assert (gimple_has_ops (g)); - g->gsops.opbase.use_ops = use; + gimple_statement_with_ops *ops_stmt = + as_a (g); + ops_stmt->use_ops = use; } @@ -1528,8 +1531,9 @@ gimple_vdef_ptr (gimple g) static inline void gimple_set_vuse (gimple g, tree vuse) { - gcc_gimple_checking_assert (gimple_has_mem_ops (g)); - g->gsmembase.vuse = vuse; + gimple_statement_with_memory_ops *mem_ops_stmt = + as_a (g); + mem_ops_stmt->vuse = vuse; } /* Set the single VDEF operand of the statement G. */ @@ -1537,8 +1541,9 @@ gimple_set_vuse (gimple g, tree vuse) static inline void gimple_set_vdef (gimple g, tree vdef) { - gcc_gimple_checking_assert (gimple_has_mem_ops (g)); - g->gsmembase.vdef = vdef; + gimple_statement_with_memory_ops *mem_ops_stmt = + as_a (g); + mem_ops_stmt->vdef = vdef; } @@ -2226,7 +2231,7 @@ static inline enum internal_fn gimple_call_internal_fn (const_gimple gs) { gcc_gimple_checking_assert (gimple_call_internal_p (gs)); - return gs->gimple_call.u.internal_fn; + return static_cast (gs)->u.internal_fn; } @@ -4031,7 +4036,7 @@ get_lineno (const_gimple stmt) static inline gimple_seq * gimple_omp_body_ptr (gimple gs) { - return &gs->omp.body; + return &static_cast (gs)->body; } /* Return the body for the OMP statement GS. */ @@ -4047,7 +4052,7 @@ gimple_omp_body (gimple gs) static inline void gimple_omp_set_body (gimple gs, gimple_seq body) { - gs->omp.body = body; + static_cast (gs)->body = body; } -- 1.7.11.7