LLVM  10.0.0svn
IRTransformLayer.cpp
Go to the documentation of this file.
1 //===-------------- IRTransformLayer.cpp - IR Transform Layer -------------===//
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 
11 
12 namespace llvm {
13 namespace orc {
14 
16  IRLayer &BaseLayer,
17  TransformFunction Transform)
18  : IRLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
19 
21  ThreadSafeModule TSM) {
22  assert(TSM && "Module must not be null");
23 
24  if (auto TransformedTSM = Transform(std::move(TSM), R))
25  BaseLayer.emit(std::move(R), std::move(*TransformedTSM));
26  else {
28  getExecutionSession().reportError(TransformedTSM.takeError());
29  }
30 }
31 
32 } // End namespace orc.
33 } // End namespace llvm.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, TransformFunction Transform=identityTransform)
Definition: BitVector.h:937
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:171
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:31
virtual void emit(MaterializationResponsibility R, ThreadSafeModule TSM)=0
Emit should materialize the given IR.
An LLVM Module together with a shared ThreadSafeContext.
Interface for layers that accept LLVM IR.
Definition: Layer.h:25
std::function< Expected< ThreadSafeModule >(ThreadSafeModule, const MaterializationResponsibility &R)> TransformFunction
An ExecutionSession represents a running JIT program.
Definition: Core.h:761
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:826
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:421