[llvm-commits] [llvm] r170699 - in /llvm/trunk: include/llvm/MC/ include/llvm/MC/MCParser/ include/llvm/Support/ lib/MC/ lib/Target/ARM/AsmParser/ lib/Target/MBlaze/AsmParser/ lib/Target/X86/AsmParser/ tools/llvm-mc/
Jim Grosbach
grosbach at apple.com
Thu Dec 20 13:06:33 PST 2012
Woot! Thanks, Roman.
-Jim
On Dec 20, 2012, at 6:43 AM, Roman Divacky <rdivacky at freebsd.org> wrote:
> Author: rdivacky
> Date: Thu Dec 20 08:43:30 2012
> New Revision: 170699
>
> URL: http://llvm.org/viewvc/llvm-project?rev=170699&view=rev
> Log:
> Remove MCTargetAsmLexer and its derived classes now that edis,
> its only user, is gone.
>
> Removed:
> llvm/trunk/include/llvm/MC/MCTargetAsmLexer.h
> llvm/trunk/lib/MC/MCTargetAsmLexer.cpp
> llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
> llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp
> llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
> Modified:
> llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h
> llvm/trunk/include/llvm/Support/TargetRegistry.h
> llvm/trunk/lib/MC/CMakeLists.txt
> llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt
> llvm/trunk/lib/Target/MBlaze/AsmParser/CMakeLists.txt
> llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp
> llvm/trunk/lib/Target/X86/AsmParser/CMakeLists.txt
> llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
> llvm/trunk/tools/llvm-mc/llvm-mc.cpp
>
> Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h Thu Dec 20 08:43:30 2012
> @@ -34,9 +34,6 @@
> // Real values.
> Real,
>
> - // Register values (stored in IntVal). Only used by MCTargetAsmLexer.
> - Register,
> -
> // No-value.
> EndOfStatement,
> Colon,
> @@ -104,13 +101,6 @@
> assert(Kind == Integer && "This token isn't an integer!");
> return IntVal;
> }
> -
> - /// getRegVal - Get the register number for the current token, which should
> - /// be a register.
> - unsigned getRegVal() const {
> - assert(Kind == Register && "This token isn't a register!");
> - return static_cast<unsigned>(IntVal);
> - }
> };
>
> /// MCAsmLexer - Generic assembler lexer interface, for use by target specific
>
> Removed: llvm/trunk/include/llvm/MC/MCTargetAsmLexer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCTargetAsmLexer.h?rev=170698&view=auto
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCTargetAsmLexer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCTargetAsmLexer.h (removed)
> @@ -1,89 +0,0 @@
> -//===-- llvm/MC/MCTargetAsmLexer.h - Target Assembly Lexer ------*- C++ -*-===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#ifndef LLVM_MC_MCTARGETASMLEXER_H
> -#define LLVM_MC_MCTARGETASMLEXER_H
> -
> -#include "llvm/MC/MCParser/MCAsmLexer.h"
> -
> -namespace llvm {
> -class Target;
> -
> -/// MCTargetAsmLexer - Generic interface to target specific assembly lexers.
> -class MCTargetAsmLexer {
> - /// The current token
> - AsmToken CurTok;
> -
> - /// The location and description of the current error
> - SMLoc ErrLoc;
> - std::string Err;
> -
> - MCTargetAsmLexer(const MCTargetAsmLexer &) LLVM_DELETED_FUNCTION;
> - void operator=(const MCTargetAsmLexer &) LLVM_DELETED_FUNCTION;
> -protected: // Can only create subclasses.
> - MCTargetAsmLexer(const Target &);
> -
> - virtual AsmToken LexToken() = 0;
> -
> - void SetError(const SMLoc &errLoc, const std::string &err) {
> - ErrLoc = errLoc;
> - Err = err;
> - }
> -
> - /// TheTarget - The Target that this machine was created for.
> - const Target &TheTarget;
> - MCAsmLexer *Lexer;
> -
> -public:
> - virtual ~MCTargetAsmLexer();
> -
> - const Target &getTarget() const { return TheTarget; }
> -
> - /// InstallLexer - Set the lexer to get tokens from lower-level lexer \p L.
> - void InstallLexer(MCAsmLexer &L) {
> - Lexer = &L;
> - }
> -
> - MCAsmLexer *getLexer() {
> - return Lexer;
> - }
> -
> - /// Lex - Consume the next token from the input stream and return it.
> - const AsmToken &Lex() {
> - return CurTok = LexToken();
> - }
> -
> - /// getTok - Get the current (last) lexed token.
> - const AsmToken &getTok() {
> - return CurTok;
> - }
> -
> - /// getErrLoc - Get the current error location
> - const SMLoc &getErrLoc() {
> - return ErrLoc;
> - }
> -
> - /// getErr - Get the current error string
> - const std::string &getErr() {
> - return Err;
> - }
> -
> - /// getKind - Get the kind of current token.
> - AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
> -
> - /// is - Check if the current token has kind \p K.
> - bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
> -
> - /// isNot - Check if the current token has kind \p K.
> - bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
> -};
> -
> -} // End llvm namespace
> -
> -#endif
>
> Modified: llvm/trunk/include/llvm/Support/TargetRegistry.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetRegistry.h?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/TargetRegistry.h (original)
> +++ llvm/trunk/include/llvm/Support/TargetRegistry.h Thu Dec 20 08:43:30 2012
> @@ -41,7 +41,6 @@
> class MCRegisterInfo;
> class MCStreamer;
> class MCSubtargetInfo;
> - class MCTargetAsmLexer;
> class MCTargetAsmParser;
> class TargetMachine;
> class TargetOptions;
> @@ -96,9 +95,6 @@
> typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T,
> StringRef TT,
> StringRef CPU);
> - typedef MCTargetAsmLexer *(*MCAsmLexerCtorTy)(const Target &T,
> - const MCRegisterInfo &MRI,
> - const MCAsmInfo &MAI);
> typedef MCTargetAsmParser *(*MCAsmParserCtorTy)(MCSubtargetInfo &STI,
> MCAsmParser &P);
> typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T,
> @@ -182,10 +178,6 @@
> /// MCAsmBackend, if registered.
> MCAsmBackendCtorTy MCAsmBackendCtorFn;
>
> - /// MCAsmLexerCtorFn - Construction function for this target's
> - /// MCTargetAsmLexer, if registered.
> - MCAsmLexerCtorTy MCAsmLexerCtorFn;
> -
> /// MCAsmParserCtorFn - Construction function for this target's
> /// MCTargetAsmParser, if registered.
> MCAsmParserCtorTy MCAsmParserCtorFn;
> @@ -242,9 +234,6 @@
> /// hasMCAsmBackend - Check if this target supports .o generation.
> bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != 0; }
>
> - /// hasMCAsmLexer - Check if this target supports .s lexing.
> - bool hasMCAsmLexer() const { return MCAsmLexerCtorFn != 0; }
> -
> /// hasAsmParser - Check if this target supports .s parsing.
> bool hasMCAsmParser() const { return MCAsmParserCtorFn != 0; }
>
> @@ -360,15 +349,6 @@
> return MCAsmBackendCtorFn(*this, Triple, CPU);
> }
>
> - /// createMCAsmLexer - Create a target specific assembly lexer.
> - ///
> - MCTargetAsmLexer *createMCAsmLexer(const MCRegisterInfo &MRI,
> - const MCAsmInfo &MAI) const {
> - if (!MCAsmLexerCtorFn)
> - return 0;
> - return MCAsmLexerCtorFn(*this, MRI, MAI);
> - }
> -
> /// createMCAsmParser - Create a target specific assembly parser.
> ///
> /// \param Parser The target independent parser implementation to use for
> @@ -676,20 +656,6 @@
> T.MCAsmBackendCtorFn = Fn;
> }
>
> - /// RegisterMCAsmLexer - Register a MCTargetAsmLexer implementation for the
> - /// given target.
> - ///
> - /// Clients are responsible for ensuring that registration doesn't occur
> - /// while another thread is attempting to access the registry. Typically
> - /// this is done by initializing all targets at program startup.
> - ///
> - /// @param T - The target being registered.
> - /// @param Fn - A function to construct an MCAsmLexer for the target.
> - static void RegisterMCAsmLexer(Target &T, Target::MCAsmLexerCtorTy Fn) {
> - if (!T.MCAsmLexerCtorFn)
> - T.MCAsmLexerCtorFn = Fn;
> - }
> -
> /// RegisterMCAsmParser - Register a MCTargetAsmParser implementation for
> /// the given target.
> ///
> @@ -1070,28 +1036,6 @@
> }
> };
>
> - /// RegisterMCAsmLexer - Helper template for registering a target specific
> - /// assembly lexer, for use in the target machine initialization
> - /// function. Usage:
> - ///
> - /// extern "C" void LLVMInitializeFooMCAsmLexer() {
> - /// extern Target TheFooTarget;
> - /// RegisterMCAsmLexer<FooMCAsmLexer> X(TheFooTarget);
> - /// }
> - template<class MCAsmLexerImpl>
> - struct RegisterMCAsmLexer {
> - RegisterMCAsmLexer(Target &T) {
> - TargetRegistry::RegisterMCAsmLexer(T, &Allocator);
> - }
> -
> - private:
> - static MCTargetAsmLexer *Allocator(const Target &T,
> - const MCRegisterInfo &MRI,
> - const MCAsmInfo &MAI) {
> - return new MCAsmLexerImpl(T, MRI, MAI);
> - }
> - };
> -
> /// RegisterMCAsmParser - Helper template for registering a target specific
> /// assembly parser, for use in the target machine initialization
> /// function. Usage:
>
> Modified: llvm/trunk/lib/MC/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/CMakeLists.txt?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/CMakeLists.txt (original)
> +++ llvm/trunk/lib/MC/CMakeLists.txt Thu Dec 20 08:43:30 2012
> @@ -36,7 +36,6 @@
> MCStreamer.cpp
> MCSubtargetInfo.cpp
> MCSymbol.cpp
> - MCTargetAsmLexer.cpp
> MCValue.cpp
> MCWin64EH.cpp
> MachObjectWriter.cpp
>
> Removed: llvm/trunk/lib/MC/MCTargetAsmLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCTargetAsmLexer.cpp?rev=170698&view=auto
> ==============================================================================
> --- llvm/trunk/lib/MC/MCTargetAsmLexer.cpp (original)
> +++ llvm/trunk/lib/MC/MCTargetAsmLexer.cpp (removed)
> @@ -1,16 +0,0 @@
> -//===-- llvm/MC/MCTargetAsmLexer.cpp - Target Assembly Lexer --------------===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#include "llvm/MC/MCTargetAsmLexer.h"
> -using namespace llvm;
> -
> -MCTargetAsmLexer::MCTargetAsmLexer(const Target &T)
> - : TheTarget(T), Lexer(NULL) {
> -}
> -MCTargetAsmLexer::~MCTargetAsmLexer() {}
>
> Removed: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp?rev=170698&view=auto
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmLexer.cpp (removed)
> @@ -1,134 +0,0 @@
> -//===-- ARMAsmLexer.cpp - Tokenize ARM 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 "MCTargetDesc/ARMBaseInfo.h"
> -#include "llvm/ADT/StringSwitch.h"
> -#include "llvm/MC/MCAsmInfo.h"
> -#include "llvm/MC/MCParser/MCAsmLexer.h"
> -#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
> -#include "llvm/MC/MCRegisterInfo.h"
> -#include "llvm/MC/MCTargetAsmLexer.h"
> -#include "llvm/Support/TargetRegistry.h"
> -#include <map>
> -#include <string>
> -
> -using namespace llvm;
> -
> -namespace {
> -
> -class ARMBaseAsmLexer : public MCTargetAsmLexer {
> - const MCAsmInfo &AsmInfo;
> -
> - const AsmToken &lexDefinite() {
> - return getLexer()->Lex();
> - }
> -
> - AsmToken LexTokenUAL();
> -protected:
> - typedef std::map <std::string, unsigned> rmap_ty;
> -
> - rmap_ty RegisterMap;
> -
> - void InitRegisterMap(const MCRegisterInfo *info) {
> - unsigned numRegs = info->getNumRegs();
> -
> - for (unsigned i = 0; i < numRegs; ++i) {
> - const char *regName = info->getName(i);
> - if (regName)
> - RegisterMap[regName] = i;
> - }
> - }
> -
> - unsigned MatchRegisterName(StringRef Name) {
> - rmap_ty::iterator iter = RegisterMap.find(Name.str());
> - if (iter != RegisterMap.end())
> - return iter->second;
> - else
> - return 0;
> - }
> -
> - AsmToken LexToken() {
> - if (!Lexer) {
> - SetError(SMLoc(), "No MCAsmLexer installed");
> - return AsmToken(AsmToken::Error, "", 0);
> - }
> -
> - switch (AsmInfo.getAssemblerDialect()) {
> - default:
> - SetError(SMLoc(), "Unhandled dialect");
> - return AsmToken(AsmToken::Error, "", 0);
> - case 0:
> - return LexTokenUAL();
> - }
> - }
> -public:
> - ARMBaseAsmLexer(const Target &T, const MCAsmInfo &MAI)
> - : MCTargetAsmLexer(T), AsmInfo(MAI) {
> - }
> -};
> -
> -class ARMAsmLexer : public ARMBaseAsmLexer {
> -public:
> - ARMAsmLexer(const Target &T, const MCRegisterInfo &MRI, const MCAsmInfo &MAI)
> - : ARMBaseAsmLexer(T, MAI) {
> - InitRegisterMap(&MRI);
> - }
> -};
> -
> -class ThumbAsmLexer : public ARMBaseAsmLexer {
> -public:
> - ThumbAsmLexer(const Target &T, const MCRegisterInfo &MRI,const MCAsmInfo &MAI)
> - : ARMBaseAsmLexer(T, MAI) {
> - InitRegisterMap(&MRI);
> - }
> -};
> -
> -} // end anonymous namespace
> -
> -AsmToken ARMBaseAsmLexer::LexTokenUAL() {
> - const AsmToken &lexedToken = lexDefinite();
> -
> - switch (lexedToken.getKind()) {
> - default: break;
> - case AsmToken::Error:
> - SetError(Lexer->getErrLoc(), Lexer->getErr());
> - break;
> - case AsmToken::Identifier: {
> - std::string lowerCase = lexedToken.getString().lower();
> -
> - unsigned regID = MatchRegisterName(lowerCase);
> - // Check for register aliases.
> - // r13 -> sp
> - // r14 -> lr
> - // r15 -> pc
> - // ip -> r12
> - // FIXME: Some assemblers support lots of others. Do we want them all?
> - if (!regID) {
> - regID = StringSwitch<unsigned>(lowerCase)
> - .Case("r13", ARM::SP)
> - .Case("r14", ARM::LR)
> - .Case("r15", ARM::PC)
> - .Case("ip", ARM::R12)
> - .Default(0);
> - }
> -
> - if (regID)
> - return AsmToken(AsmToken::Register,
> - lexedToken.getString(),
> - static_cast<int64_t>(regID));
> - }
> - }
> -
> - return AsmToken(lexedToken);
> -}
> -
> -extern "C" void LLVMInitializeARMAsmLexer() {
> - RegisterMCAsmLexer<ARMAsmLexer> X(TheARMTarget);
> - RegisterMCAsmLexer<ThumbAsmLexer> Y(TheThumbTarget);
> -}
>
> Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Dec 20 08:43:30 2012
> @@ -7829,13 +7829,10 @@
> return true;
> }
>
> -extern "C" void LLVMInitializeARMAsmLexer();
> -
> /// Force static initialization.
> extern "C" void LLVMInitializeARMAsmParser() {
> RegisterMCAsmParser<ARMAsmParser> X(TheARMTarget);
> RegisterMCAsmParser<ARMAsmParser> Y(TheThumbTarget);
> - LLVMInitializeARMAsmLexer();
> }
>
> #define GET_REGISTER_MATCHER
>
> Modified: llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt (original)
> +++ llvm/trunk/lib/Target/ARM/AsmParser/CMakeLists.txt Thu Dec 20 08:43:30 2012
> @@ -1,7 +1,6 @@
> include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
>
> add_llvm_library(LLVMARMAsmParser
> - ARMAsmLexer.cpp
> ARMAsmParser.cpp
> )
>
>
> Modified: llvm/trunk/lib/Target/MBlaze/AsmParser/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/AsmParser/CMakeLists.txt?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/MBlaze/AsmParser/CMakeLists.txt (original)
> +++ llvm/trunk/lib/Target/MBlaze/AsmParser/CMakeLists.txt Thu Dec 20 08:43:30 2012
> @@ -2,7 +2,6 @@
> ${CMAKE_CURRENT_SOURCE_DIR}/.. )
>
> add_llvm_library(LLVMMBlazeAsmParser
> - MBlazeAsmLexer.cpp
> MBlazeAsmParser.cpp
> )
>
>
> Removed: llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp?rev=170698&view=auto
> ==============================================================================
> --- llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp (original)
> +++ llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp (removed)
> @@ -1,112 +0,0 @@
> -//===-- MBlazeAsmLexer.cpp - Tokenize MBlaze 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 "MCTargetDesc/MBlazeBaseInfo.h"
> -#include "llvm/MC/MCAsmInfo.h"
> -#include "llvm/MC/MCParser/MCAsmLexer.h"
> -#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
> -#include "llvm/MC/MCRegisterInfo.h"
> -#include "llvm/MC/MCTargetAsmLexer.h"
> -#include "llvm/Support/TargetRegistry.h"
> -#include <map>
> -#include <string>
> -
> -using namespace llvm;
> -
> -namespace {
> -
> - class MBlazeBaseAsmLexer : public MCTargetAsmLexer {
> - const MCAsmInfo &AsmInfo;
> -
> - const AsmToken &lexDefinite() {
> - return getLexer()->Lex();
> - }
> -
> - AsmToken LexTokenUAL();
> - protected:
> - typedef std::map <std::string, unsigned> rmap_ty;
> -
> - rmap_ty RegisterMap;
> -
> - void InitRegisterMap(const MCRegisterInfo *info) {
> - unsigned numRegs = info->getNumRegs();
> -
> - for (unsigned i = 0; i < numRegs; ++i) {
> - const char *regName = info->getName(i);
> - if (regName)
> - RegisterMap[regName] = i;
> - }
> - }
> -
> - unsigned MatchRegisterName(StringRef Name) {
> - rmap_ty::iterator iter = RegisterMap.find(Name.str());
> - if (iter != RegisterMap.end())
> - return iter->second;
> - else
> - return 0;
> - }
> -
> - AsmToken LexToken() {
> - if (!Lexer) {
> - SetError(SMLoc(), "No MCAsmLexer installed");
> - return AsmToken(AsmToken::Error, "", 0);
> - }
> -
> - switch (AsmInfo.getAssemblerDialect()) {
> - default:
> - SetError(SMLoc(), "Unhandled dialect");
> - return AsmToken(AsmToken::Error, "", 0);
> - case 0:
> - return LexTokenUAL();
> - }
> - }
> - public:
> - MBlazeBaseAsmLexer(const Target &T, const MCAsmInfo &MAI)
> - : MCTargetAsmLexer(T), AsmInfo(MAI) {
> - }
> - };
> -
> - class MBlazeAsmLexer : public MBlazeBaseAsmLexer {
> - public:
> - MBlazeAsmLexer(const Target &T, const MCRegisterInfo &MRI,
> - const MCAsmInfo &MAI)
> - : MBlazeBaseAsmLexer(T, MAI) {
> - InitRegisterMap(&MRI);
> - }
> - };
> -}
> -
> -AsmToken MBlazeBaseAsmLexer::LexTokenUAL() {
> - 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:
> - {
> - unsigned regID = MatchRegisterName(lexedToken.getString().lower());
> -
> - if (regID) {
> - return AsmToken(AsmToken::Register,
> - lexedToken.getString(),
> - static_cast<int64_t>(regID));
> - } else {
> - return AsmToken(lexedToken);
> - }
> - }
> - }
> -}
> -
> -extern "C" void LLVMInitializeMBlazeAsmLexer() {
> - RegisterMCAsmLexer<MBlazeAsmLexer> X(TheMBlazeTarget);
> -}
> -
>
> Modified: llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp Thu Dec 20 08:43:30 2012
> @@ -548,12 +548,9 @@
> return false;
> }
>
> -extern "C" void LLVMInitializeMBlazeAsmLexer();
> -
> /// Force static initialization.
> extern "C" void LLVMInitializeMBlazeAsmParser() {
> RegisterMCAsmParser<MBlazeAsmParser> X(TheMBlazeTarget);
> - LLVMInitializeMBlazeAsmLexer();
> }
>
> #define GET_REGISTER_MATCHER
>
> Modified: llvm/trunk/lib/Target/X86/AsmParser/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/CMakeLists.txt?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/AsmParser/CMakeLists.txt (original)
> +++ llvm/trunk/lib/Target/X86/AsmParser/CMakeLists.txt Thu Dec 20 08:43:30 2012
> @@ -1,7 +1,6 @@
> include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
>
> add_llvm_library(LLVMX86AsmParser
> - X86AsmLexer.cpp
> X86AsmParser.cpp
> )
>
>
> Removed: llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp?rev=170698&view=auto
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (original)
> +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmLexer.cpp (removed)
> @@ -1,159 +0,0 @@
> -//===-- 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 "MCTargetDesc/X86BaseInfo.h"
> -#include "llvm/ADT/SmallVector.h"
> -#include "llvm/MC/MCAsmInfo.h"
> -#include "llvm/MC/MCParser/MCAsmLexer.h"
> -#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
> -#include "llvm/MC/MCTargetAsmLexer.h"
> -#include "llvm/Support/TargetRegistry.h"
> -
> -using namespace llvm;
> -
> -namespace {
> -
> -class X86AsmLexer : public MCTargetAsmLexer {
> - const MCAsmInfo &AsmInfo;
> -
> - bool tentativeIsValid;
> - AsmToken tentativeToken;
> -
> - const AsmToken &lexTentative() {
> - tentativeToken = getLexer()->Lex();
> - tentativeIsValid = true;
> - return tentativeToken;
> - }
> -
> - const AsmToken &lexDefinite() {
> - if (tentativeIsValid) {
> - tentativeIsValid = false;
> - return tentativeToken;
> - }
> - return getLexer()->Lex();
> - }
> -
> - AsmToken LexTokenATT();
> - AsmToken LexTokenIntel();
> -protected:
> - AsmToken LexToken() {
> - if (!Lexer) {
> - SetError(SMLoc(), "No MCAsmLexer installed");
> - return AsmToken(AsmToken::Error, "", 0);
> - }
> -
> - 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 MCRegisterInfo &MRI, const MCAsmInfo &MAI)
> - : MCTargetAsmLexer(T), AsmInfo(MAI), tentativeIsValid(false) {
> - }
> -};
> -
> -} // end anonymous namespace
> -
> -#define GET_REGISTER_MATCHER
> -#include "X86GenAsmMatcher.inc"
> -
> -AsmToken X86AsmLexer::LexTokenATT() {
> - AsmToken lexedToken = lexDefinite();
> -
> - switch (lexedToken.getKind()) {
> - default:
> - return lexedToken;
> - case AsmToken::Error:
> - SetError(Lexer->getErrLoc(), Lexer->getErr());
> - return lexedToken;
> -
> - case AsmToken::Percent: {
> - const AsmToken &nextToken = lexTentative();
> - if (nextToken.getKind() != AsmToken::Identifier)
> - return lexedToken;
> -
> - if (unsigned regID = MatchRegisterName(nextToken.getString())) {
> - lexDefinite();
> -
> - // FIXME: This is completely wrong when there is a space or other
> - // punctuation between the % and the register name.
> - StringRef regStr(lexedToken.getString().data(),
> - lexedToken.getString().size() +
> - nextToken.getString().size());
> -
> - return AsmToken(AsmToken::Register, regStr,
> - static_cast<int64_t>(regID));
> - }
> -
> - // Match register name failed. If this is "db[0-7]", match it as an alias
> - // for dr[0-7].
> - if (nextToken.getString().size() == 3 &&
> - nextToken.getString().startswith("db")) {
> - int RegNo = -1;
> - switch (nextToken.getString()[2]) {
> - case '0': RegNo = X86::DR0; break;
> - case '1': RegNo = X86::DR1; break;
> - case '2': RegNo = X86::DR2; break;
> - case '3': RegNo = X86::DR3; break;
> - case '4': RegNo = X86::DR4; break;
> - case '5': RegNo = X86::DR5; break;
> - case '6': RegNo = X86::DR6; break;
> - case '7': RegNo = X86::DR7; break;
> - }
> -
> - if (RegNo != -1) {
> - lexDefinite();
> -
> - // FIXME: This is completely wrong when there is a space or other
> - // punctuation between the % and the register name.
> - StringRef regStr(lexedToken.getString().data(),
> - lexedToken.getString().size() +
> - nextToken.getString().size());
> - return AsmToken(AsmToken::Register, regStr,
> - static_cast<int64_t>(RegNo));
> - }
> - }
> -
> -
> - return lexedToken;
> - }
> - }
> -}
> -
> -AsmToken X86AsmLexer::LexTokenIntel() {
> - const AsmToken &lexedToken = lexDefinite();
> -
> - switch(lexedToken.getKind()) {
> - default:
> - return lexedToken;
> - case AsmToken::Error:
> - SetError(Lexer->getErrLoc(), Lexer->getErr());
> - return lexedToken;
> - case AsmToken::Identifier: {
> - unsigned regID = MatchRegisterName(lexedToken.getString().lower());
> -
> - if (regID)
> - return AsmToken(AsmToken::Register,
> - lexedToken.getString(),
> - static_cast<int64_t>(regID));
> - return lexedToken;
> - }
> - }
> -}
> -
> -extern "C" void LLVMInitializeX86AsmLexer() {
> - RegisterMCAsmLexer<X86AsmLexer> X(TheX86_32Target);
> - RegisterMCAsmLexer<X86AsmLexer> Y(TheX86_64Target);
> -}
>
> Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Thu Dec 20 08:43:30 2012
> @@ -2059,14 +2059,10 @@
> return false;
> }
>
> -
> -extern "C" void LLVMInitializeX86AsmLexer();
> -
> // Force static initialization.
> extern "C" void LLVMInitializeX86AsmParser() {
> RegisterMCAsmParser<X86AsmParser> X(TheX86_32Target);
> RegisterMCAsmParser<X86AsmParser> Y(TheX86_64Target);
> - LLVMInitializeX86AsmLexer();
> }
>
> #define GET_REGISTER_MATCHER
>
> Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=170699&r1=170698&r2=170699&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
> +++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Thu Dec 20 08:43:30 2012
> @@ -263,9 +263,6 @@
> case AsmToken::Real:
> Out->os() << "real: " << Lexer.getTok().getString();
> break;
> - case AsmToken::Register:
> - Out->os() << "register: " << Lexer.getTok().getRegVal();
> - break;
> case AsmToken::String:
> Out->os() << "string: " << Lexer.getTok().getString();
> break;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list