Added the implementation of the Intel-specific

TargetAsmLexer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94482 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sean Callanan 2010-01-26 01:00:10 +00:00
parent 5ed17ae92a
commit 7dcef4c475

View File

@ -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::LexTokenATT() {
}
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() {