X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMC%2FMCDisassembler.h;h=53a9ce0a3648f9b987c1b469be8fc1f7c2c3d218;hb=85c7b6108f8c8cea77d0bce30343f736f6c15981;hp=f7a9f1c9d9a775e938e4d55e994c3651f70bc0de;hpb=98c5ddabca1debf935a07d14d0cbc9732374bdb8;p=oota-llvm.git diff --git a/include/llvm/MC/MCDisassembler.h b/include/llvm/MC/MCDisassembler.h index f7a9f1c9d9a..53a9ce0a364 100644 --- a/include/llvm/MC/MCDisassembler.h +++ b/include/llvm/MC/MCDisassembler.h @@ -13,13 +13,13 @@ #include "llvm-c/Disassembler.h" namespace llvm { - + class MCInst; class MCSubtargetInfo; class MemoryObject; class raw_ostream; class MCContext; - + struct EDInstInfo; /// MCDisassembler - Superclass for all disassemblers. Consumes a memory region @@ -55,13 +55,15 @@ public: }; /// Constructor - Performs initial setup for the disassembler. - MCDisassembler(const MCSubtargetInfo &STI) : GetOpInfo(0), DisInfo(0), Ctx(0), STI(STI) {} - + MCDisassembler(const MCSubtargetInfo &STI) : GetOpInfo(0), SymbolLookUp(0), + DisInfo(0), Ctx(0), + STI(STI), CommentStream(0) {} + virtual ~MCDisassembler(); - + /// getInstruction - Returns the disassembly of a single instruction. /// - /// @param instr - An MCInst to populate with the contents of the + /// @param instr - An MCInst to populate with the contents of the /// instruction. /// @param size - A value to populate with the size of the instruction, or /// the number of bytes consumed while attempting to decode @@ -72,7 +74,7 @@ public: /// @param vStream - The stream to print warnings and diagnostic messages on. /// @param cStream - The stream to print comments and annotations on. /// @return - MCDisassembler::Success if the instruction is valid, - /// MCDisassembler::SoftFail if the instruction was + /// MCDisassembler::SoftFail if the instruction was /// disassemblable but invalid, /// MCDisassembler::Fail if the instruction was invalid. virtual DecodeStatus getInstruction(MCInst& instr, @@ -88,7 +90,7 @@ public: /// @return - An array of instruction information, with one entry for /// each MCInst opcode this disassembler returns. /// NULL if there is no info for this target. - virtual EDInstInfo *getEDInfo() const { return (EDInstInfo*)0; } + virtual const EDInstInfo *getEDInfo() const { return (EDInstInfo*)0; } private: // @@ -96,6 +98,8 @@ private: // // The function to get the symbolic information for operands. LLVMOpInfoCallback GetOpInfo; + // The function to lookup a symbol name. + LLVMSymbolLookupCallback SymbolLookUp; // The pointer to the block of symbolic information for above call back. void *DisInfo; // The assembly context for creating symbols and MCExprs in place of @@ -107,15 +111,24 @@ protected: public: void setupForSymbolicDisassembly(LLVMOpInfoCallback getOpInfo, + LLVMSymbolLookupCallback symbolLookUp, void *disInfo, MCContext *ctx) { GetOpInfo = getOpInfo; + SymbolLookUp = symbolLookUp; DisInfo = disInfo; Ctx = ctx; } LLVMOpInfoCallback getLLVMOpInfoCallback() const { return GetOpInfo; } + LLVMSymbolLookupCallback getLLVMSymbolLookupCallback() const { + return SymbolLookUp; + } void *getDisInfoBlock() const { return DisInfo; } MCContext *getMCContext() const { return Ctx; } + + // Marked mutable because we cache it inside the disassembler, rather than + // having to pass it around as an argument through all the autogenerated code. + mutable raw_ostream *CommentStream; }; } // namespace llvm