From 4dbe558a1033ce66d97f2e6def5b91d39a0bcd1e Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Mon, 25 Jan 2010 21:59:20 +0000 Subject: [PATCH] Implemented the dialect decision logic for the X86 TargetAsmLexer. Dialect-specific lexing code will be placed in the functions LexTokenATT() and LexTokenIntel(). llvm-svn: 94456 --- lib/Target/X86/AsmParser/X86AsmLexer.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/Target/X86/AsmParser/X86AsmLexer.cpp b/lib/Target/X86/AsmParser/X86AsmLexer.cpp index 1a62044a60e..123735cace3 100644 --- a/lib/Target/X86/AsmParser/X86AsmLexer.cpp +++ b/lib/Target/X86/AsmParser/X86AsmLexer.cpp @@ -9,6 +9,7 @@ #include "llvm/Target/TargetAsmLexer.h" #include "llvm/Target/TargetRegistry.h" +#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" #include "X86.h" @@ -19,8 +20,21 @@ namespace { class X86AsmLexer : public TargetAsmLexer { const MCAsmInfo &AsmInfo; + + AsmToken LexTokenATT(); + AsmToken LexTokenIntel(); protected: - AsmToken LexToken(); + AsmToken LexToken() { + switch (AsmInfo.getAssemblerDialect()) { + default: + SetError(SMLoc(), "Unhandled dialect"); + return AsmToken(AsmToken::Error, "", 0); + case 0: + return LexTokenATT(); + case 1: + return LexTokenIntel(); + } + } public: X86AsmLexer(const Target &T, const MCAsmInfo &MAI) : TargetAsmLexer(T), AsmInfo(MAI) { @@ -29,7 +43,11 @@ public: } -AsmToken X86AsmLexer::LexToken() { +AsmToken X86AsmLexer::LexTokenATT() { + return AsmToken(AsmToken::Error, "", 0); +} + +AsmToken X86AsmLexer::LexTokenIntel() { return AsmToken(AsmToken::Error, "", 0); }