Adding support for printing operands symbolically to llvm's public 'C'

disassembler API.  Hooked this up to the ARM target so such tools as Darwin's
otool(1) can now print things like branch targets for example this:
  blx _puts
instead of this:
  blx #-36
And even print the expression encoded in the Mach-O relocation entried for
things like this:
  movt r0, :upper16:((_foo-_bar)+1234)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129284 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2011-04-11 18:08:50 +00:00
parent 0fb215a154
commit bd3327654b
8 changed files with 212 additions and 9 deletions

View File

@ -422,6 +422,10 @@ bool ARMDisassembler::getInstruction(MCInst &MI,
if (!Builder)
return false;
Builder->setupBuilderForSymbolicDisassembly(getLLVMOpInfoCallback(),
getDisInfoBlock(), getMCContext(),
Address);
if (!Builder->Build(MI, insn))
return false;
@ -504,6 +508,10 @@ bool ThumbDisassembler::getInstruction(MCInst &MI,
Builder->SetSession(const_cast<Session *>(&SO));
Builder->setupBuilderForSymbolicDisassembly(getLLVMOpInfoCallback(),
getDisInfoBlock(), getMCContext(),
Address);
if (!Builder->Build(MI, insn))
return false;