[all-commits] [llvm/llvm-project] ac7ceb: [Hexagon][llvm-objdump] Improve disassembly of Hex...

quic-areg via All-commits all-commits at lists.llvm.org
Fri Jul 18 08:28:21 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ac7ceb3dabfac548caa993e7b77bbadc78af4464
      https://github.com/llvm/llvm-project/commit/ac7ceb3dabfac548caa993e7b77bbadc78af4464
  Author: quic-areg <aregmi at quicinc.com>
  Date:   2025-07-18 (Fri, 18 Jul 2025)

  Changed paths:
    M lld/test/ELF/hexagon-plt.s
    M lld/test/ELF/hexagon-shared.s
    M lld/test/ELF/hexagon-tls-gd-xform.s
    M llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
    M llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
    M llvm/lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.cpp
    M llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
    M llvm/test/MC/Hexagon/two_ext.s
    A llvm/test/tools/llvm-objdump/ELF/Hexagon/hexagon-bundles.s
    M llvm/tools/llvm-mc/Disassembler.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.cpp

  Log Message:
  -----------
  [Hexagon][llvm-objdump] Improve disassembly of Hexagon bundles (#145807)

Hexagon instructions are VLIW "bundles" of up to four instruction words
encoded as a single MCInst with operands for each sub-instruction.
Previously, the disassembler's getInstruction() returned the full
bundle, which made it difficult to work with llvm-objdump.

For example, since all instructions are bundles, and bundles do not
branch, branch targets could not be printed.

This patch modifies the Hexagon disassembler to return individual
sub-instructions instead of entire bundles, enabling correct printing of
branch targets and relocations. It also introduces
`MCDisassembler::getInstructionBundle` for cases where the full bundle
is still needed.

By default, llvm-objdump separates instructions with newlines. However,
this does not work well for Hexagon syntax:

  { inst1
    inst2
    inst3
    inst4 <branch> } :endloop0

Instructions may be followed by a closing brace, a closing brace with
`:endloop`, or a newline. Branches must appear within the braces.

To address this, `PrettyPrinter::getInstructionSeparator()` is added and
overridden for Hexagon.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list