[llvm-commits] [llvm] r94482 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
Sean Callanan
scallanan at apple.com
Mon Jan 25 17:00:10 PST 2010
Author: spyffe
Date: Mon Jan 25 19:00:10 2010
New Revision: 94482
URL: http://llvm.org/viewvc/llvm-project?rev=94482&view=rev
Log:
Added the implementation of the Intel-specific
TargetAsmLexer.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=94482&r1=94481&r2=94482&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp Mon Jan 25 19:00:10 2010
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/Target/TargetAsmLexer.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/MC/MCAsmInfo.h"
@@ -113,7 +114,32 @@
}
AsmToken X86AsmLexer::LexTokenIntel() {
- return AsmToken(AsmToken::Error, "", 0);
+ const AsmToken &lexedToken = lexDefinite();
+
+ switch(lexedToken.getKind()) {
+ default:
+ return AsmToken(lexedToken);
+ case AsmToken::Error:
+ SetError(Lexer->getErrLoc(), Lexer->getErr());
+ return AsmToken(lexedToken);
+ case AsmToken::Identifier:
+ {
+ std::string upperCase = lexedToken.getString().str();
+ std::string lowerCase = LowercaseString(upperCase);
+ StringRef lowerRef(lowerCase);
+
+ unsigned regID = MatchRegisterName(lowerRef);
+
+ if (regID) {
+ return AsmToken(AsmToken::Register,
+ lexedToken.getString(),
+ static_cast<int64_t>(regID));
+ }
+ else {
+ return AsmToken(lexedToken);
+ }
+ }
+ }
}
extern "C" void LLVMInitializeX86AsmLexer() {
More information about the llvm-commits
mailing list