Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shard the public llvm-config.h in multiple files (NFC) #71273

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1063,13 +1063,18 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")

endif()

# Configure the three LLVM configuration header files.
# Configure the LLVM configurations header files.
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
${LLVM_INCLUDE_DIR}/llvm/Config/config.h)
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake
${LLVM_INCLUDE_DIR}/llvm/Config/llvm-config.h)

# Configure all the llvm-config*.h.cmake files.
file(GLOB LLVM_CONFIGS_H_FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config*.cmake)
foreach(LLVM_CONFIGS_H_FILE ${LLVM_CONFIGS_H_FILES})
string( REPLACE ".cmake" "" LLVM_CONFIGS_H_FILE_DEST "${LLVM_CONFIGS_H_FILE}")
string( REPLACE "${LLVM_MAIN_INCLUDE_DIR}" "${LLVM_INCLUDE_DIR}" LLVM_CONFIGS_H_FILE_DEST "${LLVM_CONFIGS_H_FILE_DEST}")
configure_file(${LLVM_CONFIGS_H_FILE} ${LLVM_CONFIGS_H_FILE_DEST})
endforeach()
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/abi-breaking.h.cmake
${LLVM_INCLUDE_DIR}/llvm/Config/abi-breaking.h)
Expand Down
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-build-llvm-dylib.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-build-llvm-dylib.h.cmake -----*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_BUILD_LLVM_DYLIB_H
#define LLVM_CONFIG_BUILD_LLVM_DYLIB_H

/* Define if building libLLVM shared library */
#cmakedefine LLVM_BUILD_LLVM_DYLIB ${LLVM_BUILD_LLVM_DYLIB}

#endif // LLVM_CONFIG_BUILD_LLVM_DYLIB_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-build-shared-libs.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-build-shared-libs.h.cmake ----*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_BUILD_SHARED_LIBS_H
#define LLVM_CONFIG_BUILD_SHARED_LIBS_H

/* Define if building LLVM with BUILD_SHARED_LIBS */
#cmakedefine LLVM_BUILD_SHARED_LIBS ${LLVM_BUILD_SHARED_LIBS}

#endif // LLVM_CONFIG_BUILD_SHARED_LIBS_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-curl.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-curl.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_CURL_H
#define LLVM_CONFIG_ENABLE_CURL_H

/* Define if we have curl and want to use it */
#cmakedefine LLVM_ENABLE_CURL ${LLVM_ENABLE_CURL}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that this split is going to cause subtle bugs if we don't use cmakedefine01 everywhere. Otherwise we could end up with #ifndef being evaluated incorrectly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment we keep including everything through the llvm-config.h ; but you're right this is a major hurdle.

I'm already going one by one through all the options and converting them to cmakedefine01.
I am also making the LLVM codebase -Wundef clean: this is the only way to catch this in a principle way (I think we should enable -Wundef by default actually).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a long flight yesterday, I have locally all the patches for making every option a cmakedefine01 and making the codebase -Wundef clean.


#endif // LLVM_CONFIG_ENABLE_CURL_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-dia-sdk.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-dia-sdk.h.cmake -------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_DIA_SDK_H
#define LLVM_CONFIG_ENABLE_DIA_SDK_H

/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */
#cmakedefine01 LLVM_ENABLE_DIA_SDK

#endif // LLVM_CONFIG_ENABLE_DIA_SDK_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-dump.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-dump.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_DUMP_H
#define LLVM_CONFIG_ENABLE_DUMP_H

/* Define if LLVM_ENABLE_DUMP is enabled */
#cmakedefine LLVM_ENABLE_DUMP ${LLVM_ENABLE_DUMP}

#endif // LLVM_CONFIG_ENABLE_DUMP_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-httplib.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-httplib.h --------------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_HTTPLIB_H
#define LLVM_CONFIG_ENABLE_HTTPLIB_H

/* Define if we have cpp-httplib and want to use it */
#cmakedefine LLVM_ENABLE_HTTPLIB ${LLVM_ENABLE_HTTPLIB}

#endif // LLVM_CONFIG_ENABLE_HTTPLIB_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-plugins.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-plugins.h.cmake -------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_PLUGINS_H
#define LLVM_CONFIG_ENABLE_PLUGINS_H

/* Define if plugins enabled */
#cmakedefine LLVM_ENABLE_PLUGINS ${LLVM_ENABLE_PLUGINS}

#endif // LLVM_CONFIG_ENABLE_PLUGINS_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-threads.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-threads.h --------------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_THREADS_H
#define LLVM_CONFIG_ENABLE_THREADS_H

/* Define if threads enabled */
#cmakedefine01 LLVM_ENABLE_THREADS

#endif // LLVM_CONFIG_ENABLE_THREADS_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-zlib.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-zlib.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_ZLIB_H
#define LLVM_CONFIG_ENABLE_ZLIB_H

/* Define if zlib compression is available */
#cmakedefine01 LLVM_ENABLE_ZLIB

#endif // LLVM_CONFIG_ENABLE_ZLIB_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-enable-zstd.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-enable-zstd.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ENABLE_ZSTD_H
#define LLVM_CONFIG_ENABLE_ZSTD_H

/* Define if zstd compression is available */
#cmakedefine01 LLVM_ENABLE_ZSTD

#endif // LLVM_CONFIG_ENABLE_ZSTD_H
18 changes: 18 additions & 0 deletions llvm/include/llvm/Config/llvm-config-force-enable-stats.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*===------- llvm/Config/llvm-config-force-enable-stats.h.cmake ---*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_FORCE_ENABLE_STATS_H
#define LLVM_CONFIG_FORCE_ENABLE_STATS_H

/* Whether LLVM records statistics for use with GetStatistics(),
* PrintStatistics() or PrintStatisticsJSON()
*/
#cmakedefine01 LLVM_FORCE_ENABLE_STATS

#endif // LLVM_CONFIG_FORCE_ENABLE_STATS_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-force-use-old-toolchain.h ----*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_FORCE_USE_OLD_TOOLCHAIN_H
#define LLVM_CONFIG_FORCE_USE_OLD_TOOLCHAIN_H

/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */
#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN}

#endif // LLVM_CONFIG_FORCE_USE_OLD_TOOLCHAIN_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-has-atomics.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-has-atomics.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_HAS_ATOMICS_H
#define LLVM_CONFIG_HAS_ATOMICS_H

/* Has gcc/MSVC atomic intrinsics */
#cmakedefine01 LLVM_HAS_ATOMICS

#endif // LLVM_CONFIG_HAS_ATOMICS_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-have-sysexits.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-have-sysexits.h.cmake --------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_HAVE_SYSEXITS_H_H
#define LLVM_CONFIG_HAVE_SYSEXITS_H_H

/* Define to 1 if you have the <sysexits.h> header file. */
#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H}

#endif // LLVM_CONFIG_HAVE_SYSEXITS_H_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-have-tflite.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-have-tflite.h.cmake ----------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_HAVE_TFLITE_H
#define LLVM_CONFIG_HAVE_TFLITE_H

/* Define if LLVM is using tflite */
#cmakedefine LLVM_HAVE_TFLITE ${LLVM_HAVE_TFLITE}

#endif // LLVM_CONFIG_HAVE_TFLITE_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-on-unix.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-on-unix.cmake.h --------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_ON_UNIX_H
#define LLVM_CONFIG_ON_UNIX_H

/* Define if this is Unixish platform */
#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}

#endif // LLVM_CONFIG_ON_UNIX_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-target-AArch64.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-target-AArch64.h -------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_TARGET_AARCH64_H
#define LLVM_CONFIG_TARGET_AARCH64_H

/* Define if the AArch64 target is built in */
#cmakedefine01 LLVM_HAS_AARCH64_TARGET

#endif // LLVM_CONFIG_TARGET_AARCH64_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-target-AMDGPU.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-target-AMDGPU.h --------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_TARGET_AMDGPU_H
#define LLVM_CONFIG_TARGET_AMDGPU_H

/* Define if the AMDGPU target is built in */
#cmakedefine01 LLVM_HAS_AMDGPU_TARGET

#endif // LLVM_CONFIG_TARGET_AMDGPU_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-target-ARC.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-target-ARC.h -----------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_TARGET_ARC_H
#define LLVM_CONFIG_TARGET_ARC_H

/* Define if the ARC target is built in */
#cmakedefine01 LLVM_HAS_ARC_TARGET

#endif // LLVM_CONFIG_TARGET_ARC_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-target-ARM.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-target-ARM.h -----------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_TARGET_ARM_H
#define LLVM_CONFIG_TARGET_ARM_H

/* Define if the ARM target is built in */
#cmakedefine01 LLVM_HAS_ARM_TARGET

#endif // LLVM_CONFIG_TARGET_ARM_H
16 changes: 16 additions & 0 deletions llvm/include/llvm/Config/llvm-config-target-AVR.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*===------- llvm/Config/llvm-config-target-AVR.h -----------------*- C -*-===*/
/* */
/* 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 */
/* */
/*===----------------------------------------------------------------------===*/

#ifndef LLVM_CONFIG_TARGET_AVR_H
#define LLVM_CONFIG_TARGET_AVR_H

/* Define if the AVR target is built in */
#cmakedefine01 LLVM_HAS_AVR_TARGET

#endif // LLVM_CONFIG_TARGET_AVR_H
Loading