diff options
author | Sean Callanan <scallanan@apple.com> | 2010-02-02 02:18:20 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2010-02-02 02:18:20 +0000 |
commit | d74667e226c3053128f34c6f2c6c9ebfe5b98e50 (patch) | |
tree | 73d49f8b393723244aa644972516e98085287817 | |
parent | 5ce0ee9c099deb18d432c665d74634b0373071c7 (diff) |
Removed an unnecessary class from the EDDisassembler
implementation. Also made sure that the register maps
were created during disassembler initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95051 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/ed/EDDisassembler.cpp | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/tools/ed/EDDisassembler.cpp b/tools/ed/EDDisassembler.cpp index e51276611f..99864fb322 100644 --- a/tools/ed/EDDisassembler.cpp +++ b/tools/ed/EDDisassembler.cpp @@ -149,59 +149,6 @@ EDDisassembler *EDDisassembler::getDisassembler(StringRef str, return getDisassembler(triple.getArch(), syntax); } -namespace { - class EDAsmParser : public MCAsmParser { - AsmLexer Lexer; - MCContext Context; - OwningPtr<MCStreamer> Streamer; - public: - // Mandatory functions - EDAsmParser(const MCAsmInfo &MAI) : Lexer(MAI) { - Streamer.reset(createNullStreamer(Context)); - } - virtual ~EDAsmParser() { } - MCAsmLexer &getLexer() { return Lexer; } - MCContext &getContext() { return Context; } - MCStreamer &getStreamer() { return *Streamer; } - void Warning(SMLoc L, const Twine &Msg) { } - bool Error(SMLoc L, const Twine &Msg) { return true; } - const AsmToken &Lex() { return Lexer.Lex(); } - bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) { - AsmToken token = Lex(); - if(token.isNot(AsmToken::Integer)) - return true; - Res = MCConstantExpr::Create(token.getIntVal(), Context); - return false; - } - bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) { - assert(0 && "I can't ParseParenExpression()s!"); - } - bool ParseAbsoluteExpression(int64_t &Res) { - assert(0 && "I can't ParseAbsoluteExpression()s!"); - } - - /// setBuffer - loads a buffer into the parser - /// @arg buf - The buffer to read tokens from - void setBuffer(const MemoryBuffer &buf) { Lexer.setBuffer(&buf); } - /// parseInstName - When the lexer is positioned befor an instruction - /// name (with possible intervening whitespace), reads past the name, - /// returning 0 on success and -1 on failure - /// @arg name - A reference to a string that is filled in with the - /// instruction name - /// @arg loc - A reference to a location that is filled in with the - /// position of the instruction name - int parseInstName(StringRef &name, SMLoc &loc) { - AsmToken tok = Lexer.Lex(); - if(tok.isNot(AsmToken::Identifier)) { - return -1; - } - name = tok.getString(); - loc = tok.getLoc(); - return 0; - } - }; -} - EDDisassembler::EDDisassembler(CPUKey &key) : Valid(false), ErrorString(), ErrorStream(ErrorString), Key(key) { const InfoMap *infoMap = infoFromArch(key.Arch); @@ -261,6 +208,8 @@ EDDisassembler::EDDisassembler(CPUKey &key) : SpecificAsmLexer->InstallLexer(*GenericAsmLexer); InstInfos = infoMap->Info; + + initMaps(*targetMachine->getRegisterInfo()); Valid = true; } |