From patchwork Mon Feb 4 15:27:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2093441 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 4AC673FD56 for ; Mon, 4 Feb 2013 16:01:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B398E5D25 for ; Mon, 4 Feb 2013 08:01:44 -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 8114CE5FFE for ; Mon, 4 Feb 2013 07:29:58 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 04 Feb 2013 07:29:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,600,1355126400"; d="scan'208";a="257442198" 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:57 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Mon, 4 Feb 2013 15:27:59 +0000 Message-Id: <1359991705-5254-65-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 64/90] assembler: Cleanup visibility of a few global variables/functions 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 Not everything has to be exported out the compilation unit. Do a small cleanup pass. Signed-off-by: Damien Lespiau --- assembler/gen4asm.h | 2 + assembler/gram.y | 102 ++++++++++++++++++++++++--------------------------- assembler/main.c | 12 +++--- 3 files changed, 56 insertions(+), 60 deletions(-) diff --git a/assembler/gen4asm.h b/assembler/gen4asm.h index 9558a29..332c8b9 100644 --- a/assembler/gen4asm.h +++ b/assembler/gen4asm.h @@ -42,6 +42,8 @@ typedef int GLint; typedef float GLfloat; extern long int gen_level; +extern int advanced_flag; +extern int errors; #define WARN_ALWAYS (1 << 0) #define WARN_ALL (1 << 31) diff --git a/assembler/gram.y b/assembler/gram.y index c022277..4b5c6a3 100644 --- a/assembler/gram.y +++ b/assembler/gram.y @@ -49,9 +49,6 @@ typedef struct YYLTYPE int last_column; } YYLTYPE; -extern long int gen_level; -extern int advanced_flag; -extern int yylineno; extern int need_export; static struct src_operand src_null_reg = { @@ -83,30 +80,30 @@ static struct src_operand ip_src = }; static int get_type_size(GLuint type); -int set_instruction_dest(struct brw_instruction *instr, - struct brw_reg *dest); -int set_instruction_src0(struct brw_instruction *instr, - struct src_operand *src, - YYLTYPE *location); -int set_instruction_src1(struct brw_instruction *instr, - struct src_operand *src, - YYLTYPE *location); -int set_instruction_dest_three_src(struct brw_instruction *instr, - struct brw_reg *dest); -int set_instruction_src0_three_src(struct brw_instruction *instr, - struct src_operand *src); -int set_instruction_src1_three_src(struct brw_instruction *instr, - struct src_operand *src); -int set_instruction_src2_three_src(struct brw_instruction *instr, - struct src_operand *src); -void set_instruction_options(struct brw_instruction *instr, - struct brw_instruction *options); -void set_instruction_predicate(struct brw_instruction *instr, - struct brw_instruction *predicate); -void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, - int type); -void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, - int type); +static int set_instruction_dest(struct brw_instruction *instr, + struct brw_reg *dest); +static int set_instruction_src0(struct brw_instruction *instr, + struct src_operand *src, + YYLTYPE *location); +static int set_instruction_src1(struct brw_instruction *instr, + struct src_operand *src, + YYLTYPE *location); +static int set_instruction_dest_three_src(struct brw_instruction *instr, + struct brw_reg *dest); +static int set_instruction_src0_three_src(struct brw_instruction *instr, + struct src_operand *src); +static int set_instruction_src1_three_src(struct brw_instruction *instr, + struct src_operand *src); +static int set_instruction_src2_three_src(struct brw_instruction *instr, + struct src_operand *src); +static void set_instruction_options(struct brw_instruction *instr, + struct brw_instruction *options); +static void set_instruction_predicate(struct brw_instruction *instr, + struct brw_instruction *predicate); +static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, + int type); +static void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, + int type); enum message_level { WARN, @@ -2826,9 +2823,6 @@ instoption: ALIGN1 { $$ = ALIGN1; } %% extern int yylineno; -extern char *input_filename; - -int errors; void yyerror (char *msg) { @@ -2939,8 +2933,8 @@ static void reset_instruction_src_region(struct brw_instruction *instr, /** * Fills in the destination register information in instr from the bits in dst. */ -int set_instruction_dest(struct brw_instruction *instr, - struct brw_reg *dest) +static int set_instruction_dest(struct brw_instruction *instr, + struct brw_reg *dest) { if (!validate_dst_reg(instr, dest)) return 1; @@ -2955,9 +2949,9 @@ int set_instruction_dest(struct brw_instruction *instr, } /* Sets the first source operand for the instruction. Returns 0 on success. */ -int set_instruction_src0(struct brw_instruction *instr, - struct src_operand *src, - YYLTYPE *location) +static int set_instruction_src0(struct brw_instruction *instr, + struct src_operand *src, + YYLTYPE *location) { if (advanced_flag) @@ -2977,9 +2971,9 @@ int set_instruction_src0(struct brw_instruction *instr, /* Sets the second source operand for the instruction. Returns 0 on success. */ -int set_instruction_src1(struct brw_instruction *instr, - struct src_operand *src, - YYLTYPE *location) +static int set_instruction_src1(struct brw_instruction *instr, + struct src_operand *src, + YYLTYPE *location) { if (advanced_flag) reset_instruction_src_region(instr, src); @@ -3060,8 +3054,8 @@ static int reg_type_2_to_3(int reg_type) return r; } -int set_instruction_dest_three_src(struct brw_instruction *instr, - struct brw_reg *dest) +static int set_instruction_dest_three_src(struct brw_instruction *instr, + struct brw_reg *dest) { instr->bits1.da3src.dest_reg_file = dest->file; instr->bits1.da3src.dest_reg_nr = dest->nr; @@ -3071,8 +3065,8 @@ int set_instruction_dest_three_src(struct brw_instruction *instr, return 0; } -int set_instruction_src0_three_src(struct brw_instruction *instr, - struct src_operand *src) +static int set_instruction_src0_three_src(struct brw_instruction *instr, + struct src_operand *src) { if (advanced_flag) { reset_instruction_src_region(instr, src); @@ -3084,8 +3078,8 @@ int set_instruction_src0_three_src(struct brw_instruction *instr, return 0; } -int set_instruction_src1_three_src(struct brw_instruction *instr, - struct src_operand *src) +static int set_instruction_src1_three_src(struct brw_instruction *instr, + struct src_operand *src) { if (advanced_flag) { reset_instruction_src_region(instr, src); @@ -3098,8 +3092,8 @@ int set_instruction_src1_three_src(struct brw_instruction *instr, return 0; } -int set_instruction_src2_three_src(struct brw_instruction *instr, - struct src_operand *src) +static int set_instruction_src2_three_src(struct brw_instruction *instr, + struct src_operand *src) { if (advanced_flag) { reset_instruction_src_region(instr, src); @@ -3110,8 +3104,8 @@ int set_instruction_src2_three_src(struct brw_instruction *instr, return 0; } -void set_instruction_options(struct brw_instruction *instr, - struct brw_instruction *options) +static void set_instruction_options(struct brw_instruction *instr, + struct brw_instruction *options) { /* XXX: more instr options */ instr->header.access_mode = options->header.access_mode; @@ -3121,8 +3115,8 @@ void set_instruction_options(struct brw_instruction *instr, options->header.compression_control; } -void set_instruction_predicate(struct brw_instruction *instr, - struct brw_instruction *predicate) +static void set_instruction_predicate(struct brw_instruction *instr, + struct brw_instruction *predicate) { instr->header.predicate_control = predicate->header.predicate_control; instr->header.predicate_inverse = predicate->header.predicate_inverse; @@ -3130,8 +3124,8 @@ void set_instruction_predicate(struct brw_instruction *instr, instr->bits2.da1.flag_subreg_nr = predicate->bits2.da1.flag_subreg_nr; } -void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, - int type) +static void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, + int type) { *dst = *reg; dst->address_mode = BRW_ADDRESS_DIRECT; @@ -3140,8 +3134,8 @@ void set_direct_dst_operand(struct brw_reg *dst, struct brw_reg *reg, dst->dw1.bits.writemask = BRW_WRITEMASK_XYZW; } -void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, - int type) +static void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg, + int type) { memset(src, 0, sizeof(*src)); src->reg.address_mode = BRW_ADDRESS_DIRECT; diff --git a/assembler/main.c b/assembler/main.c index 4fe1315..269bc26 100644 --- a/assembler/main.c +++ b/assembler/main.c @@ -39,17 +39,12 @@ extern FILE *yyin; -extern int errors; - long int gen_level = 40; int advanced_flag = 0; /* 0: in unit of byte, 1: in unit of data element size */ unsigned int warning_flags = WARN_ALWAYS; -int binary_like_output = 0; /* 0: default output style, 1: nice C-style output */ int need_export = 0; char *input_filename = ""; -char *export_filename = NULL; - -const char const *binary_prepend = "static const char gen_eu_bytes[] = {\n"; +int errors; struct brw_context genasm_brw_context; struct brw_compile genasm_compile; @@ -57,6 +52,11 @@ struct brw_compile genasm_compile; struct brw_program compiled_program; struct program_defaults program_defaults = {.register_type = BRW_REGISTER_TYPE_F}; +/* 0: default output style, 1: nice C-style output */ +static int binary_like_output = 0; +static char *export_filename = NULL; +static const char binary_prepend[] = "static const char gen_eu_bytes[] = {\n"; + #define HASH_SIZE 37 struct hash_item {