//===----- LLJIT.h -- An ORC-based JIT for compiling LLVM IR ----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // An ORC-based JIT for compiling LLVM IR. // //===----------------------------------------------------------------------===// #ifndef LLVM_EXECUTIONENGINE_ORC_LLJIT_H #define LLVM_EXECUTIONENGINE_ORC_LLJIT_H #include "llvm/ADT/SmallSet.h" #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h" #include "llvm/ExecutionEngine/Orc/CompileUtils.h" #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h" #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h" #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h" #include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h" #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ThreadPool.h" #include <variant> namespace llvm { namespace orc { class LLJITBuilderState; class LLLazyJITBuilderState; class ObjectTransformLayer; class ExecutorProcessControl; /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT. /// /// Create instances using LLJITBuilder. class LLJIT { … }; /// An extended version of LLJIT that supports lazy function-at-a-time /// compilation of LLVM IR. class LLLazyJIT : public LLJIT { … }; class LLJITBuilderState { … }; template <typename JITType, typename SetterImpl, typename State> class LLJITBuilderSetters { … }; /// Constructs LLJIT instances. class LLJITBuilder : public LLJITBuilderState, public LLJITBuilderSetters<LLJIT, LLJITBuilder, LLJITBuilderState> { … }; class LLLazyJITBuilderState : public LLJITBuilderState { … }; template <typename JITType, typename SetterImpl, typename State> class LLLazyJITBuilderSetters : public LLJITBuilderSetters<JITType, SetterImpl, State> { … }; /// Constructs LLLazyJIT instances. class LLLazyJITBuilder : public LLLazyJITBuilderState, public LLLazyJITBuilderSetters<LLLazyJIT, LLLazyJITBuilder, LLLazyJITBuilderState> { … }; /// Configure the LLJIT instance to use orc runtime support. This overload /// assumes that the client has manually configured a Platform object. Error setUpOrcPlatformManually(LLJIT &J); /// Configure the LLJIT instance to use the ORC runtime and the detected /// native target for the executor. class ExecutorNativePlatform { … }; /// Configure the LLJIT instance to scrape modules for llvm.global_ctors and /// llvm.global_dtors variables and (if present) build initialization and /// deinitialization functions. Platform specific initialization configurations /// should be preferred where available. Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J); /// Configure the LLJIT instance to disable platform support explicitly. This is /// useful in two cases: for platforms that don't have such requirements and for /// platforms, that we have no explicit support yet and that don't work well /// with the generic IR platform. Expected<JITDylibSP> setUpInactivePlatform(LLJIT &J); /// A Platform-support class that implements initialize / deinitialize by /// forwarding to ORC runtime dlopen / dlclose operations. class ORCPlatformSupport : public LLJIT::PlatformSupport { … }; } // End namespace orc } // End namespace llvm #endif // LLVM_EXECUTIONENGINE_ORC_LLJIT_H