clang 24.0.0git
OrcIncrementalExecutorBuilder.h
Go to the documentation of this file.
1//===-- OrcIncrementalExecutorBuilder.h - ORC Builder -----------*- 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 declares the builder for ORC incremental execution.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_INTERPRETER_ORCINCREMENTALEXECUTORBUILDER_H
14#define LLVM_CLANG_INTERPRETER_ORCINCREMENTALEXECUTORBUILDER_H
15
17#include "llvm/Support/CodeGen.h"
18
19#include <cstdint>
20#include <functional>
21#include <optional>
22
23namespace llvm::orc {
24class LLJITBuilder;
25}
26
27namespace clang {
28namespace driver {
29class Compilation;
30}
31
32/// Configuration for in-process and out-of-process ORC execution.
34public:
35 /// Indicates whether out-of-process JIT execution is enabled.
36 bool IsOutOfProcess = false;
37 /// Path to the out-of-process JIT executor.
38 std::string OOPExecutor = "";
39 std::string OOPExecutorConnect = "";
40 /// Indicates whether to use shared memory for communication.
41 bool UseSharedMemory = false;
42 /// Representing the slab allocation size for memory management in kb.
43 unsigned SlabAllocateSize = 0;
44 /// Path to the ORC runtime library.
45 std::string OrcRuntimePath = "";
46 /// PID of the out-of-process JIT executor.
48 /// Custom lambda to be executed inside child process/executor
49 std::function<void()> CustomizeFork = nullptr;
50 /// An optional code model to provide to the JITTargetMachineBuilder
51 std::optional<llvm::CodeModel::Model> CM = std::nullopt;
52 /// An optional external ORC JIT builder.
53 std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder;
54 /// A default callback that can be used in the IncrementalCompilerBuilder to
55 /// retrieve the path to the orc runtime.
56 std::function<llvm::Error(const driver::Compilation &)>
58 return UpdateOrcRuntimePath(C);
59 };
60
63
65 const Options &Opts) override;
66 bool supportsJIT() const override;
68
69private:
71 createExecutor(llvm::orc::ThreadSafeContext &TSC,
72 const clang::TargetInfo &TI) override;
73 llvm::Error UpdateOrcRuntimePath(const driver::Compilation &C);
74};
75
76} // namespace clang
77
78#endif // LLVM_CLANG_INTERPRETER_ORCINCREMENTALEXECUTORBUILDER_H
Create a pre-configured CompilerInstance for incremental processing.
Definition Interpreter.h:54
Common configuration and interface for incremental executor builders.
std::optional< llvm::CodeModel::Model > CM
An optional code model to provide to the JITTargetMachineBuilder.
unsigned SlabAllocateSize
Representing the slab allocation size for memory management in kb.
llvm::Error configure(IncrementalCompilerBuilder &CB, const Options &Opts) override
Apply execution options and configure the compiler for this backend.
bool UseSharedMemory
Indicates whether to use shared memory for communication.
std::function< llvm::Error(const driver::Compilation &)> UpdateOrcRuntimePathCB
A default callback that can be used in the IncrementalCompilerBuilder to retrieve the path to the orc...
bool supportsJIT() const override
Probe whether this backend can JIT code for the host.
std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder
An optional external ORC JIT builder.
std::function< void()> CustomizeFork
Custom lambda to be executed inside child process/executor.
std::string OrcRuntimePath
Path to the ORC runtime library.
llvm::Expected< llvm::Triple > getHostJITTriple() const override
Return the host triple used by this backend.
std::string OOPExecutor
Path to the out-of-process JIT executor.
uint32_t ExecutorPID
PID of the out-of-process JIT executor.
bool IsOutOfProcess
Indicates whether out-of-process JIT execution is enabled.
Exposes information about the current target.
Definition TargetInfo.h:228
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:46
Top level wrappers for InstallAPI frontend operations.
int const char * function
Definition c++config.h:31
Options passed to the backend when configuring execution.