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

Includes CMake files and placeholder header, library, test tool, regression
test and unit test.

The aim for this project is to create a replacement for the existing ORC
Runtime that currently resides in `llvm-project/compiler-rt/lib/orc`. The new
project will provide a superset of the original features, and the old runtime
will be removed once the new runtime is sufficiently developed.

See discussion at
https://discourse.llvm.org/t/rfc-move-orc-executor-support-into-top-level-project/81049
This commit is contained in:
Lang Hames 2025-08-19 10:56:18 +10:00 committed by GitHub
parent 1dac302ce7
commit ee7a6a45bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 979 additions and 4 deletions

View File

@ -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")

View File

@ -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)

58
orc-rt/CMakeLists.txt Normal file
View File

@ -0,0 +1,58 @@
# 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(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)
#===============================================================================
# Setup CMake Options
#===============================================================================
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
#===============================================================================
if (ORC_RT_INCLUDE_DOCS)
add_subdirectory(docs)
endif()
add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(tools)
if(ORC_RT_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
endif()

234
orc-rt/LICENSE.TXT Normal file
View File

@ -0,0 +1,234 @@
==============================================================================
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.

View File

@ -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 ORC_RT_TEST_DEPS 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()

View File

@ -0,0 +1,74 @@
# Building orc-rt
## 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 <generator> -DLLVM_ENABLE_RUNTIMES=orc-rt [options] <llvm-monorepo>/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 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
## 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
* 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

View File

@ -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()

13
orc-rt/docs/README.txt Normal file
View File

@ -0,0 +1,13 @@
ORC-RT Documentation
====================
The ORC-RT documentation is written using the Sphinx documentation generator. It is
currently tested with Sphinx 5.3.0.
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.

253
orc-rt/docs/conf.py Normal file
View File

@ -0,0 +1,253 @@
# -*- 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.
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.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
import sphinx
# 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 = "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
# 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 version.
# version = '0'
# The full version, including alpha/beta/rc tags.
# release = '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 = '%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", "analyzer", "FIR/*"]
# 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 = False
# 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
# "<project> v<release> documentation".
html_title = "ORC Runtime"
# 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 <link> 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"
# 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 --------------------------------------------------
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 = [
("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
# 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 = []
# 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 = [
("Overview"),
]
# 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'

54
orc-rt/docs/index.md Normal file
View File

@ -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

View File

@ -0,0 +1,17 @@
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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_property(TARGET orc-rt-headers
PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS}
)
install(TARGETS orc-rt-headers
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/
COMPONENT OrcRT_Development
)

View File

@ -0,0 +1,32 @@
//===- 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
/// \addtogroup orc_rt_c_api orc-rt C APIs
/// @{
void orc_rt(void);
/// @}
///
#ifdef __cplusplus
} // extern "C"
#endif
#endif // ORC_RT_C_ORC_RT_H

View File

@ -0,0 +1 @@
add_subdirectory(executor)

View File

@ -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
)

View File

@ -0,0 +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 <stdio.h>
extern "C" void orc_rt(void) { printf("hello, world!\n"); }

View File

@ -0,0 +1,41 @@
include(OrcRTTesting)
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
)
list(APPEND ORC_RT_TEST_DEPS
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 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()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg.py
MAIN_CONFIG
${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-orc-rt-unit "Running orc-rt unittest suites"
${CMAKE_CURRENT_BINARY_DIR}/unit
EXCLUDE_FROM_CHECK_ALL
DEPENDS OrcRTUnitTests)

1
orc-rt/test/init.test Normal file
View File

@ -0,0 +1 @@
RUN: orc-executor %s %s

24
orc-rt/test/lit.cfg.py Normal file
View File

@ -0,0 +1,24 @@
# -*- Python -*-
import os
import lit.formats
import lit.util
from lit.llvm import llvm_config
from lit.llvm.subst import ToolSubst
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 = [
".test"
]
llvm_config.with_environment(
"PATH",
os.path.join(config.orc_rt_obj_root, "tools", "orc-executor"),
append_path=True)
llvm_config.use_default_substitutions()

View File

@ -0,0 +1,16 @@
@LIT_SITE_CFG_IN_HEADER@
import sys
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_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, "@ORC_RT_SOURCE_DIR@/test/lit.cfg.py")

View File

@ -0,0 +1,24 @@
# -*- Python -*-
# Configuration file for the 'lit' test runner.
import os
import lit.formats
import lit.util
from lit.llvm import llvm_config
# name: The name of this test suite.
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.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")

View File

@ -0,0 +1,16 @@
@LIT_SITE_CFG_IN_HEADER@
import sys
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_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, "@ORC_RT_SOURCE_DIR@/test/lit.cfg.py")

View File

@ -0,0 +1 @@
add_subdirectory(orc-executor)

View File

@ -0,0 +1,2 @@
add_executable(orc-executor orc-executor.cpp)
target_link_libraries(orc-executor PRIVATE orc-rt-executor)

View File

@ -0,0 +1,18 @@
//===- 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[]) {
orc_rt();
return 0;
}

View File

@ -0,0 +1,17 @@
add_custom_target(OrcRTUnitTests)
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})
endfunction()
add_orc_rt_unittest(CoreTests
init.cpp
DISABLE_LLVM_LINK_LLVM_DYLIB
)

View File

@ -0,0 +1,6 @@
#include "gtest/gtest.h"
TEST(TEST, emptyFuncs) {
ASSERT_TRUE(true);
}

View File

@ -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" )
@ -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