From patchwork Mon Feb 4 15:27:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2093081 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id DC7033FC23 for ; Mon, 4 Feb 2013 15:51:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF27DE612C for ; Mon, 4 Feb 2013 07:51:14 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B734E5EA1 for ; Mon, 4 Feb 2013 07:29:39 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 04 Feb 2013 07:29:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,600,1355126400"; d="scan'208";a="257441964" Received: from unknown (HELO dyon.amr.corp.intel.com) ([10.255.12.132]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2013 07:29:38 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 4 Feb 2013 15:27:39 +0000 Message-Id: <1359991705-5254-45-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1359991705-5254-1-git-send-email-damien.lespiau@intel.com> References: <1359991705-5254-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 44/90] assembler: Replace struct indirect_reg by struct brw_reg X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org More code simplification can be layered on top of that (by using some brw_* helpers to create registers), that'd be for another commit. Signed-off-by: Damien Lespiau --- assembler/gen4asm.h | 8 -------- assembler/gram.y | 46 +++++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/assembler/gen4asm.h b/assembler/gen4asm.h index 122baf0..8a3e95b 100644 --- a/assembler/gen4asm.h +++ b/assembler/gen4asm.h @@ -80,14 +80,6 @@ struct regtype { int type; int is_default; }; -/** - * This structure is the internal representation of register-indirect addressed - * registers in the parser. - */ - -struct indirect_reg { - int reg_file, address_subreg_nr, indirect_offset; -}; /** * This structure is the internal representation of destination operands in the diff --git a/assembler/gram.y b/assembler/gram.y index 71dbea9..169026c 100644 --- a/assembler/gram.y +++ b/assembler/gram.y @@ -159,7 +159,7 @@ static void brw_program_add_label(struct brw_program *p, const char *label) struct region region; struct regtype regtype; struct brw_reg direct_reg; - struct indirect_reg indirect_reg; + struct brw_reg indirect_reg; struct condition condition; struct declared_register symbol_reg; imm32_t imm32; @@ -1705,17 +1705,17 @@ dstreg: directgenreg { memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - $$.reg_file = $1.reg_file; - $$.subreg_nr = $1.address_subreg_nr; - $$.indirect_offset = $1.indirect_offset; + $$.reg_file = $1.file; + $$.subreg_nr = $1.subnr; + $$.indirect_offset = $1.dw1.bits.indirect_offset; } | indirectmsgreg { memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - $$.reg_file = $1.reg_file; - $$.subreg_nr = $1.address_subreg_nr; - $$.indirect_offset = $1.indirect_offset; + $$.reg_file = $1.file; + $$.subreg_nr = $1.subnr; + $$.indirect_offset = $1.dw1.bits.indirect_offset; } ; @@ -1937,9 +1937,9 @@ indirectsrcoperand: { memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - $$.reg_file = $3.reg_file; - $$.subreg_nr = $3.address_subreg_nr; - $$.indirect_offset = $3.indirect_offset; + $$.reg_file = $3.file; + $$.subreg_nr = $3.subnr; + $$.indirect_offset = $3.dw1.bits.indirect_offset; $$.reg_type = $5.type; $$.vert_stride = $4.vert_stride; $$.width = $4.width; @@ -1966,14 +1966,14 @@ addrparam: addrreg COMMA immaddroffset YYERROR; } memset (&$$, '\0', sizeof ($$)); - $$.address_subreg_nr = $1.subnr; - $$.indirect_offset = $3; + $$.subnr = $1.subnr; + $$.dw1.bits.indirect_offset = $3; } | addrreg { memset (&$$, '\0', sizeof ($$)); - $$.address_subreg_nr = $1.subnr; - $$.indirect_offset = 0; + $$.subnr = $1.subnr; + $$.dw1.bits.indirect_offset = 0; } ; @@ -2009,9 +2009,9 @@ directgenreg: GENREG subregnum indirectgenreg: GENREGFILE LSQUARE addrparam RSQUARE { memset (&$$, '\0', sizeof ($$)); - $$.reg_file = BRW_GENERAL_REGISTER_FILE; - $$.address_subreg_nr = $3.address_subreg_nr; - $$.indirect_offset = $3.indirect_offset; + $$.file = BRW_GENERAL_REGISTER_FILE; + $$.subnr = $3.subnr; + $$.dw1.bits.indirect_offset = $3.dw1.bits.indirect_offset; } ; @@ -2027,9 +2027,9 @@ directmsgreg: MSGREG subregnum indirectmsgreg: MSGREGFILE LSQUARE addrparam RSQUARE { memset (&$$, '\0', sizeof ($$)); - $$.reg_file = BRW_MESSAGE_REGISTER_FILE; - $$.address_subreg_nr = $3.address_subreg_nr; - $$.indirect_offset = $3.indirect_offset; + $$.file = BRW_MESSAGE_REGISTER_FILE; + $$.subnr = $3.subnr; + $$.dw1.bits.indirect_offset = $3.dw1.bits.indirect_offset; } ; @@ -2315,9 +2315,9 @@ relativelocation2: { memset (&$$, '\0', sizeof ($$)); $$.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - $$.reg_file = $1.reg_file; - $$.subreg_nr = $1.address_subreg_nr; - $$.indirect_offset = $1.indirect_offset; + $$.reg_file = $1.file; + $$.subreg_nr = $1.subnr; + $$.indirect_offset = $1.dw1.bits.indirect_offset; $$.reg_type = $3.type; $$.vert_stride = $2.vert_stride; $$.width = $2.width;