From 1225c503ae9f8d5eaa70b6deaf4bb4c6e276f424 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 24 Oct 2024 08:23:41 +1100 Subject: [PATCH 01/25] [ORC-RT] Initial check-in for a new, top-level ORC runtime project. Includes CMake files and a placeholder header, library, and tool. See discussion at https://discourse.llvm.org/t/rfc-move-orc-executor-support-into-top-level-project/81049 --- llvm/CMakeLists.txt | 2 +- llvm/projects/CMakeLists.txt | 2 + orc-rt/CMakeLists.txt | 47 ++++++++++++++++++++++ orc-rt/include/orc-rt-c/orc-rt.h | 27 +++++++++++++ orc-rt/lib/CMakeLists.txt | 1 + orc-rt/lib/prelink/CMakeLists.txt | 1 + orc-rt/lib/prelink/orc-rt-prelink.cpp | 5 +++ orc-rt/tools/CMakeLists.txt | 1 + orc-rt/tools/orc-executor/CMakeLists.txt | 3 ++ orc-rt/tools/orc-executor/orc-executor.cpp | 6 +++ runtimes/CMakeLists.txt | 2 +- 11 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 orc-rt/CMakeLists.txt create mode 100644 orc-rt/include/orc-rt-c/orc-rt.h create mode 100644 orc-rt/lib/CMakeLists.txt create mode 100644 orc-rt/lib/prelink/CMakeLists.txt create mode 100644 orc-rt/lib/prelink/orc-rt-prelink.cpp create mode 100644 orc-rt/tools/CMakeLists.txt create mode 100644 orc-rt/tools/orc-executor/CMakeLists.txt create mode 100644 orc-rt/tools/orc-executor/orc-executor.cpp diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index b672cb9365284..565f5caa561fd 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -149,7 +149,7 @@ endforeach() # As we migrate runtimes to using the bootstrapping build, the set of default runtimes # should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above. set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind") -set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;libcxx;compiler-rt;openmp;llvm-libgcc;offload;flang-rt;libclc;libsycl") +set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;libcxx;compiler-rt;openmp;llvm-libgcc;offload;flang-rt;libclc;libsycl;orc-rt") set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.") if(LLVM_ENABLE_RUNTIMES STREQUAL "all") diff --git a/llvm/projects/CMakeLists.txt b/llvm/projects/CMakeLists.txt index f254cf10806d7..f5f7c98826c2d 100644 --- a/llvm/projects/CMakeLists.txt +++ b/llvm/projects/CMakeLists.txt @@ -9,6 +9,7 @@ foreach(entry ${entries}) (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxx) AND (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxxabi) AND (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libunwind) AND + (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/orc-rt) AND (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/cross-project-tests) AND @@ -34,6 +35,7 @@ if(${LLVM_BUILD_RUNTIME}) add_llvm_external_project(libc) add_llvm_external_project(libcxxabi) add_llvm_external_project(libcxx) + add_llvm_external_project(orc-rt) endif() if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT) add_llvm_external_project(compiler-rt) diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt new file mode 100644 index 0000000000000..f48773e1bed7f --- /dev/null +++ b/orc-rt/CMakeLists.txt @@ -0,0 +1,47 @@ +# CMake build for ORC-RT. + +#=============================================================================== +# Setup Project +#=============================================================================== + +cmake_minimum_required(VERSION 3.20.0) +set(LLVM_SUBPROJECT_TITLE "orc-rt") + +set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) + +include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake + NO_POLICY_SCOPE) + +# Add path for custom orc-rt modules. +list(INSERT CMAKE_MODULE_PATH 0 +# "${CMAKE_CURRENT_SOURCE_DIR}/cmake" +# "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" + "${LLVM_COMMON_CMAKE_UTILS}" + "${LLVM_COMMON_CMAKE_UTILS}/Modules" + ) + +set(CMAKE_FOLDER "orc-rt") + +set(LIBORCRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(LIBORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + +#=============================================================================== +# Setup CMake Options +#=============================================================================== + +set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") +set(CMAKE_CXX_STANDARD_REQUIRED YES) +set(CMAKE_CXX_EXTENSIONS NO) + +#================================ +# Setup Compiler Flags +#================================ + +# Configure compiler. Must happen after setting the target flags. + +#=============================================================================== +# Setup Source Code +#=============================================================================== + +add_subdirectory(lib) +add_subdirectory(tools) diff --git a/orc-rt/include/orc-rt-c/orc-rt.h b/orc-rt/include/orc-rt-c/orc-rt.h new file mode 100644 index 0000000000000..fdc0fd29976d4 --- /dev/null +++ b/orc-rt/include/orc-rt-c/orc-rt.h @@ -0,0 +1,27 @@ +/*===- orc-rt-c/orc-rt.h - Placeholder header for orc-rt ----------*- 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 *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* Placeholder header for initial orc-rt checkin *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef ORC_RT_C_ORC_RT_H +#define ORC_RT_C_ORC_RT_H + +#ifdef __cplusplus +extern "C" { +#endif + +void orc_rt(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* ORC_RT_C_ORC_RT_H */ diff --git a/orc-rt/lib/CMakeLists.txt b/orc-rt/lib/CMakeLists.txt new file mode 100644 index 0000000000000..6080b84a51fca --- /dev/null +++ b/orc-rt/lib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(prelink) diff --git a/orc-rt/lib/prelink/CMakeLists.txt b/orc-rt/lib/prelink/CMakeLists.txt new file mode 100644 index 0000000000000..4e951e7776436 --- /dev/null +++ b/orc-rt/lib/prelink/CMakeLists.txt @@ -0,0 +1 @@ +add_library(orc-rt-prelink STATIC orc-rt-prelink.cpp) diff --git a/orc-rt/lib/prelink/orc-rt-prelink.cpp b/orc-rt/lib/prelink/orc-rt-prelink.cpp new file mode 100644 index 0000000000000..d24d5838a25cc --- /dev/null +++ b/orc-rt/lib/prelink/orc-rt-prelink.cpp @@ -0,0 +1,5 @@ +#include + +extern "C" void orc_rt(void) { + printf("hello, world!\n"); +} diff --git a/orc-rt/tools/CMakeLists.txt b/orc-rt/tools/CMakeLists.txt new file mode 100644 index 0000000000000..fc78ea4131606 --- /dev/null +++ b/orc-rt/tools/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(orc-executor) diff --git a/orc-rt/tools/orc-executor/CMakeLists.txt b/orc-rt/tools/orc-executor/CMakeLists.txt new file mode 100644 index 0000000000000..7750afc61c4b8 --- /dev/null +++ b/orc-rt/tools/orc-executor/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(orc-executor orc-executor.cpp) +target_link_libraries(orc-executor PRIVATE orc-rt-prelink) +target_include_directories(orc-executor PRIVATE ../../include) diff --git a/orc-rt/tools/orc-executor/orc-executor.cpp b/orc-rt/tools/orc-executor/orc-executor.cpp new file mode 100644 index 0000000000000..4a03ac64710d2 --- /dev/null +++ b/orc-rt/tools/orc-executor/orc-executor.cpp @@ -0,0 +1,6 @@ +#include "orc-rt-c/orc-rt.h" + +int main(int argc, char *argv[]) { + orc_rt(); + return 0; +} diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index e3f75073bf0a7..f60e9dbc569de 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -36,7 +36,7 @@ list(INSERT CMAKE_MODULE_PATH 0 # We order libraries to mirror roughly how they are layered, except that compiler-rt can depend # on libc++, so we put it after. set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;libclc;openmp;offload") -set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt;libsycl") +set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt;libsycl;orc-rt") set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.") if(LLVM_ENABLE_RUNTIMES STREQUAL "all" ) From b8f9da3fc911310d811ad83b9bc1ab33ece183fb Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 24 Oct 2024 11:25:16 +1100 Subject: [PATCH 02/25] clang-format --- orc-rt/lib/prelink/orc-rt-prelink.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/orc-rt/lib/prelink/orc-rt-prelink.cpp b/orc-rt/lib/prelink/orc-rt-prelink.cpp index d24d5838a25cc..b97d9cd22a0a2 100644 --- a/orc-rt/lib/prelink/orc-rt-prelink.cpp +++ b/orc-rt/lib/prelink/orc-rt-prelink.cpp @@ -1,5 +1,3 @@ #include -extern "C" void orc_rt(void) { - printf("hello, world!\n"); -} +extern "C" void orc_rt(void) { printf("hello, world!\n"); } From 6bd720515d731875cfc1fe31b35b57b7d7b6bfdd Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 28 Oct 2024 08:06:21 +1100 Subject: [PATCH 03/25] Simplify CMake files, add install support. --- orc-rt/CMakeLists.txt | 23 ++++--------------- orc-rt/include/CMakeLists.txt | 16 +++++++++++++ orc-rt/lib/CMakeLists.txt | 2 +- orc-rt/lib/executor/CMakeLists.txt | 13 +++++++++++ .../orc-rt-executor.cpp} | 0 orc-rt/lib/prelink/CMakeLists.txt | 1 - orc-rt/tools/orc-executor/CMakeLists.txt | 2 +- 7 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 orc-rt/include/CMakeLists.txt create mode 100644 orc-rt/lib/executor/CMakeLists.txt rename orc-rt/lib/{prelink/orc-rt-prelink.cpp => executor/orc-rt-executor.cpp} (100%) delete mode 100644 orc-rt/lib/prelink/CMakeLists.txt diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index f48773e1bed7f..2b170f51c861a 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -5,25 +5,14 @@ #=============================================================================== cmake_minimum_required(VERSION 3.20.0) -set(LLVM_SUBPROJECT_TITLE "orc-rt") set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) - include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake NO_POLICY_SCOPE) -# Add path for custom orc-rt modules. -list(INSERT CMAKE_MODULE_PATH 0 -# "${CMAKE_CURRENT_SOURCE_DIR}/cmake" -# "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" - "${LLVM_COMMON_CMAKE_UTILS}" - "${LLVM_COMMON_CMAKE_UTILS}/Modules" - ) - -set(CMAKE_FOLDER "orc-rt") +project(LibOrcRT LANGUAGES C CXX ASM) -set(LIBORCRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(LIBORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +include(GNUInstallDirs) #=============================================================================== # Setup CMake Options @@ -32,16 +21,12 @@ set(LIBORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) - -#================================ -# Setup Compiler Flags -#================================ - -# Configure compiler. Must happen after setting the target flags. +set(CMAKE_FOLDER "orc-rt") #=============================================================================== # Setup Source Code #=============================================================================== +add_subdirectory(include) add_subdirectory(lib) add_subdirectory(tools) diff --git a/orc-rt/include/CMakeLists.txt b/orc-rt/include/CMakeLists.txt new file mode 100644 index 0000000000000..9137e5823fe25 --- /dev/null +++ b/orc-rt/include/CMakeLists.txt @@ -0,0 +1,16 @@ +set(files + orc-rt-c/orc-rt.h +) + +add_library(orc-rt-headers INTERFACE) +target_include_directories(orc-rt-headers INTERFACE + $ + $ +) +target_sources(orc-rt-headers + INTERFACE FILE_SET HEADERS + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + FILES ${files} +) +install(TARGETS orc-rt-headers + FILE_SET HEADERS DESTINATION include) diff --git a/orc-rt/lib/CMakeLists.txt b/orc-rt/lib/CMakeLists.txt index 6080b84a51fca..993f2b8b52eb7 100644 --- a/orc-rt/lib/CMakeLists.txt +++ b/orc-rt/lib/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(prelink) +add_subdirectory(executor) diff --git a/orc-rt/lib/executor/CMakeLists.txt b/orc-rt/lib/executor/CMakeLists.txt new file mode 100644 index 0000000000000..82d29455eb6df --- /dev/null +++ b/orc-rt/lib/executor/CMakeLists.txt @@ -0,0 +1,13 @@ +set(files + orc-rt-executor.cpp + ) + +add_library(orc-rt-executor STATIC ${files}) +target_link_libraries(orc-rt-executor + PUBLIC orc-rt-headers + ) +install(TARGETS orc-rt-executor + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT OrcRT_Development + PUBLIC_HEADER DESTINATION include COMPONENT OrcRT_Development +) diff --git a/orc-rt/lib/prelink/orc-rt-prelink.cpp b/orc-rt/lib/executor/orc-rt-executor.cpp similarity index 100% rename from orc-rt/lib/prelink/orc-rt-prelink.cpp rename to orc-rt/lib/executor/orc-rt-executor.cpp diff --git a/orc-rt/lib/prelink/CMakeLists.txt b/orc-rt/lib/prelink/CMakeLists.txt deleted file mode 100644 index 4e951e7776436..0000000000000 --- a/orc-rt/lib/prelink/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(orc-rt-prelink STATIC orc-rt-prelink.cpp) diff --git a/orc-rt/tools/orc-executor/CMakeLists.txt b/orc-rt/tools/orc-executor/CMakeLists.txt index 7750afc61c4b8..f75849f087727 100644 --- a/orc-rt/tools/orc-executor/CMakeLists.txt +++ b/orc-rt/tools/orc-executor/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(orc-executor orc-executor.cpp) -target_link_libraries(orc-executor PRIVATE orc-rt-prelink) +target_link_libraries(orc-executor PRIVATE orc-rt-executor) target_include_directories(orc-executor PRIVATE ../../include) From bf1d910e6419751f5271e5f03ca9e275a1a36082 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 29 Oct 2024 07:48:23 +1100 Subject: [PATCH 04/25] Use '//' style comments. --- orc-rt/include/orc-rt-c/orc-rt.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/orc-rt/include/orc-rt-c/orc-rt.h b/orc-rt/include/orc-rt-c/orc-rt.h index fdc0fd29976d4..324d6dc05ec72 100644 --- a/orc-rt/include/orc-rt-c/orc-rt.h +++ b/orc-rt/include/orc-rt-c/orc-rt.h @@ -1,15 +1,14 @@ -/*===- orc-rt-c/orc-rt.h - Placeholder header for orc-rt ----------*- 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 *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* Placeholder header for initial orc-rt checkin *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===- orc-rt-c/orc-rt.h - Placeholder header for orc-rt ----------*- 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 +// +//===----------------------------------------------------------------------===// +// +// Placeholder header for initial orc-rt checkin. +// +//===----------------------------------------------------------------------===// #ifndef ORC_RT_C_ORC_RT_H #define ORC_RT_C_ORC_RT_H @@ -21,7 +20,7 @@ extern "C" { void orc_rt(void); #ifdef __cplusplus -} /* extern "C" */ +} // extern "C" #endif -#endif /* ORC_RT_C_ORC_RT_H */ +#endif // ORC_RT_C_ORC_RT_H From a2dde32bdde61aa15083d67e6e7762fe901fa8a3 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 29 Oct 2024 07:48:54 +1100 Subject: [PATCH 05/25] Add missing copyright header. --- orc-rt/lib/executor/orc-rt-executor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/orc-rt/lib/executor/orc-rt-executor.cpp b/orc-rt/lib/executor/orc-rt-executor.cpp index b97d9cd22a0a2..d70488d11d3fa 100644 --- a/orc-rt/lib/executor/orc-rt-executor.cpp +++ b/orc-rt/lib/executor/orc-rt-executor.cpp @@ -1,3 +1,15 @@ +//===- orc-rt-executor.cpp - Placeholder implementation for orc-rt --------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Placeholder implementation file for initial orc-rt checkin. +// +//===----------------------------------------------------------------------===// + #include extern "C" void orc_rt(void) { printf("hello, world!\n"); } From 79ed66862b9d74e25671fcaa744be620f8919d14 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 29 Oct 2024 07:49:15 +1100 Subject: [PATCH 06/25] Use 'install (DIRECTORY...' instead of file sets. --- orc-rt/include/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/orc-rt/include/CMakeLists.txt b/orc-rt/include/CMakeLists.txt index 9137e5823fe25..027317e28c8ce 100644 --- a/orc-rt/include/CMakeLists.txt +++ b/orc-rt/include/CMakeLists.txt @@ -1,4 +1,4 @@ -set(files +set(ORC_RT_HEADERS orc-rt-c/orc-rt.h ) @@ -7,10 +7,10 @@ target_include_directories(orc-rt-headers INTERFACE $ $ ) -target_sources(orc-rt-headers - INTERFACE FILE_SET HEADERS - BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} - FILES ${files} +set_property(TARGET orc-rt-headers + PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS} +) +install(DIRECTORY ./ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ + FILES_MATCHING PATTERN "*.h" ) -install(TARGETS orc-rt-headers - FILE_SET HEADERS DESTINATION include) From cc39f2415b0fbc2e6376057b4149e14986f59f6d Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 29 Oct 2024 07:50:57 +1100 Subject: [PATCH 07/25] Add missing copyright header. --- orc-rt/tools/orc-executor/orc-executor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/orc-rt/tools/orc-executor/orc-executor.cpp b/orc-rt/tools/orc-executor/orc-executor.cpp index 4a03ac64710d2..92bdd5bf5d53f 100644 --- a/orc-rt/tools/orc-executor/orc-executor.cpp +++ b/orc-rt/tools/orc-executor/orc-executor.cpp @@ -1,3 +1,15 @@ +//===- orc-executor.cpp - Placeholder implementation for orc-rt ----------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Placeholder implementation file for initial orc-rt checkin. +// +//===----------------------------------------------------------------------===// + #include "orc-rt-c/orc-rt.h" int main(int argc, char *argv[]) { From 8f5501b2a80c2a94330d6bb77c45246cd4678631 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 30 Oct 2024 14:43:38 -0700 Subject: [PATCH 08/25] Add license and documentation. --- orc-rt/CMakeLists.txt | 9 + orc-rt/CREDITS.TXT | 13 ++ orc-rt/LICENSE.TXT | 311 +++++++++++++++++++++++++++++++ orc-rt/docs/Building-ORC-RT.rst | 90 +++++++++ orc-rt/docs/CMakeLists.txt | 8 + orc-rt/docs/README.txt | 13 ++ orc-rt/docs/conf.py | 252 +++++++++++++++++++++++++ orc-rt/docs/index.rst | 66 +++++++ orc-rt/include/orc-rt-c/orc-rt.h | 6 + 9 files changed, 768 insertions(+) create mode 100644 orc-rt/CREDITS.TXT create mode 100644 orc-rt/LICENSE.TXT create mode 100644 orc-rt/docs/Building-ORC-RT.rst create mode 100644 orc-rt/docs/CMakeLists.txt create mode 100644 orc-rt/docs/README.txt create mode 100644 orc-rt/docs/conf.py create mode 100644 orc-rt/docs/index.rst diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index 2b170f51c861a..d411ee4cf761d 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -18,6 +18,11 @@ include(GNUInstallDirs) # Setup CMake Options #=============================================================================== +option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ${ORC_RT_INCLUDE_DOCS}) +option(ORC_RT_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) +option(ORC_RT_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) +option(ORC_RT_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) + set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -27,6 +32,10 @@ set(CMAKE_FOLDER "orc-rt") # Setup Source Code #=============================================================================== +if (ORC_RT_INCLUDE_DOCS) + add_subdirectory(docs) +endif() + add_subdirectory(include) add_subdirectory(lib) add_subdirectory(tools) diff --git a/orc-rt/CREDITS.TXT b/orc-rt/CREDITS.TXT new file mode 100644 index 0000000000000..51192b40d2731 --- /dev/null +++ b/orc-rt/CREDITS.TXT @@ -0,0 +1,13 @@ +This file is a partial list of people who have contributed to the LLVM +project. If you have contributed a patch or made some other contribution to +LLVM, please submit a patch to this file to add yourself, and it will be +done! + +The list is sorted by surname and formatted to allow easy grepping and +beautification by scripts. The fields are: name (N), email (E), web-address +(W), PGP key ID and fingerprint (P), description (D), snail-mail address +(S), and (I) IRC handle. + +N: Lang Hames +E: lhames@gmail.com +D: Initial code diff --git a/orc-rt/LICENSE.TXT b/orc-rt/LICENSE.TXT new file mode 100644 index 0000000000000..55b05e381cfdf --- /dev/null +++ b/orc-rt/LICENSE.TXT @@ -0,0 +1,311 @@ +============================================================================== +The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + +============================================================================== +Software from third parties included in the LLVM Project: +============================================================================== +The LLVM Project contains third party software which is under different license +terms. All such code will be identified clearly using at least one of two +mechanisms: +1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or +2) It will contain specific license and restriction terms at the top of every + file. + +============================================================================== +Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): +============================================================================== + +The orc-rt library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================== + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== + +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/orc-rt/docs/Building-ORC-RT.rst b/orc-rt/docs/Building-ORC-RT.rst new file mode 100644 index 0000000000000..505579a8e1f31 --- /dev/null +++ b/orc-rt/docs/Building-ORC-RT.rst @@ -0,0 +1,90 @@ +.. _Building_ORC_RT: + +================== +Building ORC-RT +================== + +.. contents:: + :local: + +.. _build instructions: + +Getting Started +=============== + +The basic steps needed to build orc-rt are: + +#. Checkout llvm-project: + + * ``cd where-you-want-llvm-to-live`` + * ``git clone https://github.com/llvm/llvm-project.git`` + +#. Configure and build orc-rt: + + CMake is the only supported configuration system. + + Clang is the preferred compiler when building and using orc-rt. + + * ``cd where you want to build llvm`` + * ``mkdir build`` + * ``cd build`` + * ``cmake -G -DLLVM_ENABLE_RUNTIMES=orc-rt [options] /runtimes`` + + For more information about configuring orc-rt see :ref:`CMake Options`. + + * ``make orc-rt`` --- will build orc-rt. + * ``make check-orc-rt`` --- will run the test suite. + + Shared and static libraries for orc-rt should now be present in + llvm/build/lib. + +#. **Optional**: Install orc-rt + + Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to select a safe + place to install orc-rt. + + * ``make install-orc-rt`` --- Will install the libraries and the headers + +.. _CMake Options: + +CMake Options +============= + +Here are some of the CMake variables that are used often, along with a +brief explanation and LLVM-specific notes. For full documentation, check the +CMake docs or execute ``cmake --help-variable VARIABLE_NAME``. + +**CMAKE_BUILD_TYPE**:STRING + Sets the build type for ``make`` based generators. Possible values are + Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio + the user sets the build type with the IDE settings. + +**CMAKE_INSTALL_PREFIX**:PATH + Path where LLVM will be installed if "make install" is invoked or the + "INSTALL" target is built. + +**CMAKE_CXX_COMPILER**:STRING + The C++ compiler to use when building and testing orc-rt. + +.. _orc-rt-specific options: + +orc-rt specific options +-------------------------- + +.. option:: ORC_RT_ENABLE_ASSERTIONS:BOOL + + **Default**: ``ON`` + + Toggle assertions independent of the build mode. + +.. option:: ORC_RT_ENABLE_PEDANTIC:BOOL + + **Default**: ``ON`` + + Compile with -Wpedantic. + +.. option:: ORC_RT_ENABLE_WERROR:BOOL + + **Default**: ``ON`` + + Compile with -Werror diff --git a/orc-rt/docs/CMakeLists.txt b/orc-rt/docs/CMakeLists.txt new file mode 100644 index 0000000000000..8709000c6254e --- /dev/null +++ b/orc-rt/docs/CMakeLists.txt @@ -0,0 +1,8 @@ +if (LLVM_ENABLE_SPHINX) + include(AddSphinxTarget) + if (SPHINX_FOUND) + if (${SPHINX_OUTPUT_HTML}) + add_sphinx_target(html orc-rt) + endif() + endif() +endif() diff --git a/orc-rt/docs/README.txt b/orc-rt/docs/README.txt new file mode 100644 index 0000000000000..067d026636eb0 --- /dev/null +++ b/orc-rt/docs/README.txt @@ -0,0 +1,13 @@ +ORC-RT Documentation +==================== + +The ORC-RT documentation is written using the Sphinx documentation generator. It is +currently tested with Sphinx 1.1.3. + +To build the documents into html configure ORC-RT with the following cmake options: + + * -DLLVM_ENABLE_SPHINX=ON + * -DORC_RT_INCLUDE_DOCS=ON + +After configuring ORC-RT with these options the make rule `docs-orc-rt-html` +should be available. diff --git a/orc-rt/docs/conf.py b/orc-rt/docs/conf.py new file mode 100644 index 0000000000000..17e77d021dc54 --- /dev/null +++ b/orc-rt/docs/conf.py @@ -0,0 +1,252 @@ +# -*- coding: utf-8 -*- +# +# orc-rt documentation build configuration file. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os +from datetime import date + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ["sphinx.ext.intersphinx", "sphinx.ext.todo"] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix of source filenames. +source_suffix = ".rst" + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = "orc-rt" +copyright = "2021-%d, LLVM Project" % date.today().year + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = "17.0" +# The full version, including alpha/beta/rc tags. +release = "17.0" + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = "%Y-%m-%d" + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "friendly" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "haiku" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = "orc-rt-doc" + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + #'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ("contents", "orc-rt.tex", "orc-rt Documentation", "LLVM project", "manual"), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [("contents", "orc-rt", "orc-rt Documentation", ["LLVM project"], 1)] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + "contents", + "orc-rt", + "orc-rt Documentation", + "LLVM project", + "orc-rt", + "LLVM ORC Runtime", + "Miscellaneous", + ), +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + + +# FIXME: Define intersphinx configuration. +intersphinx_mapping = {} + + +# -- Options for extensions ---------------------------------------------------- + +# Enable this if you want TODOs to show up in the generated documentation. +todo_include_todos = True diff --git a/orc-rt/docs/index.rst b/orc-rt/docs/index.rst new file mode 100644 index 0000000000000..70632605dd38d --- /dev/null +++ b/orc-rt/docs/index.rst @@ -0,0 +1,66 @@ +.. _index: + +======================= +LLVM ORC Runtime +======================= + +Overview +======== + +The ORC runtime provides executor-side support code for the LLVM ORC APIs. + +Getting Started with the ORC Runtime +------------------------------------ + +.. toctree:: + :maxdepth: 2 + + Building-ORC-RT + +Current Status +-------------- + +The ORC Runtime is a new, experimental project. It is being actively developed, +and neither the ABI nor API are stable. LLVM ORC API clients should be careful +to use an ORC Runtime from the same build as their LLVM ORC libraries. + +Platform and Compiler Support +----------------------------- + +* TOOD + +The following minimum compiler versions are strongly recommended. + +* Clang 16 and above + +Anything older *may* work. + +Notes and Known Issues +---------------------- + +* TODO + +Getting Involved +================ + +First please review our `Developer's Policy `__ +and `Getting started with LLVM `__. + +**Bug Reports** + +If you think you've found a bug in the ORC Runtime, please report it using +the `LLVM bug tracker`_. Please use the tag "orc-rt" for new threads. + +**Patches** + +If you want to contribute a patch to th ORC runtime, please start by reading the LLVM +`documentation about contributing `__. + +**Discussion and Questions** + +* TODO + +Quick Links +=========== +* `LLVM Homepage `_ +* `LLVM Bug Tracker `_ diff --git a/orc-rt/include/orc-rt-c/orc-rt.h b/orc-rt/include/orc-rt-c/orc-rt.h index 324d6dc05ec72..31ef74f6c1e9b 100644 --- a/orc-rt/include/orc-rt-c/orc-rt.h +++ b/orc-rt/include/orc-rt-c/orc-rt.h @@ -17,8 +17,14 @@ extern "C" { #endif +/// \addtogroup orc_rt_c_api orc-rt C APIs +/// @{ + void orc_rt(void); +/// @} +/// + #ifdef __cplusplus } // extern "C" #endif From b287829954c7fdeed302f57639a150bea02fad92 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 09:08:03 -0700 Subject: [PATCH 09/25] Remove CREDITS.TXT --- orc-rt/CREDITS.TXT | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 orc-rt/CREDITS.TXT diff --git a/orc-rt/CREDITS.TXT b/orc-rt/CREDITS.TXT deleted file mode 100644 index 51192b40d2731..0000000000000 --- a/orc-rt/CREDITS.TXT +++ /dev/null @@ -1,13 +0,0 @@ -This file is a partial list of people who have contributed to the LLVM -project. If you have contributed a patch or made some other contribution to -LLVM, please submit a patch to this file to add yourself, and it will be -done! - -The list is sorted by surname and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), snail-mail address -(S), and (I) IRC handle. - -N: Lang Hames -E: lhames@gmail.com -D: Initial code From 5104c8c3e58f5c400d0e6b1aa77586e421a00120 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 09:08:17 -0700 Subject: [PATCH 10/25] Remove legacy license text. --- orc-rt/LICENSE.TXT | 77 ---------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/orc-rt/LICENSE.TXT b/orc-rt/LICENSE.TXT index 55b05e381cfdf..53bb2e7fbc764 100644 --- a/orc-rt/LICENSE.TXT +++ b/orc-rt/LICENSE.TXT @@ -232,80 +232,3 @@ mechanisms: which apply to that software, or 2) It will contain specific license and restriction terms at the top of every file. - -============================================================================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): -============================================================================== - -The orc-rt library is dual licensed under both the University of Illinois -"BSD-Like" license and the MIT license. As a user of this code you may choose -to use it under either license. As a contributor, you agree to allow your code -to be used under both. - -Full text of the relevant licenses is included below. - -============================================================================== - -University of Illinois/NCSA -Open Source License - -Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT - -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - -============================================================================== - -Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. From 5b7ef87b40b3deaeba39307ba73d3dfddb9376b0 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 09:08:43 -0700 Subject: [PATCH 11/25] Fix default for ORC_RT_INCLUDE_DOCS option. --- orc-rt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index d411ee4cf761d..8417ae89b62d5 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -18,7 +18,7 @@ include(GNUInstallDirs) # Setup CMake Options #=============================================================================== -option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ${ORC_RT_INCLUDE_DOCS}) +option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ON) option(ORC_RT_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) option(ORC_RT_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(ORC_RT_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) From 1863fdd3f1c098f6b9ef93b9508f93126ebd5a5a Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 09:09:04 -0700 Subject: [PATCH 12/25] Switch docs from reStructuredText to markdown. --- ...Building-ORC-RT.rst => Building-orc-rt.md} | 36 +++------ orc-rt/docs/conf.py | 81 ++++++++++--------- orc-rt/docs/index.md | 54 +++++++++++++ orc-rt/docs/index.rst | 66 --------------- 4 files changed, 106 insertions(+), 131 deletions(-) rename orc-rt/docs/{Building-ORC-RT.rst => Building-orc-rt.md} (77%) create mode 100644 orc-rt/docs/index.md delete mode 100644 orc-rt/docs/index.rst diff --git a/orc-rt/docs/Building-ORC-RT.rst b/orc-rt/docs/Building-orc-rt.md similarity index 77% rename from orc-rt/docs/Building-ORC-RT.rst rename to orc-rt/docs/Building-orc-rt.md index 505579a8e1f31..091a405d907ab 100644 --- a/orc-rt/docs/Building-ORC-RT.rst +++ b/orc-rt/docs/Building-orc-rt.md @@ -1,25 +1,15 @@ -.. _Building_ORC_RT: +# Building orc-rt -================== -Building ORC-RT -================== - -.. contents:: - :local: - -.. _build instructions: - -Getting Started -=============== +## Getting Started The basic steps needed to build orc-rt are: -#. Checkout llvm-project: +* Checkout llvm-project: * ``cd where-you-want-llvm-to-live`` * ``git clone https://github.com/llvm/llvm-project.git`` -#. Configure and build orc-rt: +* Configure and build orc-rt: CMake is the only supported configuration system. @@ -38,17 +28,14 @@ The basic steps needed to build orc-rt are: Shared and static libraries for orc-rt should now be present in llvm/build/lib. -#. **Optional**: Install orc-rt +* **Optional**: Install orc-rt Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to select a safe place to install orc-rt. * ``make install-orc-rt`` --- Will install the libraries and the headers -.. _CMake Options: - -CMake Options -============= +## CMake Options Here are some of the CMake variables that are used often, along with a brief explanation and LLVM-specific notes. For full documentation, check the @@ -66,24 +53,21 @@ CMake docs or execute ``cmake --help-variable VARIABLE_NAME``. **CMAKE_CXX_COMPILER**:STRING The C++ compiler to use when building and testing orc-rt. -.. _orc-rt-specific options: - -orc-rt specific options --------------------------- +## orc-rt specific options -.. option:: ORC_RT_ENABLE_ASSERTIONS:BOOL +* option:: ORC_RT_ENABLE_ASSERTIONS:BOOL **Default**: ``ON`` Toggle assertions independent of the build mode. -.. option:: ORC_RT_ENABLE_PEDANTIC:BOOL +* option:: ORC_RT_ENABLE_PEDANTIC:BOOL **Default**: ``ON`` Compile with -Wpedantic. -.. option:: ORC_RT_ENABLE_WERROR:BOOL +* option:: ORC_RT_ENABLE_WERROR:BOOL **Default**: ``ON`` diff --git a/orc-rt/docs/conf.py b/orc-rt/docs/conf.py index 17e77d021dc54..a33ec439f8388 100644 --- a/orc-rt/docs/conf.py +++ b/orc-rt/docs/conf.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -# -# orc-rt documentation build configuration file. +# Orc-Rt documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # @@ -10,9 +9,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os from datetime import date - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -22,16 +19,32 @@ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' - # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.intersphinx", "sphinx.ext.todo"] +extensions = [ + "sphinx.ext.todo", + "sphinx.ext.mathjax", + "sphinx.ext.intersphinx", + "sphinx.ext.autodoc", +] + +# When building man pages, we do not use the markdown pages, +# So, we can continue without the myst_parser dependencies. +# Doing so reduces dependencies of some packaged llvm distributions. +try: + import myst_parser + + extensions.append("myst_parser") +except ImportError: + if not tags.has("builder-man"): + raise + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] +myst_heading_anchors = 6 -# The suffix of source filenames. -source_suffix = ".rst" +import sphinx # The encoding of source files. # source_encoding = 'utf-8-sig' @@ -40,17 +53,19 @@ master_doc = "index" # General information about the project. -project = "orc-rt" -copyright = "2021-%d, LLVM Project" % date.today().year +project = "Orc-Rt" +copyright = "2017-%d, The Orc-Rt Team" % date.today().year # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the -# built documents. +# built documents. These are currently set to zero because we don't use them. +# Should somebody consider in the future to change them, they need to be updated +# everytime a new release comes out. # -# The short X.Y version. -version = "17.0" +# The short version. +# version = '0' # The full version, including alpha/beta/rc tags. -release = "17.0" +# release = '0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -60,11 +75,11 @@ # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. -today_fmt = "%Y-%m-%d" +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ["_build"] +exclude_patterns = ["_build", "analyzer", "FIR/*"] # The reST default role (used for this markup: `text`) to use for all documents. # default_role = None @@ -78,7 +93,7 @@ # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -show_authors = True +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "friendly" @@ -103,7 +118,7 @@ # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -# html_title = None +html_title = "ORC Runtime" # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None @@ -120,11 +135,11 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = [] +# html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = "%b %d, %Y" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -166,6 +181,9 @@ # Output file base name for HTML help builder. htmlhelp_basename = "orc-rt-doc" +# If true, the reST sources are included in the HTML build as +# _sources/name. The default is True. +html_copy_source = False # -- Options for LaTeX output -------------------------------------------------- @@ -181,7 +199,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("contents", "orc-rt.tex", "orc-rt Documentation", "LLVM project", "manual"), + ("Overview", "Orc-Rt.tex", "orc-rt Documentation", "The orc-rt Team", + "manual"), ] # The name of an image file (relative to this directory) to place at the top of @@ -209,7 +228,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [("contents", "orc-rt", "orc-rt Documentation", ["LLVM project"], 1)] +man_pages = [] # If true, show URL addresses after external links. # man_show_urls = False @@ -222,13 +241,7 @@ # dir menu entry, description, category) texinfo_documents = [ ( - "contents", - "orc-rt", - "orc-rt Documentation", - "LLVM project", - "orc-rt", - "LLVM ORC Runtime", - "Miscellaneous", + "Overview", ), ] @@ -240,13 +253,3 @@ # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' - - -# FIXME: Define intersphinx configuration. -intersphinx_mapping = {} - - -# -- Options for extensions ---------------------------------------------------- - -# Enable this if you want TODOs to show up in the generated documentation. -todo_include_todos = True diff --git a/orc-rt/docs/index.md b/orc-rt/docs/index.md new file mode 100644 index 0000000000000..56f9bb3829c17 --- /dev/null +++ b/orc-rt/docs/index.md @@ -0,0 +1,54 @@ +# LLVM ORC Runtime + +## Overview + +The ORC runtime provides executor-side support code for the LLVM ORC APIs. + +```{eval-rst} +.. toctree:: + :titlesonly: + + Building-orc-rt +``` + +### Current Status + +The ORC Runtime is a new, experimental project. It is being actively developed, +and neither the ABI nor API are stable. LLVM ORC API clients should be careful +to use an ORC Runtime from the same build as their LLVM ORC libraries. + +### Platform and Compiler Support + +* TODO + +The following minimum compiler versions are strongly recommended. + +* Clang 16 and above + +Anything older *may* work. + +### Notes and Known Issues + +* TODO + +## Getting Involved + +First please review our +[Developer's Policy](https://llvm.org/docs/DeveloperPolicy.html) and +[Getting started with LLVM](https://llvm.org/docs/GettingStarted.html). + +**Bug Reports** + +If you think you've found a bug in the ORC Runtime, please report it using +the [LLVM bug tracker](https://github.com/llvm/llvm-project/labels/orc-rt/). +Please use the tag "orc-rt" for new threads. + +**Patches** + +If you want to contribute a patch to th ORC runtime, please start by reading +the LLVM +[documentation about contributing](https://www.llvm.org/docs/Contributing.html). + +**Discussion and Questions** + +* TODO diff --git a/orc-rt/docs/index.rst b/orc-rt/docs/index.rst deleted file mode 100644 index 70632605dd38d..0000000000000 --- a/orc-rt/docs/index.rst +++ /dev/null @@ -1,66 +0,0 @@ -.. _index: - -======================= -LLVM ORC Runtime -======================= - -Overview -======== - -The ORC runtime provides executor-side support code for the LLVM ORC APIs. - -Getting Started with the ORC Runtime ------------------------------------- - -.. toctree:: - :maxdepth: 2 - - Building-ORC-RT - -Current Status --------------- - -The ORC Runtime is a new, experimental project. It is being actively developed, -and neither the ABI nor API are stable. LLVM ORC API clients should be careful -to use an ORC Runtime from the same build as their LLVM ORC libraries. - -Platform and Compiler Support ------------------------------ - -* TOOD - -The following minimum compiler versions are strongly recommended. - -* Clang 16 and above - -Anything older *may* work. - -Notes and Known Issues ----------------------- - -* TODO - -Getting Involved -================ - -First please review our `Developer's Policy `__ -and `Getting started with LLVM `__. - -**Bug Reports** - -If you think you've found a bug in the ORC Runtime, please report it using -the `LLVM bug tracker`_. Please use the tag "orc-rt" for new threads. - -**Patches** - -If you want to contribute a patch to th ORC runtime, please start by reading the LLVM -`documentation about contributing `__. - -**Discussion and Questions** - -* TODO - -Quick Links -=========== -* `LLVM Homepage `_ -* `LLVM Bug Tracker `_ From 0f0c505fdbf517d7eb295cd86daf7096ad60b191 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 10:21:48 -0700 Subject: [PATCH 13/25] Silence python linter. --- orc-rt/docs/conf.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/orc-rt/docs/conf.py b/orc-rt/docs/conf.py index a33ec439f8388..043c8d85157cf 100644 --- a/orc-rt/docs/conf.py +++ b/orc-rt/docs/conf.py @@ -10,6 +10,7 @@ # serve to show the default. from datetime import date + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -199,8 +200,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("Overview", "Orc-Rt.tex", "orc-rt Documentation", "The orc-rt Team", - "manual"), + ("Overview", "Orc-Rt.tex", "orc-rt Documentation", "The orc-rt Team", "manual"), ] # The name of an image file (relative to this directory) to place at the top of @@ -240,9 +240,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ( - "Overview", - ), + ( "Overview" ), ] # Documents to append as an appendix to all manuals. From d4eaaf92f1d38619dbe851dd8029543ec291368f Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 31 Oct 2024 10:53:06 -0700 Subject: [PATCH 14/25] Python linter is persnickety. --- orc-rt/docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/docs/conf.py b/orc-rt/docs/conf.py index 043c8d85157cf..27196806abf65 100644 --- a/orc-rt/docs/conf.py +++ b/orc-rt/docs/conf.py @@ -240,7 +240,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ( "Overview" ), + ("Overview"), ] # Documents to append as an appendix to all manuals. From 52eccfe722ef5f702f4cf1031e770b9a858dc204 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 3 Mar 2025 15:23:40 +1100 Subject: [PATCH 15/25] Update orc-rt/docs/Building-orc-rt.md Co-authored-by: Ben Boeckel --- orc-rt/docs/Building-orc-rt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/docs/Building-orc-rt.md b/orc-rt/docs/Building-orc-rt.md index 091a405d907ab..69dbe7f3f3141 100644 --- a/orc-rt/docs/Building-orc-rt.md +++ b/orc-rt/docs/Building-orc-rt.md @@ -30,7 +30,7 @@ The basic steps needed to build orc-rt are: * **Optional**: Install orc-rt - Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to select a safe + Remember to use the CMake option ``CMAKE_INSTALL_PREFIX`` to select a safe place to install orc-rt. * ``make install-orc-rt`` --- Will install the libraries and the headers From 02601b347343fcfd9afe32c27bfb584e637b339a Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 4 Mar 2025 10:39:45 +1100 Subject: [PATCH 16/25] [ORC-RT][docs] Fix copyright year and project name capitalization. --- orc-rt/docs/conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/orc-rt/docs/conf.py b/orc-rt/docs/conf.py index 27196806abf65..b9f197d85b847 100644 --- a/orc-rt/docs/conf.py +++ b/orc-rt/docs/conf.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Orc-Rt documentation build configuration file. +# ORC-RT documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # @@ -54,8 +54,8 @@ master_doc = "index" # General information about the project. -project = "Orc-Rt" -copyright = "2017-%d, The Orc-Rt Team" % date.today().year +project = "ORC-RT" +copyright = "2025-%d, The ORC-RT Team" % date.today().year # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -200,7 +200,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("Overview", "Orc-Rt.tex", "orc-rt Documentation", "The orc-rt Team", "manual"), + ("Overview", "ORC-RT.tex", "orc-rt Documentation", "The orc-rt Team", "manual"), ] # The name of an image file (relative to this directory) to place at the top of From bacab48d2be15bc35ce001c87e7126da79eb22e3 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 4 Mar 2025 01:02:10 +0000 Subject: [PATCH 17/25] [ORC-RT] Update sphinx version. --- orc-rt/docs/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/docs/README.txt b/orc-rt/docs/README.txt index 067d026636eb0..da202c5fa8391 100644 --- a/orc-rt/docs/README.txt +++ b/orc-rt/docs/README.txt @@ -2,7 +2,7 @@ ORC-RT Documentation ==================== The ORC-RT documentation is written using the Sphinx documentation generator. It is -currently tested with Sphinx 1.1.3. +currently tested with Sphinx 5.3.0. To build the documents into html configure ORC-RT with the following cmake options: From e820a82785cf9a9e84a6cc8dc3bca5225a6221be Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 4 Mar 2025 01:27:27 +0000 Subject: [PATCH 18/25] [ORC-RT] Add TODO to switch to filesets when we can. --- orc-rt/include/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/orc-rt/include/CMakeLists.txt b/orc-rt/include/CMakeLists.txt index 027317e28c8ce..3546b3a3a9089 100644 --- a/orc-rt/include/CMakeLists.txt +++ b/orc-rt/include/CMakeLists.txt @@ -2,6 +2,7 @@ set(ORC_RT_HEADERS orc-rt-c/orc-rt.h ) +# TODO: Switch to filesets when we move to cmake-3.23. add_library(orc-rt-headers INTERFACE) target_include_directories(orc-rt-headers INTERFACE $ From eb3f58c0b256da4448ca31a2bad55f2fc276a9b3 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 14 May 2025 07:56:09 +0000 Subject: [PATCH 19/25] Specify COMPONENT for headers, use 'install(TARGETS ...' rather than 'install(HEADERS ...'. --- orc-rt/include/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orc-rt/include/CMakeLists.txt b/orc-rt/include/CMakeLists.txt index 3546b3a3a9089..cd2032f3a5cdf 100644 --- a/orc-rt/include/CMakeLists.txt +++ b/orc-rt/include/CMakeLists.txt @@ -11,7 +11,7 @@ target_include_directories(orc-rt-headers INTERFACE set_property(TARGET orc-rt-headers PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS} ) -install(DIRECTORY ./ +install(TARGETS orc-rt-headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ - FILES_MATCHING PATTERN "*.h" + COMPONENT OrcRT_Development ) From 7e3867c4566371e20a73c3b766dede6b63da6a2e Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 14 May 2025 07:57:39 +0000 Subject: [PATCH 20/25] Rename project LibOrcRT -> OrcRT. --- orc-rt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index 8417ae89b62d5..7446d078d879e 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -10,7 +10,7 @@ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake NO_POLICY_SCOPE) -project(LibOrcRT LANGUAGES C CXX ASM) +project(OrcRT LANGUAGES C CXX ASM) include(GNUInstallDirs) From ac62fe5e749d204b258612db362f805ad977eb3b Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 14 May 2025 08:03:31 +0000 Subject: [PATCH 21/25] Remove unnecessary target_include_directories(...) --- orc-rt/tools/orc-executor/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/orc-rt/tools/orc-executor/CMakeLists.txt b/orc-rt/tools/orc-executor/CMakeLists.txt index f75849f087727..b4a2292f58173 100644 --- a/orc-rt/tools/orc-executor/CMakeLists.txt +++ b/orc-rt/tools/orc-executor/CMakeLists.txt @@ -1,3 +1,2 @@ add_executable(orc-executor orc-executor.cpp) target_link_libraries(orc-executor PRIVATE orc-rt-executor) -target_include_directories(orc-executor PRIVATE ../../include) From d8f0ee67e50629dcc8b9db0a7dce68351be8a1bb Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Fri, 1 Aug 2025 16:24:46 +1000 Subject: [PATCH 22/25] Adding ways to find utils during a RT build --- orc-rt/CMakeLists.txt | 57 ++++++++++++++++++++++++++- orc-rt/test/CMakeLists.txt | 38 ++++++++++++++++++ orc-rt/test/init.test | 1 + orc-rt/test/lit.cfg.py | 60 +++++++++++++++++++++++++++++ orc-rt/test/lit.site.cfg.py.in | 23 +++++++++++ orc-rt/test/unit/lit.cfg.py | 22 +++++++++++ orc-rt/test/unit/lit.site.cfg.py.in | 17 ++++++++ orc-rt/unittests/CMakeLists.txt | 11 ++++++ orc-rt/unittests/init.cpp | 6 +++ runtimes/CMakeLists.txt | 3 +- 10 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 orc-rt/test/CMakeLists.txt create mode 100644 orc-rt/test/init.test create mode 100644 orc-rt/test/lit.cfg.py create mode 100644 orc-rt/test/lit.site.cfg.py.in create mode 100644 orc-rt/test/unit/lit.cfg.py create mode 100644 orc-rt/test/unit/lit.site.cfg.py.in create mode 100644 orc-rt/unittests/CMakeLists.txt create mode 100644 orc-rt/unittests/init.cpp diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index 7446d078d879e..9b70bae346ceb 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -6,10 +6,17 @@ cmake_minimum_required(VERSION 3.20.0) +option(LLVM_RT_INCLUDE_TESTS "Build orcrt tests." ${LLVM_INCLUDE_TESTS}) + + set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake NO_POLICY_SCOPE) +if (ORC_RT_INCLUDE_TESTS) + set(LLVM_INCLUDE_UTILS YES) +endif() + project(OrcRT LANGUAGES C CXX ASM) include(GNUInstallDirs) @@ -33,9 +40,57 @@ set(CMAKE_FOLDER "orc-rt") #=============================================================================== if (ORC_RT_INCLUDE_DOCS) - add_subdirectory(docs) + add_subdirectory(docs) endif() add_subdirectory(include) add_subdirectory(lib) add_subdirectory(tools) + +if(LLVM_INCLUDE_TESTS) + if(NOT TARGET FileCheck) + find_program(FILECHECK_EXE + NAMES FileCheck + HINTS ${LLVM_RT_TOOLS_BINARY_DIR} + DOC "FileCheck executable") + endif() + if(FILECHECK_EXE) + add_executable(FileCheck IMPORTED GLOBAL) + set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION "${FILECHECK_EXE}") + message(DEBUG "Using FileCheck: ${FILECHECK_EXE}") + endif() + if(NOT TARGET count) + find_program(COUNT_EXE + NAMES count + HINTS ${LLVM_RT_TOOLS_BINARY_DIR} + DOC "count executable") + endif() + if(COUNT_EXE) + add_executable(count IMPORTED GLOBAL) + set_property(TARGET count PROPERTY IMPORTED_LOCATION "${COUNT_EXE}") + message(DEBUG "Using count: ${COUNT_EXE}") + endif() + if(NOT TARGET not) + find_program(NOT_EXE + NAMES not + HINTS ${LLVM_RT_TOOLS_BINARY_DIR} + DOC "not executable") + endif() + if(NOT_EXE) + add_executable(not IMPORTED GLOBAL) + set_property(TARGET not PROPERTY IMPORTED_LOCATION "${NOT_EXE}") + message(DEBUG "Using not: ${NOT_EXE}") + endif() + + set(ORCRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(ORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + + add_subdirectory(test) + set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest) + if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h) + if (NOT TARGET gtest) + add_subdirectory(${UNITTEST_DIR} third-party/unittest) + endif() + add_subdirectory(unittests) + endif() +endif() \ No newline at end of file diff --git a/orc-rt/test/CMakeLists.txt b/orc-rt/test/CMakeLists.txt new file mode 100644 index 0000000000000..0de6b6b085a43 --- /dev/null +++ b/orc-rt/test/CMakeLists.txt @@ -0,0 +1,38 @@ +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py + ) + +list(APPEND ORC_RT_TEST_DEPS + FileCheck + count + not + orc-executor + ) + +add_custom_target(orc-rt-test-depends DEPENDS ${ORC_RT_TEST_DEPS}) +set_target_properties(orc-rt-test-depends PROPERTIES FOLDER "orc-rt/Tests") + +add_lit_testsuite(check-orc-rt "Running the ORCRT regression tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ORC_RT_TEST_DEPS} + ) + +add_lit_testsuites(ORC-RT ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${ORC_RT_TEST_DEPS} +) + +# Add orc-rt unit tests +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.cfg.py) + +add_lit_testsuite(check-orcrt-unit "Running orc-rt unittest suites" + ${CMAKE_CURRENT_BINARY_DIR}/unit + EXCLUDE_FROM_CHECK_ALL + DEPENDS OrcRTUnitTests) + diff --git a/orc-rt/test/init.test b/orc-rt/test/init.test new file mode 100644 index 0000000000000..eaa666ef75d79 --- /dev/null +++ b/orc-rt/test/init.test @@ -0,0 +1 @@ +RUN: orc-executor %s %s diff --git a/orc-rt/test/lit.cfg.py b/orc-rt/test/lit.cfg.py new file mode 100644 index 0000000000000..e55eabad9685e --- /dev/null +++ b/orc-rt/test/lit.cfg.py @@ -0,0 +1,60 @@ +# -*- Python -*- + +import os +import platform +import re +import subprocess +import tempfile + +import lit.formats +import lit.util + +from lit.llvm import llvm_config +from lit.llvm.subst import ToolSubst +from lit.llvm.subst import FindTool + + +# name: The name of this test suite. +config.name = "ORCRT" + +# TODO: Consolidate the logic for turning on the internal shell by default for all LLVM test suites. +# See https://github.com/llvm/llvm-project/issues/106636 for more details. +# +# We prefer the lit internal shell which provides a better user experience on failures +# unless the user explicitly disables it with LIT_USE_INTERNAL_SHELL=0 env var. +use_lit_shell = True +lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL") +if lit_shell_env: + use_lit_shell = lit.util.pythonize_bool(lit_shell_env) + +config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell) + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = [ + ".ll", + ".test", + ".c", +] +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) + +# test_exec_root: The root path where tests should be run. +config.test_exec_root = os.path.join(config.orcrt_obj_root, "test") +llvm_config.with_environment("PATH", os.path.join(config.orcrt_obj_root, "tools", "orc-executor"), append_path=True) +config.substitutions.append(("%PATH%", config.environment["PATH"])) +#config.substitutions.append(("%shlibext", config.llvm_shlib_ext)) +config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) +#config.substitutions.append(("%host_cxx", config.host_cxx)) +#config.substitutions.append(("%host_cc", config.host_cc)) +if (config.llvm_rt_tools_dir): + config.llvm_tools_dir = config.llvm_rt_tools_dir +llvm_config.use_default_substitutions() + + +# excludes: A list of directories to exclude from the testsuite. The 'Inputs' +# subdirectories contain auxiliary inputs for various tests in their parent +# directories. +config.excludes = [ + "lit.cfg.py", + "lit.site.cfg.py.in", +] diff --git a/orc-rt/test/lit.site.cfg.py.in b/orc-rt/test/lit.site.cfg.py.in new file mode 100644 index 0000000000000..708510e0d0044 --- /dev/null +++ b/orc-rt/test/lit.site.cfg.py.in @@ -0,0 +1,23 @@ +@LIT_SITE_CFG_IN_HEADER@ + +import sys + +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.orcrt_obj_root = "@ORCRT_BINARY_DIR@" +config.llvm_rt_tools_dir = "@LLVM_RT_TOOLS_BINARY_DIR@" +config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") +config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@") +config.llvm_shlib_dir = lit_config.substitute("@SHLIBDIR@") +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.host_triple = "@LLVM_HOST_TRIPLE@" +config.target_triple = "@LLVM_TARGET_TRIPLE@" +config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" +config.host_arch = "@HOST_ARCH@" +config.python_executable = "@Python3_EXECUTABLE@" +config.targets_to_build = "@ORCRT_TARGETS_TO_BUILD@" + +import lit.llvm +lit.llvm.initialize(lit_config, config) +# Let the main config do the real work. +lit_config.load_config(config, "@ORCRT_SOURCE_DIR@/test/lit.cfg.py") diff --git a/orc-rt/test/unit/lit.cfg.py b/orc-rt/test/unit/lit.cfg.py new file mode 100644 index 0000000000000..0a0a26672c2e3 --- /dev/null +++ b/orc-rt/test/unit/lit.cfg.py @@ -0,0 +1,22 @@ +# -*- Python -*- + +# Configuration file for the 'lit' test runner. + +import os +import subprocess + +import lit.formats + +# name: The name of this test suite. +config.name = "ORCRT-Unit" + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = [] + +# test_source_root: The root path where tests are located. +# test_exec_root: The root path where tests should be run. +config.test_exec_root = os.path.join(config.orcrt_obj_root, "unittests") +config.test_source_root = config.test_exec_root + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests") \ No newline at end of file diff --git a/orc-rt/test/unit/lit.site.cfg.py.in b/orc-rt/test/unit/lit.site.cfg.py.in new file mode 100644 index 0000000000000..1ffe100166910 --- /dev/null +++ b/orc-rt/test/unit/lit.site.cfg.py.in @@ -0,0 +1,17 @@ +@LIT_SITE_CFG_IN_HEADER@ + +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") +config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@") +config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@") +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.orcrt_obj_root = "@ORCRT_BINARY_DIR@" +config.target_triple = "@LLVM_TARGET_TRIPLE@" + +import lit.llvm +lit.llvm.initialize(lit_config, config) + +# Let the main config do the real work. +lit_config.load_config(config, "@ORCRT_SOURCE_DIR@/test/unit/lit.cfg.py") \ No newline at end of file diff --git a/orc-rt/unittests/CMakeLists.txt b/orc-rt/unittests/CMakeLists.txt new file mode 100644 index 0000000000000..4476d43ca4ae5 --- /dev/null +++ b/orc-rt/unittests/CMakeLists.txt @@ -0,0 +1,11 @@ +add_custom_target(OrcRTUnitTests) +set_target_properties(OrcRTUnitTests PROPERTIES FOLDER "orcrt/Tests") + +function(add_orc_rt_unittest test_dirname) + add_unittest(OrcRTUnitTests ${test_dirname} ${ARGN}) +endfunction() + +add_orc_rt_unittest(CoreTests + init.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + ) diff --git a/orc-rt/unittests/init.cpp b/orc-rt/unittests/init.cpp new file mode 100644 index 0000000000000..24f12127f49f5 --- /dev/null +++ b/orc-rt/unittests/init.cpp @@ -0,0 +1,6 @@ +#include "gtest/gtest.h" + + +TEST(TEST, emptyFuncs) { + ASSERT_EQ(True, False); +} diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index f60e9dbc569de..eb8f4704b1e67 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -44,7 +44,7 @@ if(LLVM_ENABLE_RUNTIMES STREQUAL "all" ) endif() include(SortSubset) sort_subset("${LLVM_SUPPORTED_RUNTIMES}" "${LLVM_ENABLE_RUNTIMES}" LLVM_ENABLE_RUNTIMES) - +set(LLVM_RT_TOOLS_BINARY_DIR ${LLVM_TOOLS_BINARY_DIR} CACHE STRING "runtime path to required test tools") foreach(proj ${LLVM_ENABLE_RUNTIMES}) set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}") if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt) @@ -267,7 +267,6 @@ foreach(entry ${runtimes}) # will be included under here. set(HAVE_${canon_name} ON) endforeach() - if(LLVM_INCLUDE_TESTS) # If built with the runtimes build (rooted at runtimes/CMakeLists.txt), we # won't have llvm-lit. If built with the bootstrapping build (rooted at From 8cf52ddbbf4a67254ecee74e14cb78b7a9c9468a Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 5 Aug 2025 10:29:28 +1000 Subject: [PATCH 23/25] Update lit.cfg.py to fix formatting. --- orc-rt/test/lit.cfg.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/orc-rt/test/lit.cfg.py b/orc-rt/test/lit.cfg.py index e55eabad9685e..93eacf972867c 100644 --- a/orc-rt/test/lit.cfg.py +++ b/orc-rt/test/lit.cfg.py @@ -40,13 +40,16 @@ # test_exec_root: The root path where tests should be run. config.test_exec_root = os.path.join(config.orcrt_obj_root, "test") -llvm_config.with_environment("PATH", os.path.join(config.orcrt_obj_root, "tools", "orc-executor"), append_path=True) +llvm_config.with_environment( + "PATH", + os.path.join(config.orcrt_obj_root, "tools", "orc-executor"), + append_path=True) config.substitutions.append(("%PATH%", config.environment["PATH"])) -#config.substitutions.append(("%shlibext", config.llvm_shlib_ext)) +# config.substitutions.append(("%shlibext", config.llvm_shlib_ext)) config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) -#config.substitutions.append(("%host_cxx", config.host_cxx)) -#config.substitutions.append(("%host_cc", config.host_cc)) -if (config.llvm_rt_tools_dir): +# config.substitutions.append(("%host_cxx", config.host_cxx)) +# config.substitutions.append(("%host_cc", config.host_cc)) +if config.llvm_rt_tools_dir: config.llvm_tools_dir = config.llvm_rt_tools_dir llvm_config.use_default_substitutions() From aa09297ed3486abbd1cc1884b35bfa80206a5859 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sat, 9 Aug 2025 14:14:02 +1000 Subject: [PATCH 24/25] Refactor testing rules: 1. If ORC_RT_LLVM_TOOLS_DIR is not defined but LLVM_BINARY_DIR is then the latter is used to set a value for ORC_RT_LLVM_TOOLS_DIR ("${LLVM_BINARY_DIR}/bin"). 2. If ORC_RT_LLVM_TOOLS_DIR is available it is used to find the testing tools (so far just `FileCheck` and `not`). 3. If the test tools are available then the check-orc-rt target is enabled. The lit config files have also been cut down, and the unit test updated to compile and return a passing result. --- orc-rt/CMakeLists.txt | 68 +++++++---------------------- orc-rt/cmake/OrcRTTesting.cmake | 36 +++++++++++++++ orc-rt/test/CMakeLists.txt | 51 ++++++++++++---------- orc-rt/test/lit.cfg.py | 53 +++------------------- orc-rt/test/lit.site.cfg.py.in | 15 ++----- orc-rt/test/unit/lit.cfg.py | 10 +++-- orc-rt/test/unit/lit.site.cfg.py.in | 15 +++---- orc-rt/unittests/CMakeLists.txt | 8 +++- orc-rt/unittests/init.cpp | 2 +- 9 files changed, 110 insertions(+), 148 deletions(-) create mode 100644 orc-rt/cmake/OrcRTTesting.cmake diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt index 9b70bae346ceb..77448185311da 100644 --- a/orc-rt/CMakeLists.txt +++ b/orc-rt/CMakeLists.txt @@ -6,19 +6,20 @@ cmake_minimum_required(VERSION 3.20.0) -option(LLVM_RT_INCLUDE_TESTS "Build orcrt tests." ${LLVM_INCLUDE_TESTS}) - - set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake NO_POLICY_SCOPE) -if (ORC_RT_INCLUDE_TESTS) - set(LLVM_INCLUDE_UTILS YES) -endif() - project(OrcRT LANGUAGES C CXX ASM) +list(INSERT CMAKE_MODULE_PATH 0 + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" + "${CMAKE_CURRENT_SOURCE_DIR}/../runtimes/cmake/Modules" + "${LLVM_COMMON_CMAKE_UTILS}" + "${LLVM_COMMON_CMAKE_UTILS}/Modules" + ) + include(GNUInstallDirs) #=============================================================================== @@ -29,12 +30,16 @@ option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ON) option(ORC_RT_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) option(ORC_RT_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(ORC_RT_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) +option(ORC_RT_INCLUDE_TESTS "Build ORC-RT tests." ${LLVM_INCLUDE_TESTS}) set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) set(CMAKE_FOLDER "orc-rt") +set(ORC_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(ORC_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + #=============================================================================== # Setup Source Code #=============================================================================== @@ -47,50 +52,7 @@ add_subdirectory(include) add_subdirectory(lib) add_subdirectory(tools) -if(LLVM_INCLUDE_TESTS) - if(NOT TARGET FileCheck) - find_program(FILECHECK_EXE - NAMES FileCheck - HINTS ${LLVM_RT_TOOLS_BINARY_DIR} - DOC "FileCheck executable") - endif() - if(FILECHECK_EXE) - add_executable(FileCheck IMPORTED GLOBAL) - set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION "${FILECHECK_EXE}") - message(DEBUG "Using FileCheck: ${FILECHECK_EXE}") - endif() - if(NOT TARGET count) - find_program(COUNT_EXE - NAMES count - HINTS ${LLVM_RT_TOOLS_BINARY_DIR} - DOC "count executable") - endif() - if(COUNT_EXE) - add_executable(count IMPORTED GLOBAL) - set_property(TARGET count PROPERTY IMPORTED_LOCATION "${COUNT_EXE}") - message(DEBUG "Using count: ${COUNT_EXE}") - endif() - if(NOT TARGET not) - find_program(NOT_EXE - NAMES not - HINTS ${LLVM_RT_TOOLS_BINARY_DIR} - DOC "not executable") - endif() - if(NOT_EXE) - add_executable(not IMPORTED GLOBAL) - set_property(TARGET not PROPERTY IMPORTED_LOCATION "${NOT_EXE}") - message(DEBUG "Using not: ${NOT_EXE}") - endif() - - set(ORCRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - set(ORCRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - +if(ORC_RT_INCLUDE_TESTS) add_subdirectory(test) - set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest) - if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h) - if (NOT TARGET gtest) - add_subdirectory(${UNITTEST_DIR} third-party/unittest) - endif() - add_subdirectory(unittests) - endif() -endif() \ No newline at end of file + add_subdirectory(unittests) +endif() diff --git a/orc-rt/cmake/OrcRTTesting.cmake b/orc-rt/cmake/OrcRTTesting.cmake new file mode 100644 index 0000000000000..0336538d9a5bd --- /dev/null +++ b/orc-rt/cmake/OrcRTTesting.cmake @@ -0,0 +1,36 @@ +# Keep track if we have all dependencies. +set(ORC_RT_LLVM_TOOLS_AVAILABLE TRUE) + +if (NOT DEFINED ORC_RT_LLVM_TOOLS_DIR AND DEFINED LLVM_BINARY_DIR) + cmake_path(APPEND ORC_RT_LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}" "bin") +endif() + +if (TARGET utils/llvm-lit/all) + list(APPEND utils/llvm-lit/all) +endif() + +# Add dependence on FileCheck. +if (TARGET FileCheck) + list(APPEND ORC_RT_TEST_DEPS FileCheck) +endif() + +find_program(ORC_RT_FILECHECK_EXECUTABLE + NAMES FileCheck + PATHS ${ORC_RT_LLVM_TOOLS_DIR}) +if (NOT ORC_RT_FILECHECK_EXECUTABLE) + message(STATUS "Cannot find FileCheck. Please put it in your PATH, set ORC_RT_FILECHECK_EXECUTABLE to its full path, or point ORC_RT_LLVM_TOOLS_DIR to its directory.") + set(ORC_RT_LLVM_TOOLS_AVAILABLE FALSE) +endif() + +# Add dependence on not. +if (TARGET not) + list(APPEND ORC_RT_TEST_DEPS not) +endif() + +find_program(ORC_RT_NOT_EXECUTABLE + NAMES not + PATHS ${ORC_RT_LLVM_TOOLS_DIR}) +if (NOT ORC_RT_NOT_EXECUTABLE) + message(STATUS "Cannot find 'not'. Please put it in your PATH, set ORC_RT_NOT_EXECUTABLE to its full path, or point ORC_RT_LLVM_TOOLS_DIR to its directory.") + set(ORC_RT_LLVM_TOOLS_AVAILABLE FALSE) +endif() diff --git a/orc-rt/test/CMakeLists.txt b/orc-rt/test/CMakeLists.txt index 0de6b6b085a43..211009f5c1dd5 100644 --- a/orc-rt/test/CMakeLists.txt +++ b/orc-rt/test/CMakeLists.txt @@ -1,37 +1,40 @@ -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py - MAIN_CONFIG - ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py - ) +include(OrcRTTesting) -list(APPEND ORC_RT_TEST_DEPS - FileCheck - count - not - orc-executor +if (ORC_RT_LLVM_TOOLS_AVAILABLE) + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ) -add_custom_target(orc-rt-test-depends DEPENDS ${ORC_RT_TEST_DEPS}) -set_target_properties(orc-rt-test-depends PROPERTIES FOLDER "orc-rt/Tests") - -add_lit_testsuite(check-orc-rt "Running the ORCRT regression tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ORC_RT_TEST_DEPS} + list(APPEND ORC_RT_TEST_DEPS + orc-executor ) -add_lit_testsuites(ORC-RT ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${ORC_RT_TEST_DEPS} -) + add_custom_target(orc-rt-test-depends DEPENDS ${ORC_RT_TEST_DEPS}) + set_target_properties(orc-rt-test-depends PROPERTIES FOLDER "orc-rt/tests") + + add_lit_testsuite(check-orc-rt "Running the ORC-RT regression tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ORC_RT_TEST_DEPS} + ) +else() + message(WARNING "ORC-RT testing tools missing (see cmake log for details). ORC-RT regression tests disabled.") +endif() -# Add orc-rt unit tests configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg + ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg.py MAIN_CONFIG - ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.cfg.py) + ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.cfg.py + ) + +# add_lit_testsuites(ORC-RT ${CMAKE_CURRENT_SOURCE_DIR} +# DEPENDS ${ORC_RT_TEST_DEPS} +# ) -add_lit_testsuite(check-orcrt-unit "Running orc-rt unittest suites" +add_lit_testsuite(check-orc-rt-unit "Running orc-rt unittest suites" ${CMAKE_CURRENT_BINARY_DIR}/unit EXCLUDE_FROM_CHECK_ALL DEPENDS OrcRTUnitTests) diff --git a/orc-rt/test/lit.cfg.py b/orc-rt/test/lit.cfg.py index 93eacf972867c..759d96e613978 100644 --- a/orc-rt/test/lit.cfg.py +++ b/orc-rt/test/lit.cfg.py @@ -1,63 +1,24 @@ # -*- Python -*- import os -import platform -import re -import subprocess -import tempfile import lit.formats import lit.util from lit.llvm import llvm_config from lit.llvm.subst import ToolSubst -from lit.llvm.subst import FindTool - -# name: The name of this test suite. -config.name = "ORCRT" - -# TODO: Consolidate the logic for turning on the internal shell by default for all LLVM test suites. -# See https://github.com/llvm/llvm-project/issues/106636 for more details. -# -# We prefer the lit internal shell which provides a better user experience on failures -# unless the user explicitly disables it with LIT_USE_INTERNAL_SHELL=0 env var. -use_lit_shell = True -lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL") -if lit_shell_env: - use_lit_shell = lit.util.pythonize_bool(lit_shell_env) - -config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell) - -# suffixes: A list of file extensions to treat as test files. +config.name = "ORC-RT" +config.test_format = lit.formats.ShTest() +config.test_source_root = os.path.dirname(__file__) +config.test_exec_root = os.path.join(config.orc_rt_obj_root, "test") config.suffixes = [ - ".ll", - ".test", - ".c", + ".test" ] -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) -# test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.orcrt_obj_root, "test") llvm_config.with_environment( "PATH", - os.path.join(config.orcrt_obj_root, "tools", "orc-executor"), + os.path.join(config.orc_rt_obj_root, "tools", "orc-executor"), append_path=True) -config.substitutions.append(("%PATH%", config.environment["PATH"])) -# config.substitutions.append(("%shlibext", config.llvm_shlib_ext)) -config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) -# config.substitutions.append(("%host_cxx", config.host_cxx)) -# config.substitutions.append(("%host_cc", config.host_cc)) -if config.llvm_rt_tools_dir: - config.llvm_tools_dir = config.llvm_rt_tools_dir -llvm_config.use_default_substitutions() - -# excludes: A list of directories to exclude from the testsuite. The 'Inputs' -# subdirectories contain auxiliary inputs for various tests in their parent -# directories. -config.excludes = [ - "lit.cfg.py", - "lit.site.cfg.py.in", -] +llvm_config.use_default_substitutions() diff --git a/orc-rt/test/lit.site.cfg.py.in b/orc-rt/test/lit.site.cfg.py.in index 708510e0d0044..2c6ce81821d35 100644 --- a/orc-rt/test/lit.site.cfg.py.in +++ b/orc-rt/test/lit.site.cfg.py.in @@ -4,20 +4,13 @@ import sys config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.orcrt_obj_root = "@ORCRT_BINARY_DIR@" -config.llvm_rt_tools_dir = "@LLVM_RT_TOOLS_BINARY_DIR@" -config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") -config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@") -config.llvm_shlib_dir = lit_config.substitute("@SHLIBDIR@") -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.orc_rt_obj_root = "@ORC_RT_BINARY_DIR@" config.host_triple = "@LLVM_HOST_TRIPLE@" config.target_triple = "@LLVM_TARGET_TRIPLE@" -config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -config.host_arch = "@HOST_ARCH@" -config.python_executable = "@Python3_EXECUTABLE@" -config.targets_to_build = "@ORCRT_TARGETS_TO_BUILD@" +config.llvm_tools_dir = "@ORC_RT_LLVM_TOOLS_DIR@" + import lit.llvm lit.llvm.initialize(lit_config, config) # Let the main config do the real work. -lit_config.load_config(config, "@ORCRT_SOURCE_DIR@/test/lit.cfg.py") +lit_config.load_config(config, "@ORC_RT_SOURCE_DIR@/test/lit.cfg.py") diff --git a/orc-rt/test/unit/lit.cfg.py b/orc-rt/test/unit/lit.cfg.py index 0a0a26672c2e3..e19cc7e6042b2 100644 --- a/orc-rt/test/unit/lit.cfg.py +++ b/orc-rt/test/unit/lit.cfg.py @@ -3,20 +3,22 @@ # Configuration file for the 'lit' test runner. import os -import subprocess import lit.formats +import lit.util + +from lit.llvm import llvm_config # name: The name of this test suite. -config.name = "ORCRT-Unit" +config.name = "ORC-RT-Unit" # suffixes: A list of file extensions to treat as test files. config.suffixes = [] # test_source_root: The root path where tests are located. # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.orcrt_obj_root, "unittests") +config.test_exec_root = os.path.join(config.orc_rt_obj_root, "unittests") config.test_source_root = config.test_exec_root # testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests") \ No newline at end of file +config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests") diff --git a/orc-rt/test/unit/lit.site.cfg.py.in b/orc-rt/test/unit/lit.site.cfg.py.in index 1ffe100166910..2c6ce81821d35 100644 --- a/orc-rt/test/unit/lit.site.cfg.py.in +++ b/orc-rt/test/unit/lit.site.cfg.py.in @@ -1,17 +1,16 @@ @LIT_SITE_CFG_IN_HEADER@ +import sys + config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") -config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@") -config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@") -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.orcrt_obj_root = "@ORCRT_BINARY_DIR@" +config.orc_rt_obj_root = "@ORC_RT_BINARY_DIR@" +config.host_triple = "@LLVM_HOST_TRIPLE@" config.target_triple = "@LLVM_TARGET_TRIPLE@" +config.llvm_tools_dir = "@ORC_RT_LLVM_TOOLS_DIR@" + import lit.llvm lit.llvm.initialize(lit_config, config) - # Let the main config do the real work. -lit_config.load_config(config, "@ORCRT_SOURCE_DIR@/test/unit/lit.cfg.py") \ No newline at end of file +lit_config.load_config(config, "@ORC_RT_SOURCE_DIR@/test/lit.cfg.py") diff --git a/orc-rt/unittests/CMakeLists.txt b/orc-rt/unittests/CMakeLists.txt index 4476d43ca4ae5..b091f83ed7e07 100644 --- a/orc-rt/unittests/CMakeLists.txt +++ b/orc-rt/unittests/CMakeLists.txt @@ -1,5 +1,11 @@ add_custom_target(OrcRTUnitTests) -set_target_properties(OrcRTUnitTests PROPERTIES FOLDER "orcrt/Tests") +set_target_properties(OrcRTUnitTests PROPERTIES FOLDER "orc-rt/Tests") + +if (NOT TARGET llvm_gtest) + message(WARNING "orc-rt unittests disabled due to GTest being unavailable; " + "Try LLVM_INSTALL_GTEST=ON for the LLVM build") + return () +endif () function(add_orc_rt_unittest test_dirname) add_unittest(OrcRTUnitTests ${test_dirname} ${ARGN}) diff --git a/orc-rt/unittests/init.cpp b/orc-rt/unittests/init.cpp index 24f12127f49f5..545564a92f4a3 100644 --- a/orc-rt/unittests/init.cpp +++ b/orc-rt/unittests/init.cpp @@ -2,5 +2,5 @@ TEST(TEST, emptyFuncs) { - ASSERT_EQ(True, False); + ASSERT_TRUE(true); } From bff8fd1cfafb3aa6c9c37619798f9b03332e883e Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 18 Aug 2025 17:54:21 +1000 Subject: [PATCH 25/25] Fix bug: target should be appended to ORC_RT_TEST_DEPS --- orc-rt/cmake/OrcRTTesting.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orc-rt/cmake/OrcRTTesting.cmake b/orc-rt/cmake/OrcRTTesting.cmake index 0336538d9a5bd..b26a02eede25e 100644 --- a/orc-rt/cmake/OrcRTTesting.cmake +++ b/orc-rt/cmake/OrcRTTesting.cmake @@ -6,7 +6,7 @@ if (NOT DEFINED ORC_RT_LLVM_TOOLS_DIR AND DEFINED LLVM_BINARY_DIR) endif() if (TARGET utils/llvm-lit/all) - list(APPEND utils/llvm-lit/all) + list(APPEND ORC_RT_TEST_DEPS utils/llvm-lit/all) endif() # Add dependence on FileCheck.