[compiler-rt] 232bd33 - [ORC-RT] Make the ORC runtime C API public.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 19:02:29 PDT 2022
Author: Lang Hames
Date: 2022-06-16T19:02:23-07:00
New Revision: 232bd331cbaa7e082a8d089018b12ed5d404078f
URL: https://github.com/llvm/llvm-project/commit/232bd331cbaa7e082a8d089018b12ed5d404078f
DIFF: https://github.com/llvm/llvm-project/commit/232bd331cbaa7e082a8d089018b12ed5d404078f.diff
LOG: [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
Added:
compiler-rt/include/orc/c_api.h
Modified:
compiler-rt/include/CMakeLists.txt
compiler-rt/lib/orc/common.h
compiler-rt/lib/orc/macho_ehframe_registration.cpp
compiler-rt/lib/orc/unittests/CMakeLists.txt
compiler-rt/lib/orc/unittests/c_api_test.cpp
compiler-rt/lib/orc/wrapper_function_utils.h
Removed:
compiler-rt/lib/orc/c_api.h
################################################################################
diff --git a/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt
index 20408714f5af6..3151b4753f225 100644
--- a/compiler-rt/include/CMakeLists.txt
+++ b/compiler-rt/include/CMakeLists.txt
@@ -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
diff --git a/compiler-rt/lib/orc/c_api.h b/compiler-rt/include/orc/c_api.h
similarity index 100%
rename from compiler-rt/lib/orc/c_api.h
rename to compiler-rt/include/orc/c_api.h
diff --git a/compiler-rt/lib/orc/common.h b/compiler-rt/lib/orc/common.h
index 54e613ecb42e6..61ac8b91c6e24 100644
--- a/compiler-rt/lib/orc/common.h
+++ b/compiler-rt/lib/orc/common.h
@@ -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
diff --git a/compiler-rt/lib/orc/macho_ehframe_registration.cpp b/compiler-rt/lib/orc/macho_ehframe_registration.cpp
index f077cea96820e..112f0dc390a64 100644
--- a/compiler-rt/lib/orc/macho_ehframe_registration.cpp
+++ b/compiler-rt/lib/orc/macho_ehframe_registration.cpp
@@ -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;
diff --git a/compiler-rt/lib/orc/unittests/CMakeLists.txt b/compiler-rt/lib/orc/unittests/CMakeLists.txt
index 32038dbecf19a..7ebcf153b0efd 100644
--- a/compiler-rt/lib/orc/unittests/CMakeLists.txt
+++ b/compiler-rt/lib/orc/unittests/CMakeLists.txt
@@ -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})
diff --git a/compiler-rt/lib/orc/unittests/c_api_test.cpp b/compiler-rt/lib/orc/unittests/c_api_test.cpp
index a14ea18a78dce..e013c2a9bce56 100644
--- a/compiler-rt/lib/orc/unittests/c_api_test.cpp
+++ b/compiler-rt/lib/orc/unittests/c_api_test.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "c_api.h"
+#include "orc/c_api.h"
#include "gtest/gtest.h"
TEST(CAPITest, CWrapperFunctionResultInit) {
diff --git a/compiler-rt/lib/orc/wrapper_function_utils.h b/compiler-rt/lib/orc/wrapper_function_utils.h
index 02ea37393276f..715fcef751393 100644
--- a/compiler-rt/lib/orc/wrapper_function_utils.h
+++ b/compiler-rt/lib/orc/wrapper_function_utils.h
@@ -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"
More information about the llvm-commits
mailing list