13 Commits

Author SHA1 Message Date
Lang Hames
3292edb7b4
[orc-rt] Add C and C++ APIs for WrapperFunctionResult. (#154927)
orc_rt_WrapperFunctionResult is a byte-buffer with inline storage and a
builtin error state. It is intended as a general purpose return type for
functions that return a serialized result (e.g. for communication across
ABIs or via IPC/RPC).

orc_rt_WrapperFunctionResult contains a small amount of inline storage,
allowing it to avoid heap-allocation for small return types (e.g. bools,
chars, pointers).
2025-08-22 21:18:30 +10:00
Lang Hames
d5af08a221
[orc-rt] Add inline specifier to orc_rt::make_error. (#154922)
Prevents linker errors for duplicate definitions when make_error is used
from more than one file.
2025-08-22 20:37:10 +10:00
Lang Hames
c1625fad02
[orc-rt] Rename unique_function to move_only_function. (#154888)
This will allow the ORC runtime and its clients to easily adopt the
c++-23 std::move_only_function type.
2025-08-22 15:26:10 +10:00
Lang Hames
6df9a13e40
[orc-rt] Use LLVM-style header naming scheme. (#154881)
This is more consistent with the rest of the LLVM project, and the
resulting names are closer to the types defined in each of the headers.
2025-08-22 14:28:02 +10:00
Lang Hames
273b6f2911
[orc-rt] Add orc_rt::unique_function. (#154874)
A bare-bones version of LLVM's unique_function: this behaves like a
std::unique_function, except that it supports move only callable types.
2025-08-22 12:19:15 +10:00
Lang Hames
3ce25abd4a
[orc-rt] Add error.h: structured error support. (#154869)
Adds support for the Error class, Expected class template, and related
APIs that will be used for error propagation and handling in the new ORC
runtime.

The implementations of these types are cut-down versions of similar APIs
in llvm/Support/Error.h. Most advice on llvm::Error and llvm::Expected
(e.g. from the LLVM Programmer's manual) applies equally to
orc_rt::Error and orc_rt::Expected.

Ported from the old ORC runtime at compiler-rt/lib/orc.
2025-08-22 11:53:47 +10:00
Lang Hames
9039b591d0 [orc-rt] Add rtti header and unit tests.
The orc-rt extensible RTTI mechanism is used to provide simple dynamic RTTI
checks for orc-rt types that do not depend on standard C++ RTTI (meaning that
they will work equally well for programs compiled with -fno-rtti).
2025-08-21 18:59:46 +10:00
Lang Hames
ca0a8d99bb [orc-rt] Add bitmask-enum helper utilities.
ORC_RT_MARK_AS_BITMASK_ENUM and ORC_RT_DECLARE_ENUM_AS_BITMASK can be used to
easily add support for bitmask operators (&, |, ^, ~) to enum types.

This code was derived from LLVM's include/llvm/ADT/BitmaskEnum.h header.
2025-08-21 18:59:46 +10:00
Lang Hames
2380d0ad1d [orc-rt] Add preliminary math.h header and basic operations.
The initial operations, isPowerOf2 and nextPowerOf2 will be used in an upcoming
patch to add support for bitmask-enums.
2025-08-21 18:59:46 +10:00
Lang Hames
8a10fbb2cb [orc-rt] Expand span.h file comment. NFC. 2025-08-21 18:59:46 +10:00
Lang Hames
70e41a2ab1
[orc-rt] Add orc_rt::span, a pre-c++20 std::span substitute (#154478)
This patch introduces an orc_rt::span class template that the ORC
runtime can use until we're able to move to c++20.
2025-08-20 17:28:02 +10:00
Lang Hames
c6fbd12226
[orc-rt] Fix unit tests. (#154469)
orc-rt/test/unit/lit.site.cfg.py.in was pointing to the lit.cfg.py file for the
regression tests, causing the `check-orc-rt-unit` target to re-run the
regression tests rather than running the unit tests.
2025-08-20 14:51:13 +10:00
Lang Hames
ee7a6a45bd
[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
2025-08-19 10:56:18 +10:00