1d89ec533Spatrick //===- common.h - Common utilities for the ORC runtime ----------*- C++ -*-===// 2d89ec533Spatrick // 3d89ec533Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4d89ec533Spatrick // See https://llvm.org/LICENSE.txt for license information. 5d89ec533Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6d89ec533Spatrick // 7d89ec533Spatrick //===----------------------------------------------------------------------===// 8d89ec533Spatrick // 9d89ec533Spatrick // This file is a part of the ORC runtime support library. 10d89ec533Spatrick // 11d89ec533Spatrick //===----------------------------------------------------------------------===// 12d89ec533Spatrick 13d89ec533Spatrick #ifndef ORC_RT_COMMON_H 14d89ec533Spatrick #define ORC_RT_COMMON_H 15d89ec533Spatrick 16d89ec533Spatrick #include "compiler.h" 17*810390e3Srobert #include "orc_rt/c_api.h" 18d89ec533Spatrick #include <type_traits> 19d89ec533Spatrick 20d89ec533Spatrick /// This macro should be used to define tags that will be associated with 21d89ec533Spatrick /// handlers in the JIT process, and call can be used to define tags f 22d89ec533Spatrick #define ORC_RT_JIT_DISPATCH_TAG(X) \ 23d89ec533Spatrick extern "C" char X; \ 24d89ec533Spatrick char X = 0; 25d89ec533Spatrick 26d89ec533Spatrick /// Opaque struct for external symbols. 27d89ec533Spatrick struct __orc_rt_Opaque {}; 28d89ec533Spatrick 29d89ec533Spatrick /// Error reporting function. 30d89ec533Spatrick extern "C" void __orc_rt_log_error(const char *ErrMsg); 31d89ec533Spatrick 32d89ec533Spatrick /// Context object for dispatching calls to the JIT object. 33d89ec533Spatrick /// 34d89ec533Spatrick /// This is declared for use by the runtime, but should be implemented in the 35d89ec533Spatrick /// executor or provided by a definition added to the JIT before the runtime 36d89ec533Spatrick /// is loaded. 37*810390e3Srobert ORC_RT_IMPORT __orc_rt_Opaque __orc_rt_jit_dispatch_ctx ORC_RT_WEAK_IMPORT; 38d89ec533Spatrick 39d89ec533Spatrick /// For dispatching calls to the JIT object. 40d89ec533Spatrick /// 41d89ec533Spatrick /// This is declared for use by the runtime, but should be implemented in the 42d89ec533Spatrick /// executor or provided by a definition added to the JIT before the runtime 43d89ec533Spatrick /// is loaded. 44*810390e3Srobert ORC_RT_IMPORT __orc_rt_CWrapperFunctionResult 45d89ec533Spatrick __orc_rt_jit_dispatch(__orc_rt_Opaque *DispatchCtx, const void *FnTag, 46d89ec533Spatrick const char *Data, size_t Size) ORC_RT_WEAK_IMPORT; 47d89ec533Spatrick 48d89ec533Spatrick #endif // ORC_RT_COMMON_H 49