summaryrefslogtreecommitdiff
path: root/assembler/lex.l
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-08-29 18:31:34 -0700
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:23 +0000
commit3bcf6b29cdef3cde36a55a5dde6d451a8d8e2f4b (patch)
treeaa7217f598e315cd28e5204d6cbf7e7e3cea252d /assembler/lex.l
parent2dac0a19a438d27b03e901cc70ef0a9a27039154 (diff)
Add support for register-indirect access in destination registers.
This is untested. Also, a few bits for source operand register-indirect access sneak in with this commit.
Diffstat (limited to 'assembler/lex.l')
-rw-r--r--assembler/lex.l17
1 files changed, 17 insertions, 0 deletions
diff --git a/assembler/lex.l b/assembler/lex.l
index e971360d..ef9101a5 100644
--- a/assembler/lex.l
+++ b/assembler/lex.l
@@ -102,12 +102,23 @@ int saved_state = INITIAL;
">" { return RANGLE; }
"{" { return LCURLY; }
"}" { return RCURLY; }
+"[" { return LSQUARE; }
+"]" { return RSQUARE; }
"," { return COMMA; }
"." { return DOT; }
"+" { return PLUS; }
"-" { return MINUS; }
"(abs)" { return ABS; }
+ /* Most register accesses are lexed as REGFILE[0-9]+, to prevent the register
+ * with subreg from being lexed as REGFILE NUMBER instead of
+ * REGISTER INTEGER DOT INTEGER like we want. The alternative was to use a
+ * start condition, which wasn't very clean-looking.
+ *
+ * However, this means we need to lex the general and message register file
+ * characters as well, for register-indirect access which is formatted
+ * like g[a#.#] or m[a#.#].
+ */
"acc"[0-9]+ {
yylval.integer = atoi(yytext + 1);
return ACCREG;
@@ -120,6 +131,9 @@ int saved_state = INITIAL;
yylval.integer = atoi(yytext + 1);
return MSGREG;
}
+"m" {
+ return MSGREGFILE;
+}
"mask"[0-9]+ {
yylval.integer = atoi(yytext + 1);
return MASKREG;
@@ -152,6 +166,9 @@ int saved_state = INITIAL;
yylval.integer = atoi(yytext + 1);
return GENREG;
}
+[gr] {
+ return GENREGFILE;
+}
"cr"[0-9]+ {
yylval.integer = atoi(yytext + 1);
return CONTROLREG;