diff options
author | Roman Divacky <rdivacky@freebsd.org> | 2012-12-20 14:43:30 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@freebsd.org> | 2012-12-20 14:43:30 +0000 |
commit | 6af228a92a7b8414fa3c1b3c37ee659d32e66e1b (patch) | |
tree | 575bfc17a6cc425c91380e65eccde9bd0282a303 /lib/Target/MBlaze/AsmParser | |
parent | 332bd799512142e23d35105483520acbffff72c8 (diff) |
Remove MCTargetAsmLexer and its derived classes now that edis,
its only user, is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MBlaze/AsmParser')
-rw-r--r-- | lib/Target/MBlaze/AsmParser/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp | 112 | ||||
-rw-r--r-- | lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp | 3 |
3 files changed, 0 insertions, 116 deletions
diff --git a/lib/Target/MBlaze/AsmParser/CMakeLists.txt b/lib/Target/MBlaze/AsmParser/CMakeLists.txt index 813767ba6d..4a7d8e8d88 100644 --- a/lib/Target/MBlaze/AsmParser/CMakeLists.txt +++ b/lib/Target/MBlaze/AsmParser/CMakeLists.txt @@ -2,7 +2,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) add_llvm_library(LLVMMBlazeAsmParser - MBlazeAsmLexer.cpp MBlazeAsmParser.cpp ) diff --git a/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp b/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp deleted file mode 100644 index 480e79f9f5..0000000000 --- a/lib/Target/MBlaze/AsmParser/MBlazeAsmLexer.cpp +++ /dev/null @@ -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); -} - diff --git a/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp b/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp index 2016600b9d..69bbc57bea 100644 --- a/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp +++ b/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp @@ -548,12 +548,9 @@ bool MBlazeAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) { return false; } -extern "C" void LLVMInitializeMBlazeAsmLexer(); - /// Force static initialization. extern "C" void LLVMInitializeMBlazeAsmParser() { RegisterMCAsmParser<MBlazeAsmParser> X(TheMBlazeTarget); - LLVMInitializeMBlazeAsmLexer(); } #define GET_REGISTER_MATCHER |