assembler: distinguish the channel of .z from the condition of .z
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 25 Mar 2014 05:55:14 +0000 (13:55 +0800)
committerDamien Lespiau <damien.lespiau@intel.com>
Mon, 19 May 2014 21:49:25 +0000 (22:49 +0100)
The scratch patch only works for generic register

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75631
Tested-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
assembler/lex.l

index 81a52ba..1ba576b 100644 (file)
@@ -24,6 +24,8 @@ int yycolumn = 1;
 %x CHANNEL
 %x LINENUMBER
 %x FILENAME
+%x REG
+%x DOTSEL
 
 %%
 \/\/.*[\r\n] { yycolumn = 1; } /* eat up single-line comments */
@@ -247,8 +249,46 @@ yylval.integer = BRW_CHANNEL_W;
 
 [gr][0-9]+ {
        yylval.integer = atoi(yytext + 1);
+       BEGIN(REG);
        return GENREG;
 }
+<REG>"<" { return LANGLE; }
+<REG>[0-9][0-9]* {
+       yylval.integer = strtoul(yytext, NULL, 10);
+       return INTEGER;
+}
+<REG>">" { return RANGLE; }
+
+<REG>"," { return COMMA; }
+<REG>"." { BEGIN(DOTSEL); return DOT; }
+<REG>";" { return SEMICOLON; }
+
+<DOTSEL>"x" {
+       yylval.integer = BRW_CHANNEL_X;
+       return X;
+}
+<DOTSEL>"y" {
+       yylval.integer = BRW_CHANNEL_Y;
+       return Y;
+}
+<DOTSEL>"z" {
+       yylval.integer = BRW_CHANNEL_Z;
+       return Z;
+}
+<DOTSEL>"w" {
+       yylval.integer = BRW_CHANNEL_W;
+       return W;
+}
+<DOTSEL>[0-9][0-9]* {
+       yylval.integer = strtoul(yytext, NULL, 10);
+       BEGIN(REG);
+       return INTEGER;
+}
+<DOTSEL>. {
+       yyless(0);
+       BEGIN(INITIAL);
+}
+
 [gr] {
        return GENREGFILE;
 }
@@ -296,6 +336,11 @@ yylval.integer = BRW_CHANNEL_W;
        return LMS;
 }
 
+<REG>. {
+       yyless(0);
+       BEGIN(INITIAL);
+}
+
  /*
   * Lexing of register types should probably require the ":" symbol specified
   * in the BNF of the assembly, but our existing source didn't use that syntax.