This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Decrease instruction indentation for non-x86
ClosedPublic

Authored by MaskRay on Jun 10 2020, 10:25 AM.

Details

Summary

Place the instruction at the 24th column (0-based indexing), matching
GNU objdump AArch64/powerpc/etc when the address is low.

This is beneficial for non-x86 targets which have short instruction
lengths.

// GNU objdump AArch64
   0:   91001062        add     x2, x3, #0x4
  400078:       91001062        add     x2, x3, #0x4
// llvm-objdump, with this patch
       0: 62 10 00 91   add     x2, x3, #4
  400078: 62 10 00 91   add     x2, x3, #4
// llvm-objdump, if we change to print a word instead of bytes in the future
       0: 91001062      add     x2, x3, #4
  400078: 91001062      add     x2, x3, #4

// GNU objdump Thumb
   0:   bf00            nop

Diff Detail

Event Timeline

MaskRay created this revision.Jun 10 2020, 10:25 AM
MaskRay updated this revision to Diff 269895.Jun 10 2020, 10:28 AM

Add --match-full-lines

jhenderson accepted this revision.Jun 11 2020, 12:54 AM

Seems reasonable to me. I take it we don't have any supported targets with 64-bit instructions (or at least more than 32-bits)? Similarly, I assume GNU indents to the same width for e.g. thumb 16-bit instructions as well as 32-bit instructions?

I'm happy with us moving towards better GNU compatibility for some targets without breaking it for others.

This revision is now accepted and ready to land.Jun 11 2020, 12:54 AM
MaskRay edited the summary of this revision. (Show Details)Jun 11 2020, 8:54 AM

Seems reasonable to me. I take it we don't have any supported targets with 64-bit instructions (or at least more than 32-bits)? Similarly, I assume GNU indents to the same width for e.g. thumb 16-bit instructions as well as 32-bit instructions?

I'm happy with us moving towards better GNU compatibility for some targets without breaking it for others.

Added an example of thumb in the description. The instruction is also placed at the 24th column.

Power ISA v3.1 introduced 64-bit instructions. GNU objdump will not change the column of instructions:

0000000000000000 <.text>:
   0:   00 00 10 04     plwa    r3,0
   4:   00 00 60 a4 
   8:   00 00 10 04     plwa    r3,0
   c:   00 00 60 a4

It seems we don't have good support for these instructions now. (Changing the column will not alter their display if we want to use multi-line..)

This revision was automatically updated to reflect the committed changes.