gas: blackfin: add support for BF51x-0.2 processors
[deliverable/binutils-gdb.git] / gas / config / bfin-lex.l
index c3af84202651f76cdd574f7f8185b189bf531801..1b80bf9f1f853bf4b05d05432fecea213322b032 100644 (file)
@@ -1,12 +1,12 @@
 /* bfin-lex.l  ADI Blackfin lexer
-   Copyright 2005
+   Copyright 2005, 2006, 2007, 2008, 2010
    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,
    02110-1301, USA.  */
 %{
 
-#include <stdlib.h>
-#include <string.h>
+#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);
@@ -65,8 +63,8 @@ int yylex (void);
 [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;
@@ -160,8 +158,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;
@@ -217,7 +215,6 @@ 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;
 
 
@@ -241,6 +238,8 @@ abort                                   return ABORT;
 [aA]0"."[wW]    _REG.regno = REG_A0w; return REG;
 [aA]0           _REG.regno = REG_A0;  return REG_A_DOUBLE_ZERO;
 [Gg][Oo][Tt]   return GOT;
+[Gg][Oo][Tt]"17"[Mm]"4" return GOT17M4;
+[Ff][Uu][Nn][Cc][Dd][Ee][Ss][Cc]"_"[Gg][Oo][Tt]"17"[Mm]"4" return FUNCDESC_GOT17M4;
 [Pp][Ll][Tt][Pp][Cc]   return PLTPC;
 
 
@@ -293,14 +292,14 @@ abort                                   return ABORT;
 <KEYWORD>[iI][fF][lL][uU][sS][hH]                return IFLUSH;
 <KEYWORD>[fF][lL][uU][sS][hH][iI][nN][vV]        return FLUSHINV;
 <KEYWORD>[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_$.]* { 
+[A-Za-z_$.][A-Za-z0-9_$.]* {
     yylval.symbol = symbol_find_or_make (yytext);
     symbol_mark_used (yylval.symbol);
-    return SYMBOL; 
+    return SYMBOL;
   }
 [0-9][bfBF] {
     char *name;
@@ -313,8 +312,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')
       {
@@ -329,8 +328,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];
@@ -342,7 +341,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,7 +362,7 @@ static long parse_int (char **end)
 
       case '0':  /* Accept different formated integers hex octal and binary. */
         {
-         c = *++arg;
+         char c = *++arg;
           arg++;
          if (c == 'x' || c == 'X') /* Hex input.  */
            fmt = 'h';
@@ -418,7 +416,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
 
@@ -461,7 +459,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');
@@ -485,7 +483,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;
@@ -509,6 +507,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;
 }
 
@@ -524,11 +523,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;
     }
 
@@ -538,7 +538,7 @@ 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;
@@ -548,7 +548,7 @@ set_start_state (void)
 #ifndef yywrap
 int
 yywrap ()
-{ 
+{
   return 1;
 }
 #endif
This page took 0.025908 seconds and 4 git commands to generate.