[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / compiler-rt / lib / orc / dlfcn_wrapper.cpp
blob3d7da18e3045b9b088fa0820db0c9c6958423bca
1 //===- dlfcn_wrapper.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of the ORC runtime support library.
11 //===----------------------------------------------------------------------===//
13 #include "adt.h"
14 #include "common.h"
15 #include "wrapper_function_utils.h"
17 #include <vector>
19 using namespace orc_rt;
21 extern "C" const char *__orc_rt_jit_dlerror();
22 extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
23 extern "C" int __orc_rt_jit_dlupdate(void *dso_handle);
24 extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
26 ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
27 __orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
28 return WrapperFunction<SPSString()>::handle(
29 ArgData, ArgSize,
30 []() { return std::string(__orc_rt_jit_dlerror()); })
31 .release();
34 ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
35 __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
36 return WrapperFunction<SPSExecutorAddr(SPSString, int32_t)>::handle(
37 ArgData, ArgSize,
38 [](const std::string &Path, int32_t mode) {
39 return ExecutorAddr::fromPtr(
40 __orc_rt_jit_dlopen(Path.c_str(), mode));
42 .release();
45 #ifndef _WIN32
46 ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
47 __orc_rt_jit_dlupdate_wrapper(const char *ArgData, size_t ArgSize) {
48 return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
49 ArgData, ArgSize,
50 [](ExecutorAddr &DSOHandle) {
51 return __orc_rt_jit_dlupdate(DSOHandle.toPtr<void *>());
53 .release();
55 #endif
57 ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
58 __orc_rt_jit_dlclose_wrapper(const char *ArgData, size_t ArgSize) {
59 return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
60 ArgData, ArgSize,
61 [](ExecutorAddr &DSOHandle) {
62 return __orc_rt_jit_dlclose(DSOHandle.toPtr<void *>());
64 .release();