LLVM 20.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"
19#include "llvm/Support/Error.h"
21#include <functional>
22#include <memory>
23#include <mutex>
24
25namespace llvm {
26
27class Module;
28
29namespace orc {
30
31class IRCompileLayer : public IRLayer {
32public:
33 class IRCompiler {
34 public:
36 virtual ~IRCompiler();
38 return MO;
39 }
41
42 protected:
44
45 private:
47 };
48
49 using NotifyCompiledFunction = std::function<void(
51
53 std::unique_ptr<IRCompiler> Compile);
54
55 IRCompiler &getCompiler() { return *Compile; }
56
57 void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled);
58
59 void emit(std::unique_ptr<MaterializationResponsibility> R,
60 ThreadSafeModule TSM) override;
61
62private:
63 mutable std::mutex IRLayerMutex;
64 ObjectLayer &BaseLayer;
65 std::unique_ptr<IRCompiler> Compile;
66 const IRSymbolMapper::ManglingOptions *ManglingOpts;
68};
69
70} // end namespace orc
71} // end namespace llvm
72
73#endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
Machine Check Debug Module
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:481
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
An ExecutionSession represents a running JIT program.
Definition: Core.h:1431
virtual Expected< std::unique_ptr< MemoryBuffer > > operator()(Module &M)=0
IRCompiler(IRSymbolMapper::ManglingOptions MO)
const IRSymbolMapper::ManglingOptions & getManglingOptions() const
IRSymbolMapper::ManglingOptions & manglingOptions()
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
IRCompiler & getCompiler()
std::function< void(MaterializationResponsibility &R, ThreadSafeModule TSM)> NotifyCompiledFunction
void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled)
Interface for layers that accept LLVM IR.
Definition: Layer.h:67
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:555
Interface for Layers that accept object files.
Definition: Layer.h:133
An LLVM Module together with a shared ThreadSafeContext.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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:1856
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858