From c6f2da4e82123a98f5a2d7fc462089363ea37f0c Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 28 Oct 2009 10:14:19 +0800 Subject: [PATCH] 1. type syntax :ud :uw etc 2. empty instruction option 3. remove a conflict --- assembler/src/gram.y | 20 +++++++++++++------- assembler/src/lex.l | 9 +++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/assembler/src/gram.y b/assembler/src/gram.y index fd66eb5..4d061f3 100644 --- a/assembler/src/gram.y +++ b/assembler/src/gram.y @@ -172,9 +172,6 @@ ROOT: instrseq label: STRING COLON - { - $$ = $1; - } ; instrseq: instruction SEMICOLON instrseq @@ -202,7 +199,7 @@ instrseq: instruction SEMICOLON instrseq { struct brw_program_instruction *list_entry = calloc(sizeof(struct brw_program_instruction), 1); - list_entry->string = $1; + list_entry->string = strdup($1); list_entry->islabel = 1; list_entry->next = $2.first; $2.first = list_entry; @@ -1353,6 +1350,13 @@ region: LANGLE exp COMMA exp COMMA exp RANGLE $$.width = ffs($4) - 1; $$.horiz_stride = ffs($6); } + | LANGLE exp SEMICOLON exp COMMA exp RANGLE + { + memset (&$$, '\0', sizeof ($$)); + $$.vert_stride = ffs($2); + $$.width = ffs($4) - 1; + $$.horiz_stride = ffs($6); + } ; /* region_wh is used in specifying indirect operands where rather than having @@ -1461,7 +1465,6 @@ writemask_w: /* empty */ { $$ = 0; } /* 1.4.11: Immediate values */ imm32: exp { $$.r = imm32_d; $$.u.d = $1; } - | MINUS exp { $$.r = imm32_d; $$.u.d = -$2; } | NUMBER { $$.r = imm32_f; $$.u.f = $1; } ; @@ -1547,11 +1550,14 @@ conditionalmodifier: /* empty */ { $$ = BRW_CONDITIONAL_NONE; } ; /* 1.4.13: Instruction options */ -instoptions: LCURLY instoption_list RCURLY +instoptions: /* empty */ + { memset(&$$, 0, sizeof($$)); } + | LCURLY instoption_list RCURLY { $$ = $2; } ; -instoption_list: instoption instoption_list +instoption_list: + instoption instoption_list { $$ = $2; switch ($1) { diff --git a/assembler/src/lex.l b/assembler/src/lex.l index 6bc718b..8d7a4f0 100644 --- a/assembler/src/lex.l +++ b/assembler/src/lex.l @@ -239,14 +239,23 @@ extern char *input_filename; * in the BNF of the assembly, but our existing source didn't use that syntax. */ "UD" { return TYPE_UD; } +":UD" { return TYPE_UD; } "D" { return TYPE_D; } +":D" { return TYPE_D; } "UW" { return TYPE_UW; } +":UW" { return TYPE_UW; } "W" { return TYPE_W; } +":W" { return TYPE_W; } "UB" { return TYPE_UB; } +":UB" { return TYPE_UB; } "B" { return TYPE_B; } +":B" { return TYPE_B; } "F" { return TYPE_F; } +":F" { return TYPE_B; } "VF" {return TYPE_VF; } +":VF" {return TYPE_VF; } "V" { return TYPE_V; } +":V" { return TYPE_V; } "sat" { return SATURATE; } "align1" { return ALIGN1; } -- 2.7.4