mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user