[all-commits] [llvm/llvm-project] 27f300: [llvm-(min-)tblgen] Avoid redundant source compila...

Michael Kruse via All-commits all-commits at lists.llvm.org
Fri Jan 3 00:42:20 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27f30029741ecf023baece7b3dde1ff9011ffefc
      https://github.com/llvm/llvm-project/commit/27f30029741ecf023baece7b3dde1ff9011ffefc
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2025-01-03 (Fri, 03 Jan 2025)

  Changed paths:
    R llvm/utils/TableGen/ARMTargetDefEmitter.cpp
    R llvm/utils/TableGen/Attributes.cpp
    A llvm/utils/TableGen/Basic/ARMTargetDefEmitter.cpp
    A llvm/utils/TableGen/Basic/Attributes.cpp
    M llvm/utils/TableGen/Basic/CMakeLists.txt
    A llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
    A llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp
    A llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp
    A llvm/utils/TableGen/Basic/TableGen.cpp
    A llvm/utils/TableGen/Basic/TableGen.h
    A llvm/utils/TableGen/Basic/VTEmitter.cpp
    M llvm/utils/TableGen/CMakeLists.txt
    R llvm/utils/TableGen/DirectiveEmitter.cpp
    R llvm/utils/TableGen/IntrinsicEmitter.cpp
    R llvm/utils/TableGen/RISCVTargetDefEmitter.cpp
    R llvm/utils/TableGen/TableGen.cpp
    R llvm/utils/TableGen/VTEmitter.cpp
    A llvm/utils/TableGen/llvm-min-tblgen.cpp
    A llvm/utils/TableGen/llvm-tblgen.cpp

  Log Message:
  -----------
  [llvm-(min-)tblgen] Avoid redundant source compilation (#114494)

All the sources of `llvm-min-tblgen` are also used for `llvm-tblgen`,
with identical compilation flags. Reuse the object files of
`llvm-min-tblgen` for `llvm-tblgen` by applying the usual source
structure of an executable: One file per executable which named after
the executable name containing the (in this case trivial) main function,
which just calls the tblgen_main in TableGen.cpp. This should also clear
up any confusion (including mine) of where each executable's main
function is.

While this slightly reduces build time, the main motivation is ccache.
Using the hard_link
option, building the object files for `llvm-tblgen` will result in a
hard link to the same object file already used for `llvm-min-tblgen`. To
signal the build system that the file is new, ccache will update the
file's time stamp. Unfortunately, time stamps are shared between all
hard-linked files s.t. this will indirectly also update the time stamps
for the object files used for `llvm-tblgen`. At the next run, Ninja will
recognize this time stamp discrepancy to the expected stamp recorded in
`.ninja_log` and rebuild those object files for `llvm-min-tblgen`, which
again will also update the stamp for the `llvm-tblgen`... . This is
especially annoying for tablegen because it means Ninja will re-run all
tablegenning in every build.

I am using the hard_link option because it reduces the cost of having
multiple build-trees of the LLVM sources and reduces the wear to the SSD
they are stored on.



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