From e510860656bb81bd90ae3cf8bb5ef4dc8cd33c18 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 5 May 2021 00:20:41 -0700 Subject: [PATCH] [llvm-objdump] Add -M {att,intel} & deprecate --x86-asm-syntax={att,intel} The internal `cl::opt` option --x86-asm-syntax sets the AsmParser and AsmWriter dialect. The option is used by llc and llvm-mc tests to set the AsmWriter dialect. This patch adds -M {att,intel} as GNU objdump compatible aliases (PR43413). Note: the dialect is initialized when the MCAsmInfo is constructed. `MCInstPrinter::applyTargetSpecificCLOption` is called too late and its MCAsmInfo reference is const, so changing the `cl::opt` in `MCInstPrinter::applyTargetSpecificCLOption` is not an option, at least without large amount of refactoring. Reviewed By: hoy, jhenderson, thakis Differential Revision: https://reviews.llvm.org/D101695 --- llvm/docs/CommandGuide/llvm-objdump.rst | 11 ++++- llvm/docs/ReleaseNotes.rst | 4 ++ .../elf-disassemble-symbololize-operands.yaml | 4 +- .../test/tools/llvm-objdump/X86/syntax-mode.s | 25 +++++++++++ llvm/tools/llvm-objdump/llvm-objdump.cpp | 44 ++++++++++++------- 5 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 llvm/test/tools/llvm-objdump/X86/syntax-mode.s diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst index cb2e4525837ae3..4f6a633c63a000 100644 --- a/llvm/docs/CommandGuide/llvm-objdump.rst +++ b/llvm/docs/CommandGuide/llvm-objdump.rst @@ -146,8 +146,14 @@ OPTIONS .. option:: -M, --disassembler-options= - Pass target-specific disassembler options. Currently supported for ARM targets - only. Available options are ``reg-names-std`` and ``reg-names-raw``. + Pass target-specific disassembler options. Available options: + + * ``reg-names-std``: ARM only (default). Print in ARM 's instruction set documentation, with r13/r14/r15 replaced by sp/lr/pc. + * ``reg-names-raw``: ARM only. Use r followed by the register number. + * ``no-aliases``: RISC-V only. Print raw instruction mnemonic instead of pesudo instruction mnemonic. + * ``numeric``: RISC-V only. Print raw register names instead of ABI mnemonic. (e.g. print x1 instead of ra) + * ``att``: x86 only (default). Print in the AT&T syntax. + * ``intel``: x86 only. Print in the intel syntax. .. option:: --mcpu= @@ -242,6 +248,7 @@ OPTIONS .. option:: --x86-asm-syntax=