From 06b6161d3fa9d69a07e9046dbdd2e230b257d948 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Thu, 2 Jan 2025 23:27:57 +0100 Subject: [PATCH] Revert "[llvm-(min-)tblgen] Avoid redundant source compilation (#114494)" This reverts commit f6cb56902c6dcafede21eb6662910b6ff661fc0f. Buildbot failures such as https://lab.llvm.org/buildbot/#/builders/89/builds/13541: ``` /usr/bin/ld: utils/TableGen/Basic/CMakeFiles/obj.LLVMTableGenBasic.dir/ARMTargetDefEmitter.cpp.o: undefined reference to symbol '_ZN4llvm23EnableABIBreakingChecksE' /usr/bin/ld: /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/./lib/libLLVMSupport.so.20.0git: error adding symbols: DSO missing from command line ``` Going to investigate. --- .../{Basic => }/ARMTargetDefEmitter.cpp | 0 .../utils/TableGen/{Basic => }/Attributes.cpp | 0 llvm/utils/TableGen/Basic/CMakeLists.txt | 7 ------ llvm/utils/TableGen/Basic/TableGen.h | 13 ---------- llvm/utils/TableGen/CMakeLists.txt | 25 ++++++++++++------- .../TableGen/{Basic => }/DirectiveEmitter.cpp | 0 .../TableGen/{Basic => }/IntrinsicEmitter.cpp | 4 +-- .../{Basic => }/RISCVTargetDefEmitter.cpp | 0 llvm/utils/TableGen/{Basic => }/TableGen.cpp | 6 ++--- llvm/utils/TableGen/{Basic => }/VTEmitter.cpp | 0 llvm/utils/TableGen/llvm-min-tblgen.cpp | 18 ------------- llvm/utils/TableGen/llvm-tblgen.cpp | 18 ------------- 12 files changed, 20 insertions(+), 71 deletions(-) rename llvm/utils/TableGen/{Basic => }/ARMTargetDefEmitter.cpp (100%) rename llvm/utils/TableGen/{Basic => }/Attributes.cpp (100%) delete mode 100644 llvm/utils/TableGen/Basic/TableGen.h rename llvm/utils/TableGen/{Basic => }/DirectiveEmitter.cpp (100%) rename llvm/utils/TableGen/{Basic => }/IntrinsicEmitter.cpp (99%) rename llvm/utils/TableGen/{Basic => }/RISCVTargetDefEmitter.cpp (100%) rename llvm/utils/TableGen/{Basic => }/TableGen.cpp (94%) rename llvm/utils/TableGen/{Basic => }/VTEmitter.cpp (100%) delete mode 100644 llvm/utils/TableGen/llvm-min-tblgen.cpp delete mode 100644 llvm/utils/TableGen/llvm-tblgen.cpp diff --git a/llvm/utils/TableGen/Basic/ARMTargetDefEmitter.cpp b/llvm/utils/TableGen/ARMTargetDefEmitter.cpp similarity index 100% rename from llvm/utils/TableGen/Basic/ARMTargetDefEmitter.cpp rename to llvm/utils/TableGen/ARMTargetDefEmitter.cpp diff --git a/llvm/utils/TableGen/Basic/Attributes.cpp b/llvm/utils/TableGen/Attributes.cpp similarity index 100% rename from llvm/utils/TableGen/Basic/Attributes.cpp rename to llvm/utils/TableGen/Attributes.cpp diff --git a/llvm/utils/TableGen/Basic/CMakeLists.txt b/llvm/utils/TableGen/Basic/CMakeLists.txt index b058fba78eb05a..41d737e8d418e2 100644 --- a/llvm/utils/TableGen/Basic/CMakeLists.txt +++ b/llvm/utils/TableGen/Basic/CMakeLists.txt @@ -9,15 +9,8 @@ set(LLVM_LINK_COMPONENTS ) add_llvm_library(LLVMTableGenBasic OBJECT EXCLUDE_FROM_ALL DISABLE_LLVM_LINK_LLVM_DYLIB - ARMTargetDefEmitter.cpp - Attributes.cpp CodeGenIntrinsics.cpp - DirectiveEmitter.cpp - IntrinsicEmitter.cpp - RISCVTargetDefEmitter.cpp SDNodeProperties.cpp - TableGen.cpp - VTEmitter.cpp ) # Users may include its headers as "Basic/*.h" diff --git a/llvm/utils/TableGen/Basic/TableGen.h b/llvm/utils/TableGen/Basic/TableGen.h deleted file mode 100644 index 630aea62fcf902..00000000000000 --- a/llvm/utils/TableGen/Basic/TableGen.h +++ /dev/null @@ -1,13 +0,0 @@ -//===- TableGen.h ---------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Shared entry point for llvm-tblgen and llvm-min-tblgen. -// -//===----------------------------------------------------------------------===// - -int tblgen_main(int argc, char **argv); diff --git a/llvm/utils/TableGen/CMakeLists.txt b/llvm/utils/TableGen/CMakeLists.txt index e4b686803c9769..ba1e4aa01b48d6 100644 --- a/llvm/utils/TableGen/CMakeLists.txt +++ b/llvm/utils/TableGen/CMakeLists.txt @@ -5,17 +5,20 @@ add_subdirectory(Basic) # code needed by the backends. add_subdirectory(Common) +set(LLVM_LINK_COMPONENTS Support) + # llvm-min-tablegen only contains a subset of backends necessary to # build llvm/include. It must not depend on TableGenCommon, as # TableGenCommon depends on this already to generate things such as # ValueType definitions. -# Sources included in both, llvm-min-tblgen and llvm-tblgen, must be included -# into LLVMTableGenBasic to avoid redundant compilation and problems with build -# caches. -# At least one source file must be included directly to avoid CMake problems. -# E.g. CMake derives which linker to use from the types of sources added. add_tablegen(llvm-min-tblgen LLVM_HEADERS - llvm-min-tblgen.cpp + TableGen.cpp + ARMTargetDefEmitter.cpp + Attributes.cpp + DirectiveEmitter.cpp + IntrinsicEmitter.cpp + RISCVTargetDefEmitter.cpp + VTEmitter.cpp $ PARTIAL_SOURCES_INTENDED @@ -29,8 +32,10 @@ set(LLVM_LINK_COMPONENTS add_tablegen(llvm-tblgen LLVM DESTINATION "${LLVM_TOOLS_INSTALL_DIR}" EXPORT LLVM + ARMTargetDefEmitter.cpp AsmMatcherEmitter.cpp AsmWriterEmitter.cpp + Attributes.cpp CallingConvEmitter.cpp CodeEmitterGen.cpp CodeGenMapTable.cpp @@ -43,6 +48,7 @@ add_tablegen(llvm-tblgen LLVM DecoderEmitter.cpp DFAEmitter.cpp DFAPacketizerEmitter.cpp + DirectiveEmitter.cpp DisassemblerEmitter.cpp DXILEmitter.cpp ExegesisEmitter.cpp @@ -51,15 +57,18 @@ add_tablegen(llvm-tblgen LLVM GlobalISelEmitter.cpp InstrDocsEmitter.cpp InstrInfoEmitter.cpp - llvm-tblgen.cpp + IntrinsicEmitter.cpp MacroFusionPredicatorEmitter.cpp OptionParserEmitter.cpp OptionRSTEmitter.cpp PseudoLoweringEmitter.cpp RegisterBankEmitter.cpp RegisterInfoEmitter.cpp + RISCVTargetDefEmitter.cpp SearchableTableEmitter.cpp SubtargetEmitter.cpp + TableGen.cpp + VTEmitter.cpp WebAssemblyDisassemblerEmitter.cpp X86InstrMappingEmitter.cpp X86DisassemblerTables.cpp @@ -70,8 +79,6 @@ add_tablegen(llvm-tblgen LLVM $ $ - PARTIAL_SOURCES_INTENDED - DEPENDS intrinsics_gen # via llvm-min-tablegen ) diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/DirectiveEmitter.cpp similarity index 100% rename from llvm/utils/TableGen/Basic/DirectiveEmitter.cpp rename to llvm/utils/TableGen/DirectiveEmitter.cpp diff --git a/llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp similarity index 99% rename from llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp rename to llvm/utils/TableGen/IntrinsicEmitter.cpp index fc2b8908a35b84..093602c3da8045 100644 --- a/llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -#include "CodeGenIntrinsics.h" -#include "SequenceToOffsetTable.h" +#include "Basic/CodeGenIntrinsics.h" +#include "Basic/SequenceToOffsetTable.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" diff --git a/llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp b/llvm/utils/TableGen/RISCVTargetDefEmitter.cpp similarity index 100% rename from llvm/utils/TableGen/Basic/RISCVTargetDefEmitter.cpp rename to llvm/utils/TableGen/RISCVTargetDefEmitter.cpp diff --git a/llvm/utils/TableGen/Basic/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp similarity index 94% rename from llvm/utils/TableGen/Basic/TableGen.cpp rename to llvm/utils/TableGen/TableGen.cpp index 80ac93f2b54fb6..bea2a2e735dbe2 100644 --- a/llvm/utils/TableGen/Basic/TableGen.cpp +++ b/llvm/utils/TableGen/TableGen.cpp @@ -6,12 +6,10 @@ // //===----------------------------------------------------------------------===// // -// This file contains the global defintions (mostly command line parameters) -// shared between llvm-tblgen and llvm-min-tblgen. +// This file contains the main function for LLVM's TableGen. // //===----------------------------------------------------------------------===// -#include "TableGen.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/InitLLVM.h" @@ -76,7 +74,7 @@ static TableGen::Emitter::Opt X[] = { {"print-sets", printSets, "Print expanded sets for testing DAG exprs"}, }; -int tblgen_main(int argc, char **argv) { +int main(int argc, char **argv) { InitLLVM X(argc, argv); cl::ParseCommandLineOptions(argc, argv); diff --git a/llvm/utils/TableGen/Basic/VTEmitter.cpp b/llvm/utils/TableGen/VTEmitter.cpp similarity index 100% rename from llvm/utils/TableGen/Basic/VTEmitter.cpp rename to llvm/utils/TableGen/VTEmitter.cpp diff --git a/llvm/utils/TableGen/llvm-min-tblgen.cpp b/llvm/utils/TableGen/llvm-min-tblgen.cpp deleted file mode 100644 index 79fce5c555f6e1..00000000000000 --- a/llvm/utils/TableGen/llvm-min-tblgen.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===- llvm-min-tblgen.cpp ------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains the main function for LLVM's TableGen. -// -//===----------------------------------------------------------------------===// - -#include "Basic/TableGen.h" - -/// Command line parameters are shared between llvm-tblgen and llvm-min-tblgen. -/// The indirection to tblgen_main exists to ensure that the static variables -/// for the llvm::cl:: mechanism are linked into both executables. -int main(int argc, char **argv) { return tblgen_main(argc, argv); } diff --git a/llvm/utils/TableGen/llvm-tblgen.cpp b/llvm/utils/TableGen/llvm-tblgen.cpp deleted file mode 100644 index a38382472a992b..00000000000000 --- a/llvm/utils/TableGen/llvm-tblgen.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===- llvm-tblgen.cpp ----------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains the main function for LLVM's TableGen. -// -//===----------------------------------------------------------------------===// - -#include "Basic/TableGen.h" - -/// Command line parameters are shared between llvm-tblgen and llvm-min-tblgen. -/// The indirection to tblgen_main exists to ensure that the static variables -/// for the llvm::cl:: mechanism are linked into both executables. -int main(int argc, char **argv) { return tblgen_main(argc, argv); }