[all-commits] [llvm/llvm-project] 3b8727: [MC][NFC] Remove some virtual function from MCAsmI...

Alexis Engelke via All-commits all-commits at lists.llvm.org
Fri Jul 24 11:42:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b87272648f483c6b0763b44e8cb4b470283b7d5
      https://github.com/llvm/llvm-project/commit/3b87272648f483c6b0763b44e8cb4b470283b7d5
  Author: Alexis Engelke <engelke at in.tum.de>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M llvm/include/llvm/MC/MCAsmInfo.h
    M llvm/include/llvm/MC/MCAsmInfoXCOFF.h
    M llvm/lib/MC/MCAsmInfo.cpp
    M llvm/lib/MC/MCAsmInfoXCOFF.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
    M llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
    M llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h
    M llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
    M llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp

  Log Message:
  -----------
  [MC][NFC] Remove some virtual function from MCAsmInfo (#211858)

The MCAsmInfo vtable is currently 144B (no anchor)/152B (anchor) large
-- and there are 49 of these in an all-target libLLVM.so. Some of these
are not needed or can be easily removed. This removes 5 vtable entries.

Some notes on the remaining functions -- I think this vtable can be
removed entirely without too much effort:

- getStackSection can also be removed, this is ELF-only; unfortunately
  this will require code duplication between AsmPrinter and
  MCELFStreamer.

- getExprForPersonalitySymbol is single-use and two-overrides (Darwin on
  x86-64, AArch64), likely removable.

- shouldOmitSectionDirective has three override modes -- COFF (disallow
  for COMDAT/unique section), AMDGPU (4 .hsa sections), and always-omit
  (NVPTX, SPIRV). This is only called from printSwitchToSection, so COFF
  is no problem, always-omit needs a flag, leaving AMDGPU.

- useCodeAlign can probably be replaced by Sec.isText(), although not
  NFC (e.g. Darwin non-pure instructions).

- getMaxInstLength is AMDGPU-only and only used in the disassembler and
  for estimating inline assembly size. The code can likely be moved to
  the disassembler, but doing so is not NFC w.r.t. inlineasm.

- setUseIntegratedAssembler is ARM-only and only used to workaround a
  binutils bug that was fixed in 2014. Likely removable, but not NFC.

- printSwitchToSection is inherently file-format specific. Maybe replace
  with a raw function pointer taking MCAsmInfo as parameter?

- printSpecifierExpr likewise.

- evaluateAsRelocatableImpl likewise.

- ~MCAsmInfo -- I don't think any subclass has additional members, but I
  haven't checked in detail.



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