LLVM  8.0.1
IRTransformLayer.cpp
Go to the documentation of this file.
1 //===-------------- IRTransformLayer.cpp - IR Transform Layer -------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
12 
13 namespace llvm {
14 namespace orc {
15 
17  IRLayer &BaseLayer,
18  TransformFunction Transform)
19  : IRLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
20 
22  ThreadSafeModule TSM) {
23  assert(TSM.getModule() && "Module must not be null");
24 
25  if (auto TransformedTSM = Transform(std::move(TSM), R))
26  BaseLayer.emit(std::move(R), std::move(*TransformedTSM));
27  else {
29  getExecutionSession().reportError(TransformedTSM.takeError());
30  }
31 }
32 
33 } // End namespace orc.
34 } // End namespace llvm.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, TransformFunction Transform=identityTransform)
Definition: BitVector.h:938
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:155
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:32
virtual void emit(MaterializationResponsibility R, ThreadSafeModule TSM)=0
Emit should materialize the given IR.
Module * getModule()
Get the module wrapped by this ThreadSafeModule.
An LLVM Module together with a shared ThreadSafeContext.
Interface for layers that accept LLVM IR.
Definition: Layer.h:26
std::function< Expected< ThreadSafeModule >(ThreadSafeModule, const MaterializationResponsibility &R)> TransformFunction
An ExecutionSession represents a running JIT program.
Definition: Core.h:697
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:754
void emit(MaterializationResponsibility R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void failMaterialization()
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
Definition: Core.cpp:443