[LLVMdev] How could I get memory address for each assemble instruction?

Chris Lattner sabre at nondot.org
Mon Sep 13 13:48:10 PDT 2004


On Mon, 13 Sep 2004, Zhang Qiuyu wrote:

>
> Hi all,
>
> I am trying to disassemble *.bc to assemble code by using llvm-dis
> command, but what I got is like the following. So how could I get the
> assemble code like objdump? I mean the memory address for each
> instruction.

That looks like llc output, not llvm-dis output.  In any case, you should
be able to do something like this:

  llc x.bc -o x.s
  gcc x.s -o x
  objdump <whatever> x

-Chris

> llvm-dis:
>  .text
>  .align 16
>  .globl adpcm_coder
>  .type adpcm_coder, @function
> adpcm_coder:
> .LBBadpcm_coder_0: # entry
>  sub %ESP, 116
>  mov DWORD PTR [%ESP + 12], %ESI
>  mov %EAX, DWORD PTR [%ESP + 120]
>  mov %ECX, DWORD PTR [%ESP + 124]
>  mov %EDX, DWORD PTR [%ESP + 128]
>  mov %ESI, DWORD PTR [%ESP + 132]
>  mov DWORD PTR [%ESP], 0
>  mov DWORD PTR [%ESP + 44], %EAX
>  mov DWORD PTR [%ESP + 40], %ECX
>
>
> objdump :
> 08048720 <adpcm_coder>:
>  8048720: 83 ec 74              sub    $0x74,%esp
>  8048723: 89 74 24 0c           mov    %esi,0xc(%esp,1)
>  8048727: 8b 44 24 78           mov    0x78(%esp,1),%eax
>  804872b: 8b 4c 24 7c           mov    0x7c(%esp,1),%ecx
>  804872f: 8b 94 24 80 00 00 00  mov    0x80(%esp,1),%edx
>  8048736: 8b b4 24 84 00 00 00  mov    0x84(%esp,1),%esi
>  804873d: c7 04 24 00 00 00 00  movl   $0x0,(%esp,1)
>  8048744: 89 44 24 2c           mov    %eax,0x2c(%esp,1)
>
>

-Chris

-- 
http://llvm.org/
http://nondot.org/sabre/




More information about the llvm-dev mailing list