2010-01-23 02:43:15 +00:00
|
|
|
//===-- X86AsmLexer.cpp - Tokenize X86 assembly to AsmTokens --------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetAsmLexer.h"
|
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2010-01-25 21:59:20 +00:00
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2010-01-23 02:43:15 +00:00
|
|
|
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
|
|
|
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
|
|
|
|
#include "X86.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class X86AsmLexer : public TargetAsmLexer {
|
|
|
|
const MCAsmInfo &AsmInfo;
|
2010-01-25 21:59:20 +00:00
|
|
|
|
|
|
|
AsmToken LexTokenATT();
|
|
|
|
AsmToken LexTokenIntel();
|
2010-01-23 02:43:15 +00:00
|
|
|
protected:
|
2010-01-25 21:59:20 +00:00
|
|
|
AsmToken LexToken() {
|
|
|
|
switch (AsmInfo.getAssemblerDialect()) {
|
|
|
|
default:
|
|
|
|
SetError(SMLoc(), "Unhandled dialect");
|
|
|
|
return AsmToken(AsmToken::Error, "", 0);
|
|
|
|
case 0:
|
|
|
|
return LexTokenATT();
|
|
|
|
case 1:
|
|
|
|
return LexTokenIntel();
|
|
|
|
}
|
|
|
|
}
|
2010-01-23 02:43:15 +00:00
|
|
|
public:
|
|
|
|
X86AsmLexer(const Target &T, const MCAsmInfo &MAI)
|
|
|
|
: TargetAsmLexer(T), AsmInfo(MAI) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-25 21:59:20 +00:00
|
|
|
AsmToken X86AsmLexer::LexTokenATT() {
|
|
|
|
return AsmToken(AsmToken::Error, "", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
AsmToken X86AsmLexer::LexTokenIntel() {
|
2010-01-23 02:43:15 +00:00
|
|
|
return AsmToken(AsmToken::Error, "", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void LLVMInitializeX86AsmLexer() {
|
|
|
|
RegisterAsmLexer<X86AsmLexer> X(TheX86_32Target);
|
|
|
|
RegisterAsmLexer<X86AsmLexer> Y(TheX86_64Target);
|
|
|
|
}
|
|
|
|
|
|
|
|
//#define REGISTERS_ONLY
|
|
|
|
//#include "../X86GenAsmMatcher.inc"
|
|
|
|
//#undef REGISTERS_ONLY
|