[all-commits] [llvm/llvm-project] ac1d23: Replace MCTargetOptionsCommandFlags.inc and Comman...

serge-sans-paille via All-commits all-commits at lists.llvm.org
Tue Mar 17 06:01:46 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ac1d23ed7de01fb3a18b340536842a419b504d86
      https://github.com/llvm/llvm-project/commit/ac1d23ed7de01fb3a18b340536842a419b504d86
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
    M lld/Common/TargetOptionsCommandFlags.cpp
    A llvm/include/llvm/CodeGen/CommandFlags.h
    R llvm/include/llvm/CodeGen/CommandFlags.inc
    A llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
    R llvm/include/llvm/MC/MCTargetOptionsCommandFlags.inc
    M llvm/include/llvm/module.modulemap
    M llvm/lib/CodeGen/CMakeLists.txt
    A llvm/lib/CodeGen/CommandFlags.cpp
    M llvm/lib/MC/CMakeLists.txt
    A llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
    M llvm/tools/dsymutil/DwarfStreamer.cpp
    M llvm/tools/gold/gold-plugin.cpp
    M llvm/tools/llc/CMakeLists.txt
    M llvm/tools/llc/llc.cpp
    M llvm/tools/lli/CMakeLists.txt
    M llvm/tools/lli/lli.cpp
    M llvm/tools/llvm-dwp/llvm-dwp.cpp
    M llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
    M llvm/tools/llvm-lto/CMakeLists.txt
    M llvm/tools/llvm-lto/llvm-lto.cpp
    M llvm/tools/llvm-lto2/CMakeLists.txt
    M llvm/tools/llvm-lto2/llvm-lto2.cpp
    M llvm/tools/llvm-mc-assemble-fuzzer/CMakeLists.txt
    M llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
    M llvm/tools/llvm-mc/CMakeLists.txt
    M llvm/tools/llvm-mc/llvm-mc.cpp
    M llvm/tools/llvm-mca/llvm-mca.cpp
    M llvm/tools/llvm-ml/llvm-ml.cpp
    M llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
    M llvm/tools/lto/CMakeLists.txt
    M llvm/tools/lto/lto.cpp
    M llvm/tools/opt/opt.cpp
    M llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp

  Log Message:
  -----------
  Replace MCTargetOptionsCommandFlags.inc and CommandFlags.inc by runtime registration

MCTargetOptionsCommandFlags.inc and CommandFlags.inc are headers which contain
cl::opt with static storage.
These headers are meant to be incuded by tools to make it easier to parametrize
codegen/mc.

However, these headers are also included in at least two libraries: lldCommon
and handle-llvm. As a result, when creating DYLIB, clang-cpp holds a reference
to the options, and lldCommon holds another reference. Linking the two in a
single executable, as zig does[0], results in a double registration.

This patch explores an other approach: the .inc files are moved to regular
files, and the registration happens on-demand through static declaration of
options in the constructor of a static object.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1756977#c5

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




More information about the All-commits mailing list