[ORC-RT] Make the ORC runtime C API public.

This is a first step towards allowing programs to pre-link against the ORC
runtime, which would allow us to move some code that is currently in the LLVM
OrcTarget library into the ORC runtime instead.

The C API header has limited utility as-is, but serves as a minimal first step
and provides clients with tools for interacting with wrapper functions.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D127324
This commit is contained in:
Lang Hames 2022-06-16 18:31:29 -07:00
parent 32bd0c1714
commit 232bd331cb
7 changed files with 17 additions and 5 deletions

View File

@ -35,6 +35,12 @@ if (COMPILER_RT_BUILD_XRAY)
)
endif(COMPILER_RT_BUILD_XRAY)
if (COMPILER_RT_BUILD_ORC)
set(ORC_HEADERS
orc/c_api.h
)
endif(COMPILER_RT_BUILD_ORC)
if (COMPILER_RT_BUILD_PROFILE)
set(PROFILE_HEADERS
profile/InstrProfData.inc
@ -46,6 +52,7 @@ set(COMPILER_RT_HEADERS
${FUZZER_HEADERS}
${MEMPROF_HEADERS}
${XRAY_HEADERS}
${ORC_HEADERS}
${PROFILE_HEADERS})
set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include)
@ -81,6 +88,11 @@ install(FILES ${XRAY_HEADERS}
COMPONENT compiler-rt-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/xray)
# Install ORC headers.
install(FILES ${ORC_HEADERS}
COMPONENT compiler-rt-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ${COMPILER_RT_INSTALL_INCLUDE_DIR}/orc)
# Install profile headers.
install(FILES ${PROFILE_HEADERS}
COMPONENT compiler-rt-headers

View File

@ -13,8 +13,8 @@
#ifndef ORC_RT_COMMON_H
#define ORC_RT_COMMON_H
#include "c_api.h"
#include "compiler.h"
#include "orc/c_api.h"
#include <type_traits>
/// This macro should be used to define tags that will be associated with

View File

@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "adt.h"
#include "c_api.h"
#include "common.h"
#include "executor_address.h"
#include "orc/c_api.h"
#include "wrapper_function_utils.h"
using namespace __orc_rt;

View File

@ -68,7 +68,7 @@ macro(add_orc_unittest testname)
OrcRTUnitTests "${testname}-${arch}-Test" "${arch}"
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
RUNTIME "${ORC_RUNTIME_LIBS}"
COMPILE_DEPS ${TEST_HEADERS}
COMPILE_DEPS ${TEST_HEADERS} ${ORC_HEADERS}
DEPS ${ORC_DEPS}
CFLAGS ${ORC_UNITTEST_CFLAGS}
LINK_FLAGS ${ORC_UNITTEST_LINK_FLAGS})

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
#include "c_api.h"
#include "orc/c_api.h"
#include "gtest/gtest.h"
TEST(CAPITest, CWrapperFunctionResultInit) {

View File

@ -13,7 +13,7 @@
#ifndef ORC_RT_WRAPPER_FUNCTION_UTILS_H
#define ORC_RT_WRAPPER_FUNCTION_UTILS_H
#include "c_api.h"
#include "orc/c_api.h"
#include "common.h"
#include "error.h"
#include "executor_address.h"