LLVM  12.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 <memory>
22 #include <string>
23 
24 namespace llvm {
25 
26 class Module;
27 
28 namespace orc {
29 
30 class IRCompileLayer : public IRLayer {
31 public:
32  class IRCompiler {
33  public:
35  virtual ~IRCompiler();
37  return MO;
38  }
40 
41  protected:
43 
44  private:
46  };
47 
50 
52  std::unique_ptr<IRCompiler> Compile);
53 
54  IRCompiler &getCompiler() { return *Compile; }
55 
56  void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled);
57 
58  void emit(std::unique_ptr<MaterializationResponsibility> R,
59  ThreadSafeModule TSM) override;
60 
61 private:
62  mutable std::mutex IRLayerMutex;
63  ObjectLayer &BaseLayer;
64  std::unique_ptr<IRCompiler> Compile;
65  const IRSymbolMapper::ManglingOptions *ManglingOpts;
67 };
68 
69 } // end namespace orc
70 } // end namespace llvm
71 
72 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H
void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
virtual Expected< std::unique_ptr< MemoryBuffer > > operator()(Module &M)=0
Definition: BitVector.h:941
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:491
IRCompiler & getCompiler()
IRSymbolMapper::ManglingOptions & manglingOptions()
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
An LLVM Module together with a shared ThreadSafeContext.
IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, std::unique_ptr< IRCompiler > Compile)
Interface for layers that accept LLVM IR.
Definition: Layer.h:66
Machine Check Debug Module
IRCompiler(IRSymbolMapper::ManglingOptions MO)
An ExecutionSession represents a running JIT program.
Definition: Core.h:1221
std::function< void(MaterializationResponsibility &R, ThreadSafeModule TSM)> NotifyCompiledFunction
Interface for Layers that accept object files.
Definition: Layer.h:132
print Print MemDeps of function
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:1556
const IRSymbolMapper::ManglingOptions & getManglingOptions() const