[all-commits] [llvm/llvm-project] 254a31: [lldb][NFC] Use MCInstrAnalysis when available in ...

Venkata Ramanaiah Nalamothu via All-commits all-commits at lists.llvm.org
Sun Aug 13 20:07:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 254a31273a27728bb7937b27417eba083781f7eb
      https://github.com/llvm/llvm-project/commit/254a31273a27728bb7937b27417eba083781f7eb
  Author: Venkata Ramanaiah Nalamothu <quic_vnalamot at quicinc.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
    M lldb/unittests/Disassembler/CMakeLists.txt
    A lldb/unittests/Disassembler/RISCV/CMakeLists.txt
    A lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp
    M lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp
    M llvm/include/llvm/MC/MCInstrAnalysis.h

  Log Message:
  -----------
  [lldb][NFC] Use MCInstrAnalysis when available in the disassembler plugin

Since the info in MCInstrDesc is based on opcodes only, it is often quite
inaccurate. The MCInstrAnalysis has been added so that targets can provide
accurate info, which is based on registers used by the instruction, through
the own versions of MCInstrDesc functions.

The RISCVMCInstrAnalysis, which needs to refine several MCInstrDesc methods,
is a good example for this.

Given the llvm-objdump also uses MCInstrAnalysis, I think this change is in
the right direction.

The default implementation of MCInstrAnalysis methods forward the query to
MCInstrDesc functions. Hence, no functional change is intended/expected.

To avoid bloating up MCInstrAnalysis, only the methods provided by it and
the ones used by disassembler plugin are changed to use MCInstrAnalysis when
available.

Though I am not sure if it will be useful, making MCInstrAnalysis available
in the disassembler plugin would allow enabling symbolize operands (D84191)
feature in lldb's disassembler as well.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D156086




More information about the All-commits mailing list