aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCDisassembler.h
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2011-10-04 22:44:48 +0000
committerKevin Enderby <enderby@apple.com>2011-10-04 22:44:48 +0000
commit9e5887b17e634b98f7c1cf0ee4f25c218097d08e (patch)
tree2c5bc9d59c09fc2fc10bc1b0ee782be59f63060b /include/llvm/MC/MCDisassembler.h
parenta8512edb6d1c52209bad2d6b989599bc4872c913 (diff)
downloadexternal_llvm-9e5887b17e634b98f7c1cf0ee4f25c218097d08e.tar.gz
external_llvm-9e5887b17e634b98f7c1cf0ee4f25c218097d08e.tar.bz2
external_llvm-9e5887b17e634b98f7c1cf0ee4f25c218097d08e.zip
Adding back support for printing operands symbolically to ARM's new disassembler
using llvm's public 'C' disassembler API now including annotations. Hooked this up to Darwin's otool(1) so it can again print things like branch targets for example this: blx _puts instead of this: blx #-36 and includes support for annotations for branches to symbol stubs like: bl 0x40 @ symbol stub for: _puts and annotations for pc relative loads like this: ldr r3, #8 @ literal pool for: Hello, world! Also again can print the expression encoded in the Mach-O relocation entries for things like this: movt r0, :upper16:((_foo-_bar)+1234) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141129 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCDisassembler.h')
-rw-r--r--include/llvm/MC/MCDisassembler.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/llvm/MC/MCDisassembler.h b/include/llvm/MC/MCDisassembler.h
index f7a9f1c9d9..454277d685 100644
--- a/include/llvm/MC/MCDisassembler.h
+++ b/include/llvm/MC/MCDisassembler.h
@@ -55,7 +55,9 @@ 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();
@@ -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