mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
adjust to new style of handling lexer changes
llvm-svn: 26162
This commit is contained in:
parent
be28034223
commit
ca895c34ed
@ -768,7 +768,7 @@ goto find_rule; \
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 1 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#define INITIAL 0
|
||||
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
|
||||
//
|
||||
@ -783,7 +783,7 @@ char *yytext;
|
||||
//
|
||||
//===----------------------------------------------------------------------===*/
|
||||
#define YY_NEVER_INTERACTIVE 1
|
||||
#line 28 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 28 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#include "ParserInternals.h"
|
||||
#include "llvm/Module.h"
|
||||
#include <list>
|
||||
@ -1060,7 +1060,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 179 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 179 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
|
||||
|
||||
#line 1067 "Lexer.cpp"
|
||||
@ -1156,467 +1156,467 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
{ /* beginning of action switch */
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 181 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 181 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore comments for now */ }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 183 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 183 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return BEGINTOK; }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 184 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ENDTOK; }
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 185 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TRUETOK; }
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 186 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return FALSETOK; }
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 187 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DECLARE; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 188 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return GLOBAL; }
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 189 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 189 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CONSTANT; }
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 190 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return INTERNAL; }
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 191 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 191 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return LINKONCE; }
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 192 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 192 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return WEAK; }
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 193 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return APPENDING; }
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 194 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERNAL; } /* Deprecated, turn into external */
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 195 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERNAL; }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 196 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 196 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return IMPLEMENTATION; }
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 197 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 197 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ZEROINITIALIZER; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 198 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 198 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DOTDOTDOT; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 199 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return UNDEF; }
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 200 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 200 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return NULL_TOK; }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 201 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TO; }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 202 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 202 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 203 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return NOT; } /* Deprecated, turned into XOR */
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 204 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TAIL; }
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 205 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TARGET; }
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 206 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 206 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TRIPLE; }
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 207 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return DEPLIBS; }
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 208 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 208 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ENDIAN; }
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 209 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 209 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return POINTERSIZE; }
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 210 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 210 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return LITTLE; }
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 211 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return BIG; }
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 212 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 212 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VOLATILE; }
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 213 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ALIGN; }
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 214 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return SECTION; }
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 215 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return MODULE; }
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 216 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 216 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return ASM_TOK; }
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 217 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 217 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return SIDEEFFECT; }
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 219 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CC_TOK; }
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 220 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return CCC_TOK; }
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 221 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return FASTCC_TOK; }
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 222 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 222 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return COLDCC_TOK; }
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 224 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::VoidTy ; return VOID; }
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 225 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; }
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 226 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; }
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 227 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; }
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 228 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; }
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 229 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UShortTy; return USHORT; }
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 230 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::IntTy ; return INT; }
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 231 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 231 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::UIntTy ; return UINT; }
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 232 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 232 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::LongTy ; return LONG; }
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 233 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 233 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; }
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 234 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 234 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; }
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 235 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 235 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; }
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 236 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 236 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; }
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 237 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return TYPE; }
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 238 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return OPAQUE; }
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 240 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Add, ADD); }
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 241 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Sub, SUB); }
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 242 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Mul, MUL); }
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 243 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 243 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Div, DIV); }
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 244 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Rem, REM); }
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 245 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, And, AND); }
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 246 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 246 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Or , OR ); }
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 247 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 247 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Xor, XOR); }
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 248 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 248 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetNE, SETNE); }
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 249 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 249 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 250 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 250 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetLT, SETLT); }
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 251 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 251 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetGT, SETGT); }
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 252 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 252 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetLE, SETLE); }
|
||||
YY_BREAK
|
||||
case 69:
|
||||
YY_RULE_SETUP
|
||||
#line 253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 253 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
||||
YY_BREAK
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 255 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 255 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, PHI, PHI_TOK); }
|
||||
YY_BREAK
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 256 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Call, CALL); }
|
||||
YY_BREAK
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 257 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Cast, CAST); }
|
||||
YY_BREAK
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 258 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 258 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Select, SELECT); }
|
||||
YY_BREAK
|
||||
case 74:
|
||||
YY_RULE_SETUP
|
||||
#line 259 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 259 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Shl, SHL); }
|
||||
YY_BREAK
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 260 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Shr, SHR); }
|
||||
YY_BREAK
|
||||
case 76:
|
||||
YY_RULE_SETUP
|
||||
#line 261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 261 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VANEXT_old; }
|
||||
YY_BREAK
|
||||
case 77:
|
||||
YY_RULE_SETUP
|
||||
#line 262 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 262 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return VAARG_old; }
|
||||
YY_BREAK
|
||||
case 78:
|
||||
YY_RULE_SETUP
|
||||
#line 263 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 263 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, VAArg , VAARG); }
|
||||
YY_BREAK
|
||||
case 79:
|
||||
YY_RULE_SETUP
|
||||
#line 264 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 264 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Ret, RET); }
|
||||
YY_BREAK
|
||||
case 80:
|
||||
YY_RULE_SETUP
|
||||
#line 265 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 265 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Br, BR); }
|
||||
YY_BREAK
|
||||
case 81:
|
||||
YY_RULE_SETUP
|
||||
#line 266 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 266 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Switch, SWITCH); }
|
||||
YY_BREAK
|
||||
case 82:
|
||||
YY_RULE_SETUP
|
||||
#line 267 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 267 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Invoke, INVOKE); }
|
||||
YY_BREAK
|
||||
case 83:
|
||||
YY_RULE_SETUP
|
||||
#line 268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 268 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
YY_BREAK
|
||||
case 84:
|
||||
YY_RULE_SETUP
|
||||
#line 269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 269 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
|
||||
YY_BREAK
|
||||
case 85:
|
||||
YY_RULE_SETUP
|
||||
#line 271 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 271 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Malloc, MALLOC); }
|
||||
YY_BREAK
|
||||
case 86:
|
||||
YY_RULE_SETUP
|
||||
#line 272 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 272 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Alloca, ALLOCA); }
|
||||
YY_BREAK
|
||||
case 87:
|
||||
YY_RULE_SETUP
|
||||
#line 273 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 273 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Free, FREE); }
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 274 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 274 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Load, LOAD); }
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
#line 275 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 275 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Store, STORE); }
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
#line 276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 276 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
#line 278 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 278 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
#line 279 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 279 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
|
||||
YY_BREAK
|
||||
case 93:
|
||||
YY_RULE_SETUP
|
||||
#line 282 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 282 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
|
||||
@ -1625,7 +1625,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 94:
|
||||
YY_RULE_SETUP
|
||||
#line 287 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 287 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-1] = 0; // nuke colon
|
||||
UnEscapeLexed(yytext);
|
||||
@ -1635,7 +1635,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 95:
|
||||
YY_RULE_SETUP
|
||||
#line 293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 293 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
|
||||
UnEscapeLexed(yytext+1);
|
||||
@ -1645,7 +1645,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 96:
|
||||
YY_RULE_SETUP
|
||||
#line 300 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 300 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ // Note that we cannot unescape a string constant here! The
|
||||
// string constant might contain a \00 which would not be
|
||||
// understood by the string stuff. It is valid to make a
|
||||
@ -1658,12 +1658,12 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 97:
|
||||
YY_RULE_SETUP
|
||||
#line 311 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 311 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
|
||||
YY_BREAK
|
||||
case 98:
|
||||
YY_RULE_SETUP
|
||||
#line 312 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 312 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
@ -1675,7 +1675,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
#line 320 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 320 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
|
||||
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||
@ -1683,7 +1683,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
#line 325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 325 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
@ -1694,7 +1694,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
#line 332 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 332 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
@ -1706,16 +1706,16 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
#line 341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 341 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
#line 342 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 342 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
#line 344 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 344 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
/* Make sure to free the internal buffers for flex when we are
|
||||
* done reading our input!
|
||||
@ -1726,17 +1726,17 @@ case YY_STATE_EOF(INITIAL):
|
||||
YY_BREAK
|
||||
case 104:
|
||||
YY_RULE_SETUP
|
||||
#line 352 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 352 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore whitespace */ }
|
||||
YY_BREAK
|
||||
case 105:
|
||||
YY_RULE_SETUP
|
||||
#line 353 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 353 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
{ return yytext[0]; }
|
||||
YY_BREAK
|
||||
case 106:
|
||||
YY_RULE_SETUP
|
||||
#line 355 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 355 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
YY_FATAL_ERROR( "flex scanner jammed" );
|
||||
YY_BREAK
|
||||
#line 1743 "Lexer.cpp"
|
||||
@ -2621,5 +2621,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 355 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
#line 355 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l"
|
||||
|
355
lib/AsmParser/Lexer.l.cvs
Normal file
355
lib/AsmParser/Lexer.l.cvs
Normal file
@ -0,0 +1,355 @@
|
||||
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the flex scanner for LLVM assembly languages files.
|
||||
//
|
||||
//===----------------------------------------------------------------------===*/
|
||||
|
||||
%option prefix="llvmAsm"
|
||||
%option yylineno
|
||||
%option nostdinit
|
||||
%option never-interactive
|
||||
%option batch
|
||||
%option noyywrap
|
||||
%option nodefault
|
||||
%option 8bit
|
||||
%option outfile="Lexer.cpp"
|
||||
%option ecs
|
||||
%option noreject
|
||||
%option noyymore
|
||||
|
||||
%{
|
||||
#include "ParserInternals.h"
|
||||
#include "llvm/Module.h"
|
||||
#include <list>
|
||||
#include "llvmAsmParser.h"
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
|
||||
void set_scan_file(FILE * F){
|
||||
yy_switch_to_buffer(yy_create_buffer( F, YY_BUF_SIZE ) );
|
||||
}
|
||||
void set_scan_string (const char * str) {
|
||||
yy_scan_string (str);
|
||||
}
|
||||
|
||||
#define RET_TOK(type, Enum, sym) \
|
||||
llvmAsmlval.type = Instruction::Enum; return sym
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// TODO: All of the static identifiers are figured out by the lexer,
|
||||
// these should be hashed to reduce the lexer size
|
||||
|
||||
|
||||
// atoull - Convert an ascii string of decimal digits into the unsigned long
|
||||
// long representation... this does not have to do input error checking,
|
||||
// because we know that the input will be matched by a suitable regex...
|
||||
//
|
||||
static uint64_t atoull(const char *Buffer) {
|
||||
uint64_t Result = 0;
|
||||
for (; *Buffer; Buffer++) {
|
||||
uint64_t OldRes = Result;
|
||||
Result *= 10;
|
||||
Result += *Buffer-'0';
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
static uint64_t HexIntToVal(const char *Buffer) {
|
||||
uint64_t Result = 0;
|
||||
for (; *Buffer; ++Buffer) {
|
||||
uint64_t OldRes = Result;
|
||||
Result *= 16;
|
||||
char C = *Buffer;
|
||||
if (C >= '0' && C <= '9')
|
||||
Result += C-'0';
|
||||
else if (C >= 'A' && C <= 'F')
|
||||
Result += C-'A'+10;
|
||||
else if (C >= 'a' && C <= 'f')
|
||||
Result += C-'a'+10;
|
||||
|
||||
if (Result < OldRes) // Uh, oh, overflow detected!!!
|
||||
ThrowException("constant bigger than 64 bits detected!");
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
// HexToFP - Convert the ascii string in hexidecimal format to the floating
|
||||
// point representation of it.
|
||||
//
|
||||
static double HexToFP(const char *Buffer) {
|
||||
// Behave nicely in the face of C TBAA rules... see:
|
||||
// http://www.nullstone.com/htmls/category/aliastyp.htm
|
||||
union {
|
||||
uint64_t UI;
|
||||
double FP;
|
||||
} UIntToFP;
|
||||
UIntToFP.UI = HexIntToVal(Buffer);
|
||||
|
||||
assert(sizeof(double) == sizeof(uint64_t) &&
|
||||
"Data sizes incompatible on this target!");
|
||||
return UIntToFP.FP; // Cast Hex constant to double
|
||||
}
|
||||
|
||||
|
||||
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
|
||||
// appropriate character. If AllowNull is set to false, a \00 value will cause
|
||||
// an exception to be thrown.
|
||||
//
|
||||
// If AllowNull is set to true, the return value of the function points to the
|
||||
// last character of the string in memory.
|
||||
//
|
||||
char *UnEscapeLexed(char *Buffer, bool AllowNull) {
|
||||
char *BOut = Buffer;
|
||||
for (char *BIn = Buffer; *BIn; ) {
|
||||
if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
|
||||
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
|
||||
*BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
|
||||
if (!AllowNull && !*BOut)
|
||||
ThrowException("String literal cannot accept \\00 escape!");
|
||||
|
||||
BIn[3] = Tmp; // Restore character
|
||||
BIn += 3; // Skip over handled chars
|
||||
++BOut;
|
||||
} else {
|
||||
*BOut++ = *BIn++;
|
||||
}
|
||||
}
|
||||
|
||||
return BOut;
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define YY_NEVER_INTERACTIVE 1
|
||||
%}
|
||||
|
||||
|
||||
|
||||
/* 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]*
|
||||
|
||||
/* Label identifiers end with a colon */
|
||||
Label [-a-zA-Z$._0-9]+:
|
||||
QuoteLabel \"[^\"]+\":
|
||||
|
||||
/* Quoted names can contain any character except " and \ */
|
||||
StringConstant \"[^\"]*\"
|
||||
|
||||
|
||||
/* [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]+
|
||||
|
||||
|
||||
/* E[PN]Integer: match positive and negative literal integer values */
|
||||
PInteger [0-9]+
|
||||
NInteger -[0-9]+
|
||||
|
||||
/* FPConstant - A Floating point constant.
|
||||
*/
|
||||
FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
|
||||
|
||||
/* HexFPConstant - Floating point constant represented in IEEE format as a
|
||||
* hexadecimal number for when exponential notation is not precise enough.
|
||||
*/
|
||||
HexFPConstant 0x[0-9A-Fa-f]+
|
||||
|
||||
/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
|
||||
* it to deal with 64 bit numbers.
|
||||
*/
|
||||
HexIntConstant [us]0x[0-9A-Fa-f]+
|
||||
%%
|
||||
|
||||
{Comment} { /* Ignore comments for now */ }
|
||||
|
||||
begin { return BEGINTOK; }
|
||||
end { return ENDTOK; }
|
||||
true { return TRUETOK; }
|
||||
false { return FALSETOK; }
|
||||
declare { return DECLARE; }
|
||||
global { return GLOBAL; }
|
||||
constant { return CONSTANT; }
|
||||
internal { return INTERNAL; }
|
||||
linkonce { return LINKONCE; }
|
||||
weak { return WEAK; }
|
||||
appending { return APPENDING; }
|
||||
uninitialized { return EXTERNAL; } /* Deprecated, turn into external */
|
||||
external { return EXTERNAL; }
|
||||
implementation { return IMPLEMENTATION; }
|
||||
zeroinitializer { return ZEROINITIALIZER; }
|
||||
\.\.\. { return DOTDOTDOT; }
|
||||
undef { return UNDEF; }
|
||||
null { return NULL_TOK; }
|
||||
to { return TO; }
|
||||
except { RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
not { return NOT; } /* Deprecated, turned into XOR */
|
||||
tail { return TAIL; }
|
||||
target { return TARGET; }
|
||||
triple { return TRIPLE; }
|
||||
deplibs { return DEPLIBS; }
|
||||
endian { return ENDIAN; }
|
||||
pointersize { return POINTERSIZE; }
|
||||
little { return LITTLE; }
|
||||
big { return BIG; }
|
||||
volatile { return VOLATILE; }
|
||||
align { return ALIGN; }
|
||||
section { return SECTION; }
|
||||
module { return MODULE; }
|
||||
asm { return ASM_TOK; }
|
||||
sideeffect { return SIDEEFFECT; }
|
||||
|
||||
cc { return CC_TOK; }
|
||||
ccc { return CCC_TOK; }
|
||||
fastcc { return FASTCC_TOK; }
|
||||
coldcc { return COLDCC_TOK; }
|
||||
|
||||
void { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; }
|
||||
bool { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; }
|
||||
sbyte { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; }
|
||||
ubyte { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; }
|
||||
short { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; }
|
||||
ushort { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; }
|
||||
int { llvmAsmlval.PrimType = Type::IntTy ; return INT; }
|
||||
uint { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; }
|
||||
long { llvmAsmlval.PrimType = Type::LongTy ; return LONG; }
|
||||
ulong { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; }
|
||||
float { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; }
|
||||
double { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; }
|
||||
label { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; }
|
||||
type { return TYPE; }
|
||||
opaque { return OPAQUE; }
|
||||
|
||||
add { RET_TOK(BinaryOpVal, Add, ADD); }
|
||||
sub { RET_TOK(BinaryOpVal, Sub, SUB); }
|
||||
mul { RET_TOK(BinaryOpVal, Mul, MUL); }
|
||||
div { RET_TOK(BinaryOpVal, Div, DIV); }
|
||||
rem { RET_TOK(BinaryOpVal, Rem, REM); }
|
||||
and { RET_TOK(BinaryOpVal, And, AND); }
|
||||
or { RET_TOK(BinaryOpVal, Or , OR ); }
|
||||
xor { RET_TOK(BinaryOpVal, Xor, XOR); }
|
||||
setne { RET_TOK(BinaryOpVal, SetNE, SETNE); }
|
||||
seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
|
||||
setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); }
|
||||
setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
|
||||
setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
|
||||
setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
|
||||
|
||||
phi { RET_TOK(OtherOpVal, PHI, PHI_TOK); }
|
||||
call { RET_TOK(OtherOpVal, Call, CALL); }
|
||||
cast { RET_TOK(OtherOpVal, Cast, CAST); }
|
||||
select { RET_TOK(OtherOpVal, Select, SELECT); }
|
||||
shl { RET_TOK(OtherOpVal, Shl, SHL); }
|
||||
shr { RET_TOK(OtherOpVal, Shr, SHR); }
|
||||
vanext { return VANEXT_old; }
|
||||
vaarg { return VAARG_old; }
|
||||
va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); }
|
||||
ret { RET_TOK(TermOpVal, Ret, RET); }
|
||||
br { RET_TOK(TermOpVal, Br, BR); }
|
||||
switch { RET_TOK(TermOpVal, Switch, SWITCH); }
|
||||
invoke { RET_TOK(TermOpVal, Invoke, INVOKE); }
|
||||
unwind { RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
unreachable { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
|
||||
|
||||
malloc { RET_TOK(MemOpVal, Malloc, MALLOC); }
|
||||
alloca { RET_TOK(MemOpVal, Alloca, ALLOCA); }
|
||||
free { RET_TOK(MemOpVal, Free, FREE); }
|
||||
load { RET_TOK(MemOpVal, Load, LOAD); }
|
||||
store { RET_TOK(MemOpVal, Store, STORE); }
|
||||
getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
|
||||
|
||||
extractelement { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
|
||||
insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
|
||||
|
||||
|
||||
{VarID} {
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
|
||||
return VAR_ID;
|
||||
}
|
||||
{Label} {
|
||||
yytext[strlen(yytext)-1] = 0; // nuke colon
|
||||
UnEscapeLexed(yytext);
|
||||
llvmAsmlval.StrVal = strdup(yytext);
|
||||
return LABELSTR;
|
||||
}
|
||||
{QuoteLabel} {
|
||||
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1);
|
||||
return LABELSTR;
|
||||
}
|
||||
|
||||
{StringConstant} { // Note that we cannot unescape a string constant here! The
|
||||
// string constant might contain a \00 which would not be
|
||||
// understood by the string stuff. It is valid to make a
|
||||
// [sbyte] c"Hello World\00" constant, for example.
|
||||
//
|
||||
yytext[strlen(yytext)-1] = 0; // nuke end quote
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote
|
||||
return STRINGCONSTANT;
|
||||
}
|
||||
|
||||
|
||||
{PInteger} { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
|
||||
{NInteger} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT64_MAX+1)
|
||||
ThrowException("Constant too large for signed 64 bits!");
|
||||
llvmAsmlval.SInt64Val = -Val;
|
||||
return ESINT64VAL;
|
||||
}
|
||||
{HexIntConstant} {
|
||||
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
|
||||
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||
}
|
||||
|
||||
{EPInteger} {
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
ThrowException("Invalid value number (too large)!");
|
||||
llvmAsmlval.UIntVal = unsigned(Val);
|
||||
return UINTVAL;
|
||||
}
|
||||
{ENInteger} {
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
if (Val > (uint64_t)INT32_MAX+1)
|
||||
ThrowException("Constant too large for signed 32 bits!");
|
||||
llvmAsmlval.SIntVal = (int)-Val;
|
||||
return SINTVAL;
|
||||
}
|
||||
|
||||
{FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
|
||||
{HexFPConstant} { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
|
||||
|
||||
<<EOF>> {
|
||||
/* Make sure to free the internal buffers for flex when we are
|
||||
* done reading our input!
|
||||
*/
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
||||
return EOF;
|
||||
}
|
||||
|
||||
[ \r\t\n] { /* Ignore whitespace */ }
|
||||
. { return yytext[0]; }
|
||||
|
||||
%%
|
Loading…
Reference in New Issue
Block a user