From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28326 invoked by alias); 6 Aug 2014 17:19:20 -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 28120 invoked by uid 89); 6 Aug 2014 17:19:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Aug 2014 17:19:17 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF4rl-0000CW-Ci for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:19:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF4rl-0000CH-6B for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:19:09 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJ8xG023926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 13:19:08 -0400 Received: from c64.redhat.com (vpn-239-139.phx2.redhat.com [10.3.239.139]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJ2nj030913; Wed, 6 Aug 2014 13:19:08 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 009/236] Replace BB_HEAD et al macros with functions Date: Wed, 06 Aug 2014 17:19:00 -0000 Message-Id: <1407345815-14551-10-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> References: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00507.txt.bz2 This is further scaffolding; convert the BB_* and SET_BB_* macros into functions. Convert the BB_* rvalue-style functions into returning rtx_insn * rather than plain rtx. For now, this is done by adding a checked cast, but this will eventually become a field lookup. The lvalue form for now returns an rtx& to allow in-place modification. gcc/ * basic-block.h (BB_HEAD): Convert to a function. Strengthen the return type from rtx to rtx_insn *. (BB_END): Likewise. (BB_HEADER): Likewise. (BB_FOOTER): Likewise. (SET_BB_HEAD): Convert to a function. (SET_BB_END): Likewise. (SET_BB_HEADER): Likewise. (SET_BB_FOOTER): Likewise. * cfgrtl.c (BB_HEAD): New function, from macro of same name. Strengthen the return type from rtx to rtx_insn *. For now, this is done by adding a checked cast, but this will eventually become a field lookup. (BB_END): Likewise. (BB_HEADER): Likewise. (BB_FOOTER): Likewise. (SET_BB_HEAD): New function, from macro of same name. This is intended for use as an lvalue, and so returns an rtx& to allow in-place modification. (SET_BB_END): Likewise. (SET_BB_HEADER): Likewise. (SET_BB_FOOTER): Likewise. --- gcc/basic-block.h | 26 ++++++++++++++---------- gcc/cfgrtl.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 11 deletions(-) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index d27f498..82dbfe9 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -368,17 +368,21 @@ struct GTY(()) control_flow_graph { /* Stuff for recording basic block info. */ -/* These macros are currently split into two: - one suitable for reading, and for writing. - These will become functions in a follow-up patch. */ -#define BB_HEAD(B) (((const_basic_block)B)->il.x.head_) -#define SET_BB_HEAD(B) (B)->il.x.head_ -#define BB_END(B) (((const rtl_bb_info *)(B)->il.x.rtl)->end_) -#define SET_BB_END(B) (B)->il.x.rtl->end_ -#define BB_HEADER(B) (((const rtl_bb_info *)(B)->il.x.rtl)->header_) -#define SET_BB_HEADER(B) (B)->il.x.rtl->header_ -#define BB_FOOTER(B) (((const rtl_bb_info *)(B)->il.x.rtl)->footer_) -#define SET_BB_FOOTER(B) (B)->il.x.rtl->footer_ +/* For now, these will be functions (so that they can include checked casts + to rtx_insn. Once the underlying fields are converted from rtx + to rtx_insn, these can be converted back to macros. */ + +extern rtx_insn *BB_HEAD (const_basic_block bb); +extern rtx& SET_BB_HEAD (basic_block bb); + +extern rtx_insn *BB_END (const_basic_block bb); +extern rtx& SET_BB_END (basic_block bb); + +extern rtx_insn *BB_HEADER (const_basic_block bb); +extern rtx& SET_BB_HEADER (basic_block bb); + +extern rtx_insn *BB_FOOTER (const_basic_block bb); +extern rtx& SET_BB_FOOTER (basic_block bb); /* Special block numbers [markers] for entry and exit. Neither of them is supposed to hold actual statements. */ diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 026fb48..5f2879e 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -5094,4 +5094,64 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { rtl_account_profile_record, }; +/* BB_HEAD as an rvalue. */ + +rtx_insn *BB_HEAD (const_basic_block bb) +{ + rtx insn = bb->il.x.head_; + return as_a_nullable (insn); +} + +/* BB_HEAD for use as an lvalue. */ + +rtx& SET_BB_HEAD (basic_block bb) +{ + return bb->il.x.head_; +} + +/* BB_END as an rvalue. */ + +rtx_insn *BB_END (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->end_; + return as_a_nullable (insn); +} + +/* BB_END as an lvalue. */ + +rtx& SET_BB_END (basic_block bb) +{ + return bb->il.x.rtl->end_; +} + +/* BB_HEADER as an rvalue. */ + +rtx_insn *BB_HEADER (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->header_; + return as_a_nullable (insn); +} + +/* BB_HEADER as an lvalue. */ + +rtx& SET_BB_HEADER (basic_block bb) +{ + return bb->il.x.rtl->header_; +} + +/* BB_FOOTER as an rvalue. */ + +rtx_insn *BB_FOOTER (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->footer_; + return as_a_nullable (insn); +} + +/* BB_FOOTER as an lvalue. */ + +rtx& SET_BB_FOOTER (basic_block bb) +{ + return bb->il.x.rtl->footer_; +} + #include "gt-cfgrtl.h" -- 1.8.5.3