brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 9b2329f Raw
51 lines · c
1//===------ jit_dispatch.h - Call back to an ORC controller -----*- 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-exception6//7//===----------------------------------------------------------------------===//8//9// This file is a part of the ORC runtime support library.10//11//===----------------------------------------------------------------------===//12 13#ifndef ORC_RT_JIT_DISPATCH_H14#define ORC_RT_JIT_DISPATCH_H15 16#include "common.h"17#include "wrapper_function_utils.h"18 19namespace orc_rt {20 21class JITDispatch {22public:23  JITDispatch(const void *FnTag) : FnTag(FnTag) {}24 25  WrapperFunctionResult operator()(const char *ArgData, size_t ArgSize) {26    // Since the functions cannot be zero/unresolved on Windows, the following27    // reference taking would always be non-zero, thus generating a compiler28    // warning otherwise.29#if !defined(_WIN32)30    if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch_ctx))31      return WrapperFunctionResult::createOutOfBandError(32                 "__orc_rt_jit_dispatch_ctx not set")33          .release();34    if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch))35      return WrapperFunctionResult::createOutOfBandError(36                 "__orc_rt_jit_dispatch not set")37          .release();38#endif39 40    return __orc_rt_jit_dispatch(&__orc_rt_jit_dispatch_ctx, FnTag, ArgData,41                                 ArgSize);42  }43 44private:45  const void *FnTag;46};47 48} // namespace orc_rt49 50#endif // ORC_RT_JIT_DISPATCH_H51