LLVM  14.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 
25 namespace llvm {
26 
27 class Module;
28 
29 namespace orc {
30 
31 class IRCompileLayer : public IRLayer {
32 public:
33  class IRCompiler {
34  public:
36  virtual ~IRCompiler();
38  return MO;
39  }
41 
42  protected:
44 
45  private:
47  };
48 
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 
62 private:
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
MemoryBuffer.h
llvm::orc::MaterializationResponsibility
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:520
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
JITSymbol.h
Error.h
llvm::orc::IRCompileLayer
Definition: IRCompileLayer.h:31
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
STLExtras.h
llvm::orc::IRCompileLayer::emit
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
Definition: IRCompileLayer.cpp:28
Layer.h
llvm::orc::IRCompileLayer::IRCompiler::IRCompiler
IRCompiler(IRSymbolMapper::ManglingOptions MO)
Definition: IRCompileLayer.h:35
llvm::orc::IRCompileLayer::IRCompiler
Definition: IRCompileLayer.h:33
llvm::orc::IRCompileLayer::IRCompileLayer
IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, std::unique_ptr< IRCompiler > Compile)
Definition: IRCompileLayer.cpp:16
llvm::orc::IRCompileLayer::IRCompiler::~IRCompiler
virtual ~IRCompiler()
Definition: IRCompileLayer.cpp:14
llvm::orc::IRCompileLayer::NotifyCompiledFunction
std::function< void(MaterializationResponsibility &R, ThreadSafeModule TSM)> NotifyCompiledFunction
Definition: IRCompileLayer.h:50
llvm::orc::ObjectLayer
Interface for Layers that accept object files.
Definition: Layer.h:134
llvm::orc::IRCompileLayer::getCompiler
IRCompiler & getCompiler()
Definition: IRCompileLayer.h:55
llvm::orc::IRCompileLayer::IRCompiler::manglingOptions
IRSymbolMapper::ManglingOptions & manglingOptions()
Definition: IRCompileLayer.h:43
llvm::move
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:1609
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::orc::IRCompileLayer::IRCompiler::operator()
virtual Expected< std::unique_ptr< MemoryBuffer > > operator()(Module &M)=0
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::orc::IRSymbolMapper::ManglingOptions
Definition: Mangling.h:41
std
Definition: BitVector.h:838
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::orc::IRCompileLayer::setNotifyCompiled
void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled)
Definition: IRCompileLayer.cpp:23
llvm::orc::IRCompileLayer::IRCompiler::getManglingOptions
const IRSymbolMapper::ManglingOptions & getManglingOptions() const
Definition: IRCompileLayer.h:37
llvm::orc::ThreadSafeModule
An LLVM Module together with a shared ThreadSafeContext.
Definition: ThreadSafeModule.h:77
llvm::orc::IRLayer
Interface for layers that accept LLVM IR.
Definition: Layer.h:68