Skip to content

[ORC-RT] Initial check-in for a new, top-level ORC runtime project. #113499

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fb7698d
[ORC-RT] Initial check-in for a new, top-level ORC runtime project.
lhames Oct 23, 2024
f801afb
clang-format
lhames Oct 24, 2024
6011619
Simplify CMake files, add install support.
lhames Oct 27, 2024
81dc0e4
Use '//' style comments.
lhames Oct 28, 2024
7106b9d
Add missing copyright header.
lhames Oct 28, 2024
db27097
Use 'install (DIRECTORY...' instead of file sets.
lhames Oct 28, 2024
b0eb599
Add missing copyright header.
lhames Oct 28, 2024
400d2fc
Add license and documentation.
lhames Oct 30, 2024
4a03938
Remove CREDITS.TXT
lhames Oct 31, 2024
e872a8c
Remove legacy license text.
lhames Oct 31, 2024
bb5fb11
Fix default for ORC_RT_INCLUDE_DOCS option.
lhames Oct 31, 2024
267fd01
Switch docs from reStructuredText to markdown.
lhames Oct 31, 2024
327a64a
Silence python linter.
lhames Oct 31, 2024
0a25634
Python linter is persnickety.
lhames Oct 31, 2024
b348769
Update orc-rt/docs/Building-orc-rt.md
lhames Mar 3, 2025
7a3a185
[ORC-RT][docs] Fix copyright year and project name capitalization.
Mar 3, 2025
b804b1f
[ORC-RT] Update sphinx version.
lhames Mar 4, 2025
c57f7ce
[ORC-RT] Add TODO to switch to filesets when we can.
lhames Mar 4, 2025
e31c343
Specify COMPONENT for headers, use 'install(TARGETS ...' rather than
lhames May 14, 2025
e512c16
Rename project LibOrcRT -> OrcRT.
lhames May 14, 2025
91e73b1
Remove unnecessary target_include_directories(...)
lhames May 14, 2025
ea1955d
Adding ways to find utils during a RT build
jaredwy Aug 1, 2025
cab25e9
Merge branch 'main' into new-new-orc-rt
lhames Aug 4, 2025
3d624db
Update lit.cfg.py to fix formatting.
lhames Aug 5, 2025
124d7e4
Merge branch 'main' into new-new-orc-rt
lhames Aug 5, 2025
6957220
Merge branch 'main' into new-new-orc-rt
lhames Aug 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ endif()
# 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;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload")
set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;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")
Expand Down
2 changes: 2 additions & 0 deletions llvm/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -33,6 +34,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)
Expand Down
32 changes: 32 additions & 0 deletions orc-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CMake build for ORC-RT.

#===============================================================================
# Setup Project
#===============================================================================

cmake_minimum_required(VERSION 3.20.0)

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)

include(GNUInstallDirs)

#===============================================================================
# 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)
set(CMAKE_FOLDER "orc-rt")

#===============================================================================
# Setup Source Code
#===============================================================================

add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(tools)
16 changes: 16 additions & 0 deletions orc-rt/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(files
orc-rt-c/orc-rt.h
)

Copy link
Member

Choose a reason for hiding this comment

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

There should also be a custom command that copies every header in ORC_RT_HEADERS to output directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm…what's the reason here?

add_library(orc-rt-headers INTERFACE)
target_include_directories(orc-rt-headers INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_sources(orc-rt-headers
INTERFACE FILE_SET HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${files}
)
Copy link
Member

Choose a reason for hiding this comment

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

File Sets were introduced in CMake 3.23 but LLVM currently requires 3.20 as the minimum version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting that! I've switched to install (DIRECTORY ... in the latest commits -- Is that a reasonable solution for CMake 3.20?

install(TARGETS orc-rt-headers
FILE_SET HEADERS DESTINATION include)
27 changes: 27 additions & 0 deletions orc-rt/include/orc-rt-c/orc-rt.h
Original file line number Diff line number Diff line change
@@ -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 */
1 change: 1 addition & 0 deletions orc-rt/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(executor)
13 changes: 13 additions & 0 deletions orc-rt/lib/executor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
3 changes: 3 additions & 0 deletions orc-rt/lib/executor/orc-rt-executor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <stdio.h>

extern "C" void orc_rt(void) { printf("hello, world!\n"); }
1 change: 1 addition & 0 deletions orc-rt/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(orc-executor)
3 changes: 3 additions & 0 deletions orc-rt/tools/orc-executor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_executable(orc-executor orc-executor.cpp)
target_link_libraries(orc-executor PRIVATE orc-rt-executor)
target_include_directories(orc-executor PRIVATE ../../include)
6 changes: 6 additions & 0 deletions orc-rt/tools/orc-executor/orc-executor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "orc-rt-c/orc-rt.h"

int main(int argc, char *argv[]) {
orc_rt();
return 0;
}
2 changes: 1 addition & 1 deletion runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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;openmp;offload")
set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload;orc-rt")
set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc")
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
Expand Down
Loading