X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Fbfin-lex.l;h=6837f0d8c8ead0e80d106e08dd2456fa5671c19b;hb=bd920864f3dc2cad376989a642ab774aef6b2fce;hp=3a0077cd9854f72eceac923e580d15b07c8a78b8;hpb=01f0fe5e0450edf168c1f612feb93cf588e4e7ea;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/bfin-lex.l b/gas/config/bfin-lex.l index 3a0077cd98..6837f0d8c8 100644 --- a/gas/config/bfin-lex.l +++ b/gas/config/bfin-lex.l @@ -1,12 +1,13 @@ +%option noyywrap + /* bfin-lex.l ADI Blackfin lexer - Copyright 2005 - Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. GAS is distributed in the hope that it will be useful, @@ -20,11 +21,9 @@ 02110-1301, USA. */ %{ -#include -#include +#include "as.h" #include "bfin-defs.h" #include "bfin-parse.h" -#include "as.h" static long parse_int (char **end); static int parse_halfreg (Register *r, int cl, char *hr); @@ -41,6 +40,7 @@ int yylex (void); and would match some keyword rules only with initial. */ %s KEYWORD +%s FLAGS %% [sS][fF][tT][rR][eE][sS][eE][tT] _REG.regno = REG_sftreset; return REG; @@ -49,8 +49,8 @@ int yylex (void); [hH][wW][eE][rR][rR][cC][aA][uU][sS][eE] _REG.regno = REG_hwerrcause; return REG; [eE][xX][cC][aA][uU][sS][eE] _REG.regno = REG_excause; return REG; [eE][mM][uU][cC][aA][uU][sS][eE] _REG.regno = REG_emucause; return REG; -[zZ] return Z; -[xX] return X; +[zZ] return Z; +[xX] return X; [wW]32 yylval.value = M_W32; return MMOD; [wW] return W; [vV][iI][tT]_[mM][aA][xX] return VIT_MAX; @@ -60,13 +60,13 @@ int yylex (void); [tT][hH] return TH; [tT][fF][uU] yylval.value = M_TFU; return MMOD; [tT][eE][sS][tT][sS][eE][tT] return TESTSET; -[tT] yylval.value = M_T; return MMOD; -[sS] return S; +[tT] yylval.value = M_T; return MMOD; +[sS] return S; [sS][yY][sS][cC][fF][gG] _REG.regno = REG_SYSCFG; return REG; [sS][tT][iI] return STI; [sS][sS][yY][nN][cC] return SSYNC; -[sS][pP]"."[lL] _REG.regno = REG_SP; return HALF_REG; -[sS][pP]"."[hH] _REG.regno = REG_SP | F_REG_HIGH; return HALF_REG; +[sS][pP]"."[lL] _REG.regno = REG_SP; _REG.flags = F_REG_LOW; return HALF_REG; +[sS][pP]"."[hH] _REG.regno = REG_SP; _REG.flags = F_REG_HIGH; return HALF_REG; [sS][pP] _REG.regno = REG_SP; return REG; [sS][iI][gG][nN][bB][iI][tT][sS] return SIGNBITS; [sS][iI][gG][nN] return SIGN; @@ -124,7 +124,7 @@ int yylex (void); [mM][0-3]"."[lLhH] return parse_halfreg (&yylval.reg, T_REG_M, yytext); [mM][0-3] return parse_reg (&yylval.reg, T_REG_M, yytext); -[mM] return M; +[mM] return M; [lL][tT] return LT; [lL][sS][hH][iI][fF][tT] return LSHIFT; [lL][sS][eE][tT][uU][pP] return LSETUP; @@ -160,8 +160,8 @@ int yylex (void); [gG][eE] return GE; [fF][uU] yylval.value = M_FU; return MMOD; [fF][pP] _REG.regno = REG_FP; return REG; -[fF][pP]"."[lL] _REG.regno = REG_FP; return HALF_REG; -[fF][pP]"."[hH] _REG.regno = REG_FP | F_REG_HIGH; return HALF_REG; +[fF][pP]"."[lL] _REG.regno = REG_FP; _REG.flags = F_REG_LOW; return HALF_REG; +[fF][pP]"."[hH] _REG.regno = REG_FP; _REG.flags = F_REG_HIGH; return HALF_REG; [eE][xX][tT][rR][aA][cC][tT] return EXTRACT; [eE][xX][pP][aA][dD][jJ] return EXPADJ; @@ -191,7 +191,6 @@ int yylex (void); [bB][yY][tT][eE][oO][pP]16[mM] return BYTEOP16M; [bB][yY][tT][eE][oO][pP]16[pP] return BYTEOP16P; [bB][yY][tT][eE][oO][pP]3[pP] return BYTEOP3P; -[bB][yY][tT][eE][oO][pP]2[mM] return BYTEOP2M; [bB][yY][tT][eE][oO][pP]2[pP] return BYTEOP2P; [bB][yY][tT][eE][oO][pP]1[pP] return BYTEOP1P; [bB][yY] return BY; @@ -210,6 +209,8 @@ int yylex (void); [bB] return B; [aA][zZ] _REG.regno = S_AZ; return STATUS_REG; [aA][nN] _REG.regno = S_AN; return STATUS_REG; +[aA][cC]0_[cC][oO][pP][yY] _REG.regno = S_AC0_COPY; return STATUS_REG; +[vV]_[cC][oO][pP][yY] _REG.regno = S_V_COPY; return STATUS_REG; [aA][qQ] _REG.regno = S_AQ; return STATUS_REG; [aA][cC]0 _REG.regno = S_AC0; return STATUS_REG; [aA][cC]1 _REG.regno = S_AC1; return STATUS_REG; @@ -217,8 +218,8 @@ int yylex (void); [aA][vV]0[sS] _REG.regno = S_AV0S; return STATUS_REG; [aA][vV]1 _REG.regno = S_AV1; return STATUS_REG; [aA][vV]1[sS] _REG.regno = S_AV1S; return STATUS_REG; -[vV] _REG.regno = S_V; return STATUS_REG; [vV][sS] _REG.regno = S_VS; return STATUS_REG; +[rR][nN][dD]_[mM][oO][dD] _REG.regno = S_RND_MOD; return STATUS_REG; [aA][sS][tT][aA][tT] _REG.regno = REG_ASTAT; return REG; @@ -233,7 +234,7 @@ int yylex (void); [aA]1"."[hH] return A_ONE_DOT_H; [aA]0"."[hH] return A_ZERO_DOT_H; [aA][bB][sS] return ABS; -abort return ABORT; +[aA][bB][oO][rR][tT] return ABORT; [aA]1"."[xX] _REG.regno = REG_A1x; return REG; [aA]1"."[wW] _REG.regno = REG_A1w; return REG; [aA]1 _REG.regno = REG_A1; return REG_A_DOUBLE_ONE; @@ -263,8 +264,8 @@ abort return ABORT; "<<=" return _LESS_LESS_ASSIGN; "<<" return LESS_LESS; "<" return LESS_THAN; -"(" return LPAREN; -")" return RPAREN; +"(" BEGIN(FLAGS); return LPAREN; +")" BEGIN(INITIAL); return RPAREN; ":" return COLON; "/" return SLASH; "-=" return _MINUS_ASSIGN; @@ -295,14 +296,14 @@ abort return ABORT; [iI][fF][lL][uU][sS][hH] return IFLUSH; [fF][lL][uU][sS][hH][iI][nN][vV] return FLUSHINV; [fF][lL][uU][sS][hH] return FLUSH; -([0-9]+)|(0[xX][0-9a-fA-F]+)|([bhfodBHOFD]#[0-9a-fA-F]+)|(0.[0-9]+) { +([0-9]+)|(0[xX][0-9a-fA-F]+)|([bhfodBHOFD]#[0-9a-fA-F]+)|(0"."[0-9]+) { yylval.value = parse_int (&yytext); return NUMBER; } -[A-Za-z_$.][A-Za-z0-9_$.]* { +[[:alpha:]\x80-\xff_$.][[:alnum:]\x80-\xff_$.]* { yylval.symbol = symbol_find_or_make (yytext); symbol_mark_used (yylval.symbol); - return SYMBOL; + return SYMBOL; } [0-9][bfBF] { char *name; @@ -315,8 +316,8 @@ abort return ABORT; if ((yylval.symbol != NULL) && (S_IS_DEFINED (yylval.symbol))) return SYMBOL; - as_bad ("backward reference to unknown label %d:", - (int) (ref[0] - '0')); + as_bad ("backward reference to unknown label %d:", + (int) (ref[0] - '0')); } else if (ref[1] == 'f' || ref[1] == 'F') { @@ -331,8 +332,8 @@ abort return ABORT; yylval.symbol = symbol_find_or_make (name); /* We have no need to check symbol properties. */ return SYMBOL; - } - } + } + } [ \t\n] ; "/*".*"*/" ; . return yytext[0]; @@ -344,7 +345,6 @@ static long parse_int (char **end) int shiftvalue = 0; char * char_bag; long value = 0; - char c; char *arg = *end; while (*arg && *arg == ' ') @@ -364,9 +364,9 @@ static long parse_int (char **end) fmt = 'd'; break; - case '0': /* Accept different formated integers hex octal and binary. */ + case '0': /* Accept different formatted integers hex octal and binary. */ { - c = *++arg; + char c = *++arg; arg++; if (c == 'x' || c == 'X') /* Hex input. */ fmt = 'h'; @@ -420,7 +420,7 @@ static long parse_int (char **end) break; /* The assembler allows for fractional constants to be created - by either the 0.xxxx or the f#xxxx format + by either the 0.xxxx or the f#xxxx format i.e. 0.5 would result in 0x4000 @@ -463,7 +463,7 @@ static long parse_int (char **end) { while (1) { - int c; + char c; c = *arg++; if (c >= '0' && c <= '9') value = (value * 10) + (c - '0'); @@ -487,7 +487,7 @@ static long parse_int (char **end) { char c; c = *arg++; - if (c == 0 || !index (char_bag, c)) + if (c == 0 || !strchr (char_bag, c)) { not_done = 0; *--arg = c; @@ -511,6 +511,7 @@ static long parse_int (char **end) static int parse_reg (Register *r, int cl, char *rt) { r->regno = cl | (rt[1] - '0'); + r->flags = F_REG_NONE; return REG; } @@ -526,11 +527,12 @@ static int parse_halfreg (Register *r, int cl, char *rt) case 'l': case 'L': + r->flags = F_REG_LOW; break; case 'h': case 'H': - r->regno |= F_REG_HIGH; + r->flags = F_REG_HIGH; break; } @@ -540,17 +542,8 @@ static int parse_halfreg (Register *r, int cl, char *rt) /* Our start state is KEYWORD as we have command keywords such as PREFETCH. */ -void +void set_start_state (void) { BEGIN KEYWORD; } - - -#ifndef yywrap -int -yywrap () -{ - return 1; -} -#endif