LLVM 22.0.0git
IRCompileLayer.h
Go to the documentation of this file.
1//===- IRCompileLayer.h -- Eagerly compile IR for JIT -----------*- 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// Contains the definition for a basic, eagerly compiling layer of the JIT.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
14#define LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
15
16#include "llvm/ADT/STLExtras.h"
20#include "llvm/Support/Error.h"
22#include <functional>
23#include <memory>
24#include <mutex>
25
26namespace llvm {
27
28class Module;
29
30namespace orc {
31
33public:
49
50 using NotifyCompiledFunction = std::function<void(
52
54 std::unique_ptr<IRCompiler> Compile);
55
56 IRCompiler &getCompiler() { return *Compile; }
57
58 void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled);
59
60 void emit(std::unique_ptr<MaterializationResponsibility> R,
61 ThreadSafeModule TSM) override;
62
63private:
64 mutable std::mutex IRLayerMutex;
65 ObjectLayer &BaseLayer;
66 std::unique_ptr<IRCompiler> Compile;
67 const IRSymbolMapper::ManglingOptions *ManglingOpts;
68 NotifyCompiledFunction NotifyCompiled = NotifyCompiledFunction();
69};
70
71} // end namespace orc
72} // end namespace llvm
73
74#endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
#define LLVM_ABI
Definition Compiler.h:213
This file contains some templates that are useful if you are working with the STL at all.
Tagged union holding either a T or a Error.
Definition Error.h:485
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
An ExecutionSession represents a running JIT program.
Definition Core.h:1355
virtual Expected< std::unique_ptr< MemoryBuffer > > operator()(Module &M)=0
IRCompiler(IRSymbolMapper::ManglingOptions MO)
const IRSymbolMapper::ManglingOptions & getManglingOptions() const
IRSymbolMapper::ManglingOptions & manglingOptions()
std::function< void( MaterializationResponsibility &R, ThreadSafeModule TSM)> NotifyCompiledFunction
IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, std::unique_ptr< IRCompiler > Compile)
IRLayer(ExecutionSession &ES, const IRSymbolMapper::ManglingOptions *&MO)
Definition Layer.h:70
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition Core.h:576
Interface for Layers that accept object files.
Definition Layer.h:134
An LLVM Module together with a shared ThreadSafeContext.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1869
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851