From 3f87233d700eb4316cfaad59477834d2f5a2503b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 28 Jul 2009 16:08:33 +0000 Subject: [PATCH] llvm-mc: Sink token enum into AsmToken. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77322 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-mc/AsmLexer.cpp | 82 ++++++------- tools/llvm-mc/AsmLexer.h | 35 +++--- tools/llvm-mc/AsmParser.cpp | 196 +++++++++++++++---------------- tools/llvm-mc/MC-X86Specific.cpp | 38 +++--- tools/llvm-mc/llvm-mc.cpp | 72 ++++++------ 5 files changed, 213 insertions(+), 210 deletions(-) diff --git a/tools/llvm-mc/AsmLexer.cpp b/tools/llvm-mc/AsmLexer.cpp index 9e777b6e6e2..de583ffa8cc 100644 --- a/tools/llvm-mc/AsmLexer.cpp +++ b/tools/llvm-mc/AsmLexer.cpp @@ -24,7 +24,7 @@ AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) { CurBuffer = 0; CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurPtr = CurBuf->getBufferStart(); - CurTok = AsmToken(asmtok::Error, StringRef(CurPtr, 0)); + CurTok = AsmToken(AsmToken::Error, StringRef(CurPtr, 0)); TokStart = 0; } @@ -41,10 +41,10 @@ void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg, } /// ReturnError - Set the error to the specified string at the specified -/// location. This is defined to always return asmtok::Error. +/// location. This is defined to always return AsmToken::Error. AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) { SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error"); - return AsmToken(asmtok::Error, StringRef(Loc, 0)); + return AsmToken(AsmToken::Error, StringRef(Loc, 0)); } /// EnterIncludeFile - Enter the specified file. This prints an error and @@ -99,18 +99,18 @@ AsmToken AsmLexer::LexIdentifier() { while (isalnum(*CurPtr) || *CurPtr == '_' || *CurPtr == '$' || *CurPtr == '.' || *CurPtr == '@') ++CurPtr; - return AsmToken(asmtok::Identifier, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::Identifier, StringRef(TokStart, CurPtr - TokStart)); } /// LexPercent: Register: %[a-zA-Z0-9]+ AsmToken AsmLexer::LexPercent() { if (!isalnum(*CurPtr)) - return AsmToken(asmtok::Percent, StringRef(CurPtr, 1)); // Single %. + return AsmToken(AsmToken::Percent, StringRef(CurPtr, 1)); // Single %. while (isalnum(*CurPtr)) ++CurPtr; - return AsmToken(asmtok::Register, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::Register, StringRef(TokStart, CurPtr - TokStart)); } /// LexSlash: Slash: / @@ -119,7 +119,7 @@ AsmToken AsmLexer::LexSlash() { switch (*CurPtr) { case '*': break; // C style comment. case '/': return ++CurPtr, LexLineComment(); - default: return AsmToken(asmtok::Slash, StringRef(CurPtr, 1)); + default: return AsmToken(AsmToken::Slash, StringRef(CurPtr, 1)); } // C Style comment. @@ -149,8 +149,8 @@ AsmToken AsmLexer::LexLineComment() { CurChar = getNextChar(); if (CurChar == EOF) - return AsmToken(asmtok::Eof, StringRef(CurPtr, 0)); - return AsmToken(asmtok::EndOfStatement, StringRef(CurPtr, 0)); + return AsmToken(AsmToken::Eof, StringRef(CurPtr, 0)); + return AsmToken(AsmToken::EndOfStatement, StringRef(CurPtr, 0)); } @@ -172,7 +172,7 @@ AsmToken AsmLexer::LexDigit() { if (CurPtr[-1] != '0') { while (isdigit(*CurPtr)) ++CurPtr; - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(TokStart, 0, 10)); } @@ -185,7 +185,7 @@ AsmToken AsmLexer::LexDigit() { // Requires at least one binary digit. if (CurPtr == NumStart) return ReturnError(CurPtr-2, "Invalid binary number"); - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(NumStart, 0, 2)); } @@ -209,14 +209,14 @@ AsmToken AsmLexer::LexDigit() { if (errno == ERANGE) return ReturnError(CurPtr-2, "Hexadecimal number out of range"); } - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), (int64_t) strtoull(NumStart, 0, 16)); } // Must be an octal number, it starts with 0. while (*CurPtr >= '0' && *CurPtr <= '7') ++CurPtr; - return AsmToken(asmtok::IntVal, StringRef(TokStart, CurPtr - TokStart), + return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart), strtoll(TokStart, 0, 8)); } @@ -236,7 +236,7 @@ AsmToken AsmLexer::LexQuote() { CurChar = getNextChar(); } - return AsmToken(asmtok::String, StringRef(TokStart, CurPtr - TokStart)); + return AsmToken(AsmToken::String, StringRef(TokStart, CurPtr - TokStart)); } @@ -253,7 +253,7 @@ AsmToken AsmLexer::LexToken() { // Unknown character, emit an error. return ReturnError(TokStart, "invalid character in input"); - case EOF: return AsmToken(asmtok::Eof, StringRef(TokStart, 0)); + case EOF: return AsmToken(AsmToken::Eof, StringRef(TokStart, 0)); case 0: case ' ': case '\t': @@ -261,33 +261,33 @@ AsmToken AsmLexer::LexToken() { return LexToken(); case '\n': // FALL THROUGH. case '\r': // FALL THROUGH. - case ';': return AsmToken(asmtok::EndOfStatement, StringRef(TokStart, 1)); - case ':': return AsmToken(asmtok::Colon, StringRef(TokStart, 1)); - case '+': return AsmToken(asmtok::Plus, StringRef(TokStart, 1)); - case '-': return AsmToken(asmtok::Minus, StringRef(TokStart, 1)); - case '~': return AsmToken(asmtok::Tilde, StringRef(TokStart, 1)); - case '(': return AsmToken(asmtok::LParen, StringRef(TokStart, 1)); - case ')': return AsmToken(asmtok::RParen, StringRef(TokStart, 1)); - case '*': return AsmToken(asmtok::Star, StringRef(TokStart, 1)); - case ',': return AsmToken(asmtok::Comma, StringRef(TokStart, 1)); - case '$': return AsmToken(asmtok::Dollar, StringRef(TokStart, 1)); + case ';': return AsmToken(AsmToken::EndOfStatement, StringRef(TokStart, 1)); + case ':': return AsmToken(AsmToken::Colon, StringRef(TokStart, 1)); + case '+': return AsmToken(AsmToken::Plus, StringRef(TokStart, 1)); + case '-': return AsmToken(AsmToken::Minus, StringRef(TokStart, 1)); + case '~': return AsmToken(AsmToken::Tilde, StringRef(TokStart, 1)); + case '(': return AsmToken(AsmToken::LParen, StringRef(TokStart, 1)); + case ')': return AsmToken(AsmToken::RParen, StringRef(TokStart, 1)); + case '*': return AsmToken(AsmToken::Star, StringRef(TokStart, 1)); + case ',': return AsmToken(AsmToken::Comma, StringRef(TokStart, 1)); + case '$': return AsmToken(AsmToken::Dollar, StringRef(TokStart, 1)); case '=': if (*CurPtr == '=') - return ++CurPtr, AsmToken(asmtok::EqualEqual, StringRef(TokStart, 2)); - return AsmToken(asmtok::Equal, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::EqualEqual, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Equal, StringRef(TokStart, 1)); case '|': if (*CurPtr == '|') - return ++CurPtr, AsmToken(asmtok::PipePipe, StringRef(TokStart, 2)); - return AsmToken(asmtok::Pipe, StringRef(TokStart, 1)); - case '^': return AsmToken(asmtok::Caret, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::PipePipe, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Pipe, StringRef(TokStart, 1)); + case '^': return AsmToken(AsmToken::Caret, StringRef(TokStart, 1)); case '&': if (*CurPtr == '&') - return ++CurPtr, AsmToken(asmtok::AmpAmp, StringRef(TokStart, 2)); - return AsmToken(asmtok::Amp, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::AmpAmp, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Amp, StringRef(TokStart, 1)); case '!': if (*CurPtr == '=') - return ++CurPtr, AsmToken(asmtok::ExclaimEqual, StringRef(TokStart, 2)); - return AsmToken(asmtok::Exclaim, StringRef(TokStart, 1)); + return ++CurPtr, AsmToken(AsmToken::ExclaimEqual, StringRef(TokStart, 2)); + return AsmToken(AsmToken::Exclaim, StringRef(TokStart, 1)); case '%': return LexPercent(); case '/': return LexSlash(); case '#': return LexLineComment(); @@ -297,21 +297,21 @@ AsmToken AsmLexer::LexToken() { return LexDigit(); case '<': switch (*CurPtr) { - case '<': return ++CurPtr, AsmToken(asmtok::LessLess, + case '<': return ++CurPtr, AsmToken(AsmToken::LessLess, StringRef(TokStart, 2)); - case '=': return ++CurPtr, AsmToken(asmtok::LessEqual, + case '=': return ++CurPtr, AsmToken(AsmToken::LessEqual, StringRef(TokStart, 2)); - case '>': return ++CurPtr, AsmToken(asmtok::LessGreater, + case '>': return ++CurPtr, AsmToken(AsmToken::LessGreater, StringRef(TokStart, 2)); - default: return AsmToken(asmtok::Less, StringRef(TokStart, 1)); + default: return AsmToken(AsmToken::Less, StringRef(TokStart, 1)); } case '>': switch (*CurPtr) { - case '>': return ++CurPtr, AsmToken(asmtok::GreaterGreater, + case '>': return ++CurPtr, AsmToken(AsmToken::GreaterGreater, StringRef(TokStart, 2)); - case '=': return ++CurPtr, AsmToken(asmtok::GreaterEqual, + case '=': return ++CurPtr, AsmToken(AsmToken::GreaterEqual, StringRef(TokStart, 2)); - default: return AsmToken(asmtok::Greater, StringRef(TokStart, 1)); + default: return AsmToken(AsmToken::Greater, StringRef(TokStart, 1)); } // TODO: Quoted identifiers (objc methods etc) diff --git a/tools/llvm-mc/AsmLexer.h b/tools/llvm-mc/AsmLexer.h index e60fa201e5e..6146499e16c 100644 --- a/tools/llvm-mc/AsmLexer.h +++ b/tools/llvm-mc/AsmLexer.h @@ -25,8 +25,9 @@ class MemoryBuffer; class SourceMgr; class SMLoc; -namespace asmtok { - enum TokKind { +/// AsmToken - Target independent representation for an assembler token. +struct AsmToken { + enum TokenKind { // Markers Eof, Error, @@ -36,7 +37,7 @@ namespace asmtok { String, // Integer values. - IntVal, + Integer, // No-value. EndOfStatement, @@ -51,11 +52,8 @@ namespace asmtok { Less, LessEqual, LessLess, LessGreater, Greater, GreaterEqual, GreaterGreater }; -} -/// AsmToken - Target independent representation for an assembler token. -struct AsmToken { - asmtok::TokKind Kind; + TokenKind Kind; /// A reference to the entire token contents; this is always a pointer into /// a memory buffer owned by the source manager. @@ -65,19 +63,22 @@ struct AsmToken { public: AsmToken() {} - AsmToken(asmtok::TokKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) + AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0) : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} - asmtok::TokKind getKind() const { return Kind; } - bool is(asmtok::TokKind K) const { return Kind == K; } - bool isNot(asmtok::TokKind K) const { return Kind != K; } + TokenKind getKind() const { return Kind; } + bool is(TokenKind K) const { return Kind == K; } + bool isNot(TokenKind K) const { return Kind != K; } SMLoc getLoc() const; StringRef getString() const { return Str; } + // FIXME: Don't compute this in advance, it makes every token larger, and is + // also not generally what we want (it is nicer for recovery etc. to lex 123br + // as a single token, then diagnose as an invalid number). int64_t getIntVal() const { - assert(Kind == asmtok::IntVal && "This token isn't an integer"); + assert(Kind == Integer && "This token isn't an integer"); return IntVal; } }; @@ -104,13 +105,13 @@ public: AsmLexer(SourceMgr &SrcMgr); ~AsmLexer(); - asmtok::TokKind Lex() { + AsmToken::TokenKind Lex() { return CurTok = LexToken(), getKind(); } - asmtok::TokKind getKind() const { return CurTok.getKind(); } - bool is(asmtok::TokKind K) const { return CurTok.is(K); } - bool isNot(asmtok::TokKind K) const { return CurTok.isNot(K); } + AsmToken::TokenKind getKind() const { return CurTok.getKind(); } + bool is(AsmToken::TokenKind K) const { return CurTok.is(K); } + bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); } /// getCurStrVal - Get the string for the current token, this includes all /// characters (for example, the quotes on strings) in the token. @@ -125,6 +126,8 @@ public: } SMLoc getLoc() const; + + const AsmToken &getTok() const; /// EnterIncludeFile - Enter the specified file. This returns true on failure. bool EnterIncludeFile(const std::string &Filename); diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 65d48b23cbd..4af4bd232a0 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -45,7 +45,7 @@ bool AsmParser::Run() { bool HadError = false; // While we have input, parse each statement. - while (Lexer.isNot(asmtok::Eof)) { + while (Lexer.isNot(AsmToken::Eof)) { if (!ParseStatement()) continue; // If we had an error, remember it and recover by skipping to the next line. @@ -58,12 +58,12 @@ bool AsmParser::Run() { /// EatToEndOfStatement - Throw away the rest of the line for testing purposes. void AsmParser::EatToEndOfStatement() { - while (Lexer.isNot(asmtok::EndOfStatement) && - Lexer.isNot(asmtok::Eof)) + while (Lexer.isNot(AsmToken::EndOfStatement) && + Lexer.isNot(AsmToken::Eof)) Lexer.Lex(); // Eat EOL. - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) Lexer.Lex(); } @@ -75,7 +75,7 @@ void AsmParser::EatToEndOfStatement() { /// bool AsmParser::ParseParenExpr(AsmExpr *&Res) { if (ParseExpression(Res)) return true; - if (Lexer.isNot(asmtok::RParen)) + if (Lexer.isNot(AsmToken::RParen)) return TokError("expected ')' in parentheses expression"); Lexer.Lex(); return false; @@ -90,13 +90,13 @@ bool AsmParser::ParsePrimaryExpr(AsmExpr *&Res) { switch (Lexer.getKind()) { default: return TokError("unknown token in expression"); - case asmtok::Exclaim: + case AsmToken::Exclaim: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::LNot, Res); return false; - case asmtok::Identifier: { + case AsmToken::Identifier: { // This is a label, this should be parsed as part of an expression, to // handle things like LFOO+4. MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); @@ -109,26 +109,26 @@ bool AsmParser::ParsePrimaryExpr(AsmExpr *&Res) { Lexer.Lex(); // Eat identifier. return false; } - case asmtok::IntVal: + case AsmToken::Integer: Res = new AsmConstantExpr(Lexer.getCurIntVal()); Lexer.Lex(); // Eat identifier. return false; - case asmtok::LParen: + case AsmToken::LParen: Lexer.Lex(); // Eat the '('. return ParseParenExpr(Res); - case asmtok::Minus: + case AsmToken::Minus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::Minus, Res); return false; - case asmtok::Plus: + case AsmToken::Plus: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; Res = new AsmUnaryExpr(AsmUnaryExpr::Plus, Res); return false; - case asmtok::Tilde: + case AsmToken::Tilde: Lexer.Lex(); // Eat the operator. if (ParsePrimaryExpr(Res)) return true; @@ -189,73 +189,73 @@ bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { return false; } -static unsigned getBinOpPrecedence(asmtok::TokKind K, +static unsigned getBinOpPrecedence(AsmToken::TokenKind K, AsmBinaryExpr::Opcode &Kind) { switch (K) { default: return 0; // not a binop. // Lowest Precedence: &&, || - case asmtok::AmpAmp: + case AsmToken::AmpAmp: Kind = AsmBinaryExpr::LAnd; return 1; - case asmtok::PipePipe: + case AsmToken::PipePipe: Kind = AsmBinaryExpr::LOr; return 1; // Low Precedence: +, -, ==, !=, <>, <, <=, >, >= - case asmtok::Plus: + case AsmToken::Plus: Kind = AsmBinaryExpr::Add; return 2; - case asmtok::Minus: + case AsmToken::Minus: Kind = AsmBinaryExpr::Sub; return 2; - case asmtok::EqualEqual: + case AsmToken::EqualEqual: Kind = AsmBinaryExpr::EQ; return 2; - case asmtok::ExclaimEqual: - case asmtok::LessGreater: + case AsmToken::ExclaimEqual: + case AsmToken::LessGreater: Kind = AsmBinaryExpr::NE; return 2; - case asmtok::Less: + case AsmToken::Less: Kind = AsmBinaryExpr::LT; return 2; - case asmtok::LessEqual: + case AsmToken::LessEqual: Kind = AsmBinaryExpr::LTE; return 2; - case asmtok::Greater: + case AsmToken::Greater: Kind = AsmBinaryExpr::GT; return 2; - case asmtok::GreaterEqual: + case AsmToken::GreaterEqual: Kind = AsmBinaryExpr::GTE; return 2; // Intermediate Precedence: |, &, ^ // // FIXME: gas seems to support '!' as an infix operator? - case asmtok::Pipe: + case AsmToken::Pipe: Kind = AsmBinaryExpr::Or; return 3; - case asmtok::Caret: + case AsmToken::Caret: Kind = AsmBinaryExpr::Xor; return 3; - case asmtok::Amp: + case AsmToken::Amp: Kind = AsmBinaryExpr::And; return 3; // Highest Precedence: *, /, %, <<, >> - case asmtok::Star: + case AsmToken::Star: Kind = AsmBinaryExpr::Mul; return 4; - case asmtok::Slash: + case AsmToken::Slash: Kind = AsmBinaryExpr::Div; return 4; - case asmtok::Percent: + case AsmToken::Percent: Kind = AsmBinaryExpr::Mod; return 4; - case asmtok::LessLess: + case AsmToken::LessLess: Kind = AsmBinaryExpr::Shl; return 4; - case asmtok::GreaterGreater: + case AsmToken::GreaterGreater: Kind = AsmBinaryExpr::Shr; return 4; } @@ -304,10 +304,10 @@ bool AsmParser::ParseStatement() { switch (Lexer.getKind()) { default: return TokError("unexpected token at start of statement"); - case asmtok::EndOfStatement: + case AsmToken::EndOfStatement: Lexer.Lex(); return false; - case asmtok::Identifier: + case AsmToken::Identifier: break; // TODO: Recurse on local labels etc. } @@ -318,7 +318,7 @@ bool AsmParser::ParseStatement() { // Consume the identifier, see what is after it. switch (Lexer.Lex()) { - case asmtok::Colon: { + case AsmToken::Colon: { // identifier ':' -> Label. Lexer.Lex(); @@ -341,7 +341,7 @@ bool AsmParser::ParseStatement() { return ParseStatement(); } - case asmtok::Equal: + case AsmToken::Equal: // identifier '=' ... -> assignment statement Lexer.Lex(); @@ -554,7 +554,7 @@ bool AsmParser::ParseStatement() { getTargetParser().ParseInstruction(*this, IDVal, Inst)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in argument list"); // Eat the end of statement marker. @@ -575,7 +575,7 @@ bool AsmParser::ParseAssignment(const StringRef &Name, bool IsDotSet) { if (ParseRelocatableExpression(Value)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in assignment"); // Eat the end of statement marker. @@ -603,12 +603,12 @@ bool AsmParser::ParseAssignment(const StringRef &Name, bool IsDotSet) { /// ParseDirectiveSet: /// ::= .set identifier ',' expression bool AsmParser::ParseDirectiveSet() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.set' directive"); StringRef Name = Lexer.getCurStrVal(); - if (Lexer.Lex() != asmtok::Comma) + if (Lexer.Lex() != AsmToken::Comma) return TokError("unexpected token in '.set'"); Lexer.Lex(); @@ -620,24 +620,24 @@ bool AsmParser::ParseDirectiveSet() { /// FIXME: This should actually parse out the segment, section, attributes and /// sizeof_stub fields. bool AsmParser::ParseDirectiveDarwinSection() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier after '.section' directive"); std::string Section = Lexer.getCurStrVal(); Lexer.Lex(); // Accept a comma separated list of modifiers. - while (Lexer.is(asmtok::Comma)) { + while (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in '.section' directive"); Section += ','; Section += Lexer.getCurStrVal().str(); Lexer.Lex(); } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.section' directive"); Lexer.Lex(); @@ -647,7 +647,7 @@ bool AsmParser::ParseDirectiveDarwinSection() { bool AsmParser::ParseDirectiveSectionSwitch(const char *Section, const char *Directives) { - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in section switching directive"); Lexer.Lex(); @@ -664,9 +664,9 @@ bool AsmParser::ParseDirectiveSectionSwitch(const char *Section, /// ParseDirectiveAscii: /// ::= ( .ascii | .asciz ) [ "string" ( , "string" )* ] bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.ascii' or '.asciz' directive"); // FIXME: This shouldn't use a const char* + strlen, the string could have @@ -679,10 +679,10 @@ bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { Lexer.Lex(); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.ascii' or '.asciz' directive"); Lexer.Lex(); } @@ -695,7 +695,7 @@ bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { /// ParseDirectiveValue /// ::= (.byte | .short | ... ) [ expression (, expression)* ] bool AsmParser::ParseDirectiveValue(unsigned Size) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { MCValue Expr; if (ParseRelocatableExpression(Expr)) @@ -703,11 +703,11 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) { Out.EmitValue(Expr, Size); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; // FIXME: Improve diagnostic. - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); } @@ -726,8 +726,8 @@ bool AsmParser::ParseDirectiveSpace() { int64_t FillExpr = 0; bool HasFillExpr = false; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.space' directive"); Lexer.Lex(); @@ -736,7 +736,7 @@ bool AsmParser::ParseDirectiveSpace() { HasFillExpr = true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.space' directive"); } @@ -759,7 +759,7 @@ bool AsmParser::ParseDirectiveFill() { if (ParseAbsoluteExpression(NumValues)) return true; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -767,7 +767,7 @@ bool AsmParser::ParseDirectiveFill() { if (ParseAbsoluteExpression(FillSize)) return true; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -775,7 +775,7 @@ bool AsmParser::ParseDirectiveFill() { if (ParseAbsoluteExpression(FillExpr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.fill' directive"); Lexer.Lex(); @@ -798,15 +798,15 @@ bool AsmParser::ParseDirectiveOrg() { // Parse optional fill expression. int64_t FillExpr = 0; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.org' directive"); Lexer.Lex(); if (ParseAbsoluteExpression(FillExpr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.org' directive"); } @@ -830,22 +830,22 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { bool HasFillExpr = false; int64_t FillExpr = 0; int64_t MaxBytesToFill = 0; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); // The fill expression can be omitted while specifying a maximum number of // alignment bytes, e.g: // .align 3,,4 - if (Lexer.isNot(asmtok::Comma)) { + if (Lexer.isNot(AsmToken::Comma)) { HasFillExpr = true; if (ParseAbsoluteExpression(FillExpr)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -853,7 +853,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { if (ParseAbsoluteExpression(MaxBytesToFill)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in directive"); } } @@ -895,9 +895,9 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { /// ParseDirectiveSymbolAttribute /// ::= { ".globl", ".weak", ... } [ identifier ( , identifier )* ] bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); @@ -909,10 +909,10 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { Out.EmitSymbolAttribute(Sym, Attr); - if (Lexer.is(asmtok::EndOfStatement)) + if (Lexer.is(AsmToken::EndOfStatement)) break; - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); } @@ -925,7 +925,7 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { /// ParseDirectiveDarwinSymbolDesc /// ::= .desc identifier , expression bool AsmParser::ParseDirectiveDarwinSymbolDesc() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -933,7 +933,7 @@ bool AsmParser::ParseDirectiveDarwinSymbolDesc() { MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.desc' directive"); Lexer.Lex(); @@ -942,7 +942,7 @@ bool AsmParser::ParseDirectiveDarwinSymbolDesc() { if (ParseAbsoluteExpression(DescValue)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.desc' directive"); Lexer.Lex(); @@ -956,7 +956,7 @@ bool AsmParser::ParseDirectiveDarwinSymbolDesc() { /// ParseDirectiveComm /// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ] bool AsmParser::ParseDirectiveComm(bool IsLocal) { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -964,7 +964,7 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -975,14 +975,14 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { int64_t Pow2Alignment = 0; SMLoc Pow2AlignmentLoc; - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); Pow2AlignmentLoc = Lexer.getLoc(); if (ParseAbsoluteExpression(Pow2Alignment)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.comm' or '.lcomm' directive"); Lexer.Lex(); @@ -1014,17 +1014,17 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { /// ::= .zerofill segname , sectname [, identifier , size_expression [ /// , align_expression ]] bool AsmParser::ParseDirectiveDarwinZerofill() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected segment name after '.zerofill' directive"); std::string Section = Lexer.getCurStrVal(); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Section += ','; Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected section name after comma in '.zerofill' " "directive"); Section += Lexer.getCurStrVal().str(); @@ -1040,17 +1040,17 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { // If this is the end of the line all that was wanted was to create the // the section but with no symbol. - if (Lexer.is(asmtok::EndOfStatement)) { + if (Lexer.is(AsmToken::EndOfStatement)) { // Create the zerofill section but no symbol Out.EmitZerofill(Ctx.GetSection(Section.c_str())); return false; } - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -1058,7 +1058,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in directive"); Lexer.Lex(); @@ -1069,14 +1069,14 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { int64_t Pow2Alignment = 0; SMLoc Pow2AlignmentLoc; - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); Pow2AlignmentLoc = Lexer.getLoc(); if (ParseAbsoluteExpression(Pow2Alignment)) return true; } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.zerofill' directive"); Lexer.Lex(); @@ -1105,7 +1105,7 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { /// ParseDirectiveDarwinSubsectionsViaSymbols /// ::= .subsections_via_symbols bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() { - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.subsections_via_symbols' directive"); Lexer.Lex(); @@ -1122,8 +1122,8 @@ bool AsmParser::ParseDirectiveAbort() { SMLoc Loc = Lexer.getLoc(); StringRef Str = ""; - if (Lexer.isNot(asmtok::EndOfStatement)) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::EndOfStatement)) { + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.abort' directive"); Str = Lexer.getCurStrVal(); @@ -1131,7 +1131,7 @@ bool AsmParser::ParseDirectiveAbort() { Lexer.Lex(); } - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.abort' directive"); Lexer.Lex(); @@ -1148,7 +1148,7 @@ bool AsmParser::ParseDirectiveAbort() { /// ParseDirectiveLsym /// ::= .lsym identifier , expression bool AsmParser::ParseDirectiveDarwinLsym() { - if (Lexer.isNot(asmtok::Identifier)) + if (Lexer.isNot(AsmToken::Identifier)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -1156,7 +1156,7 @@ bool AsmParser::ParseDirectiveDarwinLsym() { MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); Lexer.Lex(); - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); @@ -1164,7 +1164,7 @@ bool AsmParser::ParseDirectiveDarwinLsym() { if (ParseRelocatableExpression(Expr)) return true; - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); @@ -1178,14 +1178,14 @@ bool AsmParser::ParseDirectiveDarwinLsym() { /// ParseDirectiveInclude /// ::= .include "filename" bool AsmParser::ParseDirectiveInclude() { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.include' directive"); std::string Filename = Lexer.getCurStrVal(); SMLoc IncludeLoc = Lexer.getLoc(); Lexer.Lex(); - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.include' directive"); // Strip the quotes. @@ -1206,14 +1206,14 @@ bool AsmParser::ParseDirectiveInclude() { /// ParseDirectiveDarwinDumpOrLoad /// ::= ( .dump | .load ) "filename" bool AsmParser::ParseDirectiveDarwinDumpOrLoad(SMLoc IDLoc, bool IsDump) { - if (Lexer.isNot(asmtok::String)) + if (Lexer.isNot(AsmToken::String)) return TokError("expected string in '.dump' or '.load' directive"); Lexer.getCurStrVal(); Lexer.Lex(); - if (Lexer.isNot(asmtok::EndOfStatement)) + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.dump' or '.load' directive"); Lexer.Lex(); diff --git a/tools/llvm-mc/MC-X86Specific.cpp b/tools/llvm-mc/MC-X86Specific.cpp index 6e28b028c3f..0dd711ffafb 100644 --- a/tools/llvm-mc/MC-X86Specific.cpp +++ b/tools/llvm-mc/MC-X86Specific.cpp @@ -81,7 +81,7 @@ struct AsmParser::X86Operand { }; bool AsmParser::ParseX86Register(X86Operand &Op) { - assert(Lexer.getKind() == asmtok::Register && "Invalid token kind!"); + assert(Lexer.getKind() == AsmToken::Register && "Invalid token kind!"); // FIXME: Decode register number. Op = X86Operand::CreateReg(123); @@ -94,11 +94,11 @@ bool AsmParser::ParseX86Operand(X86Operand &Op) { switch (Lexer.getKind()) { default: return ParseX86MemOperand(Op); - case asmtok::Register: + case AsmToken::Register: // FIXME: if a segment register, this could either be just the seg reg, or // the start of a memory operand. return ParseX86Register(Op); - case asmtok::Dollar: { + case AsmToken::Dollar: { // $42 -> immediate. Lexer.Lex(); MCValue Val; @@ -107,10 +107,10 @@ bool AsmParser::ParseX86Operand(X86Operand &Op) { Op = X86Operand::CreateImm(Val); return false; } - case asmtok::Star: { + case AsmToken::Star: { Lexer.Lex(); // Eat the star. - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; } else if (ParseX86MemOperand(Op)) @@ -132,12 +132,12 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { // only way to do this without lookahead is to eat the ( and see what is after // it. MCValue Disp = MCValue::get(0, 0, 0); - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { if (ParseRelocatableExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } @@ -149,7 +149,7 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { // so we have to eat the ( to see beyond it. Lexer.Lex(); // Eat the '('. - if (Lexer.is(asmtok::Register) || Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Register) || Lexer.is(AsmToken::Comma)) { // Nothing to do here, fall into the code below with the '(' part of the // memory operand consumed. } else { @@ -159,7 +159,7 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. - if (Lexer.isNot(asmtok::LParen)) { + if (Lexer.isNot(AsmToken::LParen)) { Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0); return false; } @@ -173,13 +173,13 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { // the rest of the memory operand. unsigned BaseReg = 0, IndexReg = 0, Scale = 0; - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; BaseReg = Op.getReg(); } - if (Lexer.is(asmtok::Comma)) { + if (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); // Eat the comma. // Following the comma we should have either an index register, or a scale @@ -188,20 +188,20 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { // // Not that even though it would be completely consistent to support syntax // like "1(%eax,,1)", the assembler doesn't. - if (Lexer.is(asmtok::Register)) { + if (Lexer.is(AsmToken::Register)) { if (ParseX86Register(Op)) return true; IndexReg = Op.getReg(); Scale = 1; // If not specified, the scale defaults to 1. - if (Lexer.isNot(asmtok::RParen)) { + if (Lexer.isNot(AsmToken::RParen)) { // Parse the scale amount: // ::= ',' [scale-expression] - if (Lexer.isNot(asmtok::Comma)) + if (Lexer.isNot(AsmToken::Comma)) return true; Lexer.Lex(); // Eat the comma. - if (Lexer.isNot(asmtok::RParen)) { + if (Lexer.isNot(AsmToken::RParen)) { int64_t ScaleVal; if (ParseAbsoluteExpression(ScaleVal)) return true; @@ -212,7 +212,7 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { Scale = (unsigned)ScaleVal; } } - } else if (Lexer.isNot(asmtok::RParen)) { + } else if (Lexer.isNot(AsmToken::RParen)) { // Otherwise we have the unsupported form of a scale amount without an // index. SMLoc Loc = Lexer.getLoc(); @@ -226,7 +226,7 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) { } // Ok, we've eaten the memory operand, verify we have a ')' and eat it too. - if (Lexer.isNot(asmtok::RParen)) + if (Lexer.isNot(AsmToken::RParen)) return TokError("unexpected token in memory operand"); Lexer.Lex(); // Eat the ')'. @@ -247,13 +247,13 @@ static bool MatchX86Inst(const StringRef &Name, bool AsmParser::ParseX86InstOperands(const StringRef &InstName, MCInst &Inst) { llvm::SmallVector Operands; - if (Lexer.isNot(asmtok::EndOfStatement)) { + if (Lexer.isNot(AsmToken::EndOfStatement)) { // Read the first operand. Operands.push_back(X86Operand()); if (ParseX86Operand(Operands.back())) return true; - while (Lexer.is(asmtok::Comma)) { + while (Lexer.is(AsmToken::Comma)) { Lexer.Lex(); // Eat the comma. // Parse and remember the operand. diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index dcbe47454af..783e928c4e8 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -83,58 +83,58 @@ static int AsLexInput(const char *ProgName) { bool Error = false; - asmtok::TokKind Tok = Lexer.Lex(); - while (Tok != asmtok::Eof) { + AsmToken::TokenKind Tok = Lexer.Lex(); + while (Tok != AsmToken::Eof) { switch (Tok) { default: Lexer.PrintMessage(Lexer.getLoc(), "unknown token", "warning"); Error = true; break; - case asmtok::Error: + case AsmToken::Error: Error = true; // error already printed. break; - case asmtok::Identifier: + case AsmToken::Identifier: outs() << "identifier: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::Register: + case AsmToken::Register: outs() << "register: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::String: + case AsmToken::String: outs() << "string: " << Lexer.getCurStrVal() << '\n'; break; - case asmtok::IntVal: + case AsmToken::Integer: outs() << "int: " << Lexer.getCurIntVal() << '\n'; break; - case asmtok::Amp: outs() << "Amp\n"; break; - case asmtok::AmpAmp: outs() << "AmpAmp\n"; break; - case asmtok::Caret: outs() << "Caret\n"; break; - case asmtok::Colon: outs() << "Colon\n"; break; - case asmtok::Comma: outs() << "Comma\n"; break; - case asmtok::Dollar: outs() << "Dollar\n"; break; - case asmtok::EndOfStatement: outs() << "EndOfStatement\n"; break; - case asmtok::Eof: outs() << "Eof\n"; break; - case asmtok::Equal: outs() << "Equal\n"; break; - case asmtok::EqualEqual: outs() << "EqualEqual\n"; break; - case asmtok::Exclaim: outs() << "Exclaim\n"; break; - case asmtok::ExclaimEqual: outs() << "ExclaimEqual\n"; break; - case asmtok::Greater: outs() << "Greater\n"; break; - case asmtok::GreaterEqual: outs() << "GreaterEqual\n"; break; - case asmtok::GreaterGreater: outs() << "GreaterGreater\n"; break; - case asmtok::LParen: outs() << "LParen\n"; break; - case asmtok::Less: outs() << "Less\n"; break; - case asmtok::LessEqual: outs() << "LessEqual\n"; break; - case asmtok::LessGreater: outs() << "LessGreater\n"; break; - case asmtok::LessLess: outs() << "LessLess\n"; break; - case asmtok::Minus: outs() << "Minus\n"; break; - case asmtok::Percent: outs() << "Percent\n"; break; - case asmtok::Pipe: outs() << "Pipe\n"; break; - case asmtok::PipePipe: outs() << "PipePipe\n"; break; - case asmtok::Plus: outs() << "Plus\n"; break; - case asmtok::RParen: outs() << "RParen\n"; break; - case asmtok::Slash: outs() << "Slash\n"; break; - case asmtok::Star: outs() << "Star\n"; break; - case asmtok::Tilde: outs() << "Tilde\n"; break; + case AsmToken::Amp: outs() << "Amp\n"; break; + case AsmToken::AmpAmp: outs() << "AmpAmp\n"; break; + case AsmToken::Caret: outs() << "Caret\n"; break; + case AsmToken::Colon: outs() << "Colon\n"; break; + case AsmToken::Comma: outs() << "Comma\n"; break; + case AsmToken::Dollar: outs() << "Dollar\n"; break; + case AsmToken::EndOfStatement: outs() << "EndOfStatement\n"; break; + case AsmToken::Eof: outs() << "Eof\n"; break; + case AsmToken::Equal: outs() << "Equal\n"; break; + case AsmToken::EqualEqual: outs() << "EqualEqual\n"; break; + case AsmToken::Exclaim: outs() << "Exclaim\n"; break; + case AsmToken::ExclaimEqual: outs() << "ExclaimEqual\n"; break; + case AsmToken::Greater: outs() << "Greater\n"; break; + case AsmToken::GreaterEqual: outs() << "GreaterEqual\n"; break; + case AsmToken::GreaterGreater: outs() << "GreaterGreater\n"; break; + case AsmToken::LParen: outs() << "LParen\n"; break; + case AsmToken::Less: outs() << "Less\n"; break; + case AsmToken::LessEqual: outs() << "LessEqual\n"; break; + case AsmToken::LessGreater: outs() << "LessGreater\n"; break; + case AsmToken::LessLess: outs() << "LessLess\n"; break; + case AsmToken::Minus: outs() << "Minus\n"; break; + case AsmToken::Percent: outs() << "Percent\n"; break; + case AsmToken::Pipe: outs() << "Pipe\n"; break; + case AsmToken::PipePipe: outs() << "PipePipe\n"; break; + case AsmToken::Plus: outs() << "Plus\n"; break; + case AsmToken::RParen: outs() << "RParen\n"; break; + case AsmToken::Slash: outs() << "Slash\n"; break; + case AsmToken::Star: outs() << "Star\n"; break; + case AsmToken::Tilde: outs() << "Tilde\n"; break; } Tok = Lexer.Lex();