Changes to support making the shift instructions be true BinaryOperators.
[oota-llvm.git] / lib / AsmParser / Lexer.l.cvs
index 970a214312946d038b3f92ce135dfc51eda348f3..e5e8256bc111204b65dbb97bf27b8534a96e6912 100644 (file)
@@ -148,8 +148,11 @@ using namespace llvm;
 /* Comments start with a ; and go till end of line */
 Comment    ;.*
 
-/* Variable(Value) identifiers start with a % sign */
-VarID       %[-a-zA-Z$._][-a-zA-Z$._0-9]*
+/* Local Values and Type identifiers start with a % sign */
+LocalVarName       %[-a-zA-Z$._][-a-zA-Z$._0-9]*
+
+/* Global Value identifiers start with an @ sign */
+GlobalVarName       @[-a-zA-Z$._][-a-zA-Z$._0-9]*
 
 /* Label identifiers end with a colon */
 Label       [-a-zA-Z$._0-9]+:
@@ -157,18 +160,16 @@ QuoteLabel \"[^\"]+\":
 
 /* Quoted names can contain any character except " and \ */
 StringConstant \"[^\"]*\"
+AtStringConstant @\"[^\"]*\"
+  
+/* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */
+LocalVarID     %[0-9]+
+GlobalVarID    @[0-9]+
 
-
-/* [PN]Integer: match positive and negative literal integer values that
- * are preceeded by a '%' character.  These represent unnamed variable slots.
- */
-EPInteger     %[0-9]+
-ENInteger    %-[0-9]+
-
+/* Integer types are specified with i and a bitwidth */
 IntegerType i[0-9]+
 
-
-/* E[PN]Integer: match positive and negative literal integer values */
+/* E[PN]Integer: match positive and negative literal integer values. */
 PInteger   [0-9]+
 NInteger  -[0-9]+
 
@@ -216,11 +217,7 @@ tail            { return TAIL; }
 target          { return TARGET; }
 triple          { return TRIPLE; }
 deplibs         { return DEPLIBS; }
-endian          { return ENDIAN; }
-pointersize     { return POINTERSIZE; }
 datalayout      { return DATALAYOUT; }
-little          { return LITTLE; }
-big             { return BIG; }
 volatile        { return VOLATILE; }
 align           { return ALIGN;  }
 section         { return SECTION; }
@@ -230,12 +227,14 @@ sideeffect      { return SIDEEFFECT; }
 
 cc              { return CC_TOK; }
 ccc             { return CCC_TOK; }
-csretcc         { return CSRETCC_TOK; }
 fastcc          { return FASTCC_TOK; }
 coldcc          { return COLDCC_TOK; }
 x86_stdcallcc   { return X86_STDCALLCC_TOK; }
 x86_fastcallcc  { return X86_FASTCALLCC_TOK; }
 
+inreg           { return INREG; }
+sret            { return SRET;  }
+
 void            { RET_TY(Type::VoidTy,  VOID);  }
 float           { RET_TY(Type::FloatTy, FLOAT); }
 double          { RET_TY(Type::DoubleTy,DOUBLE);}
@@ -259,11 +258,15 @@ fdiv            { RET_TOK(BinaryOpVal, FDiv, FDIV); }
 urem            { RET_TOK(BinaryOpVal, URem, UREM); }
 srem            { RET_TOK(BinaryOpVal, SRem, SREM); }
 frem            { RET_TOK(BinaryOpVal, FRem, FREM); }
+shl             { RET_TOK(BinaryOpVal, Shl, SHL); }
+lshr            { RET_TOK(BinaryOpVal, LShr, LSHR); }
+ashr            { RET_TOK(BinaryOpVal, AShr, ASHR); }
 and             { RET_TOK(BinaryOpVal, And, AND); }
 or              { RET_TOK(BinaryOpVal, Or , OR ); }
 xor             { RET_TOK(BinaryOpVal, Xor, XOR); }
 icmp            { RET_TOK(OtherOpVal,  ICmp,  ICMP); }
 fcmp            { RET_TOK(OtherOpVal,  FCmp,  FCMP); }
+
 eq              { return EQ;  }
 ne              { return NE;  }
 slt             { return SLT; }
@@ -300,9 +303,6 @@ inttoptr        { RET_TOK(CastOpVal, IntToPtr, INTTOPTR); }
 ptrtoint        { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
 bitcast         { RET_TOK(CastOpVal, BitCast, BITCAST); }
 select          { RET_TOK(OtherOpVal, Select, SELECT); }
-shl             { RET_TOK(OtherOpVal, Shl, SHL); }
-lshr            { RET_TOK(OtherOpVal, LShr, LSHR); }
-ashr            { RET_TOK(OtherOpVal, AShr, ASHR); }
 va_arg          { RET_TOK(OtherOpVal, VAArg , VAARG); }
 ret             { RET_TOK(TermOpVal, Ret, RET); }
 br              { RET_TOK(TermOpVal, Br, BR); }
@@ -323,10 +323,15 @@ insertelement   { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
 shufflevector   { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
 
 
-{VarID}         {
+{LocalVarName}  {
                   UnEscapeLexed(yytext+1);
                   llvmAsmlval.StrVal = strdup(yytext+1);             // Skip %
-                  return VAR_ID;
+                  return LOCALVAR;
+                }
+{GlobalVarName} {
+                  UnEscapeLexed(yytext+1);
+                  llvmAsmlval.StrVal = strdup(yytext+1);             // Skip @
+                  return GLOBALVAR;
                 }
 {Label}         {
                   yytext[strlen(yytext)-1] = 0;  // nuke colon
@@ -350,6 +355,12 @@ shufflevector   { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
                    llvmAsmlval.StrVal = strdup(yytext+1);  // Nuke start quote
                    return STRINGCONSTANT;
                  }
+{AtStringConstant} {
+                     yytext[strlen(yytext)-1] = 0;           // nuke end quote
+                     llvmAsmlval.StrVal = strdup(yytext+2);  // Nuke @, quote
+                     return ATSTRINGCONSTANT;
+                   }
+
 
 
 {PInteger}      { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
@@ -366,20 +377,19 @@ shufflevector   { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
                    return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
                  }
 
-{EPInteger}     {
+{LocalVarID}     {
                   uint64_t Val = atoull(yytext+1);
                   if ((unsigned)Val != Val)
                     GenerateError("Invalid value number (too large)!");
                   llvmAsmlval.UIntVal = unsigned(Val);
-                  return UINTVAL;
+                  return LOCALVAL_ID;
                 }
-{ENInteger}     {
-                  uint64_t Val = atoull(yytext+2);
-                  // +1:  we have bigger negative range
-                  if (Val > (uint64_t)INT32_MAX+1)
-                    GenerateError("Constant too large for signed 32 bits!");
-                  llvmAsmlval.SIntVal = (int)-Val;
-                  return SINTVAL;
+{GlobalVarID}   {
+                  uint64_t Val = atoull(yytext+1);
+                  if ((unsigned)Val != Val)
+                    GenerateError("Invalid value number (too large)!");
+                  llvmAsmlval.UIntVal = unsigned(Val);
+                  return GLOBALVAL_ID;
                 }
 
 {FPConstant}    { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }