1//===- common.h - Common utilities for the ORC runtime ----------*- C++ -*-===//
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.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef ORC_RT_COMMON_H
14#define ORC_RT_COMMON_H
15
16#include "compiler.h"
17#include "orc_rt/c_api.h"
18#include <type_traits>
19
20/// This macro should be used to define tags that will be associated with
21/// handlers in the JIT process, and call can be used to define tags f
22#define ORC_RT_JIT_DISPATCH_TAG(X) \
23extern "C" char X; \
24char X = 0;
25
26/// Opaque struct for external symbols.
27struct __orc_rt_Opaque {};
28
29/// Error reporting function.
30extern "C" void __orc_rt_log_error(const char *ErrMsg);
31
32/// Context object for dispatching calls to the JIT object.
33///
34/// This is declared for use by the runtime, but should be implemented in the
35/// executor or provided by a definition added to the JIT before the runtime
36/// is loaded.
37ORC_RT_IMPORT __orc_rt_Opaque __orc_rt_jit_dispatch_ctx ORC_RT_WEAK_IMPORT;
38
39/// For dispatching calls to the JIT object.
40///
41/// This is declared for use by the runtime, but should be implemented in the
42/// executor or provided by a definition added to the JIT before the runtime
43/// is loaded.
44ORC_RT_IMPORT orc_rt_CWrapperFunctionResult
45__orc_rt_jit_dispatch(__orc_rt_Opaque *DispatchCtx, const void *FnTag,
46 const char *Data, size_t Size) ORC_RT_WEAK_IMPORT;
47
48#endif // ORC_RT_COMMON_H
49