Skip to content

disassembly printing #57

@ghost

Description

This is based on the https://github.com/lowRISC/riscv-llvm-integration repo at Latest commit 74e4050 on 3 Oct 2017.

Running llvm-objdump does not disassemble the instructions from the M extension and the jalr is formatted differently from the gnu objdump. Is this expected?

My command line is: (on windows msys2):
$ ./llvm-objdump.exe -arch=riscv32 -disassemble my_folder/riscv_blocks.elf

Corresponding gnu command:
$ bin/riscv64-unknown-elf-objdump.exe -d -M no-aliases blocks.elf

Sample output 1:
42000028: b7 57 c6 41 lui a5, 269413
4200002c: 93 87 d7 e6 addi a5, a5, -403
42000030: 33 07 f7 02
42000034: b7 07 00 42 lui a5, 270336
42000038: 23 a6 e7 2a sw a4, 684(a5)
4200003c: b7 07 00 42 lui a5, 270336

gnu objdump output: multiplication instruction expected (ignore hex/$ formatting/comments)
42000028: 41c657b7 lui a5,0x41c65
4200002c: e6d78793 addi a5,a5,-403 # 41c64e6d <STACK_SIZE+0x41c64a6d>
42000030: 02f70733 mul a4,a4,a5
42000034: 420007b7 lui a5,0x42000
42000038: 2ae7a623 sw a4,684(a5) # 420002ac
4200003c: 420007b7 lui a5,0x42000

Sample output 1: uses comma formatting for jalr

gnu objdump output: uses register offset bracket formatting for jalr (ignore hex/$ formatting/comments)
42000118: f8f714e3 bne a4,a5,420000a0 <draw_block+0x2c>
4200011c: 00000013 addi zero,zero,0
42000120: 03c12403 lw s0,60(sp)
42000124: 04010113 addi sp,sp,64
42000128: 00008067 jalr zero,0(ra)

The jalr difference can can be seen by using table-gen with gen-asm-writer option
$ ./bin/llvm-tblgen.exe -gen-asm-writer -I=../include -I=../lib/Target/RISCV ../lib/Target/RISCV/RISCV.td

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions