LLVM  7.0.0
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  std::unique_ptr<Module> M) {
23  assert(M && "Module must not be null");
24 
25  if (auto TransformedMod = Transform(std::move(M)))
26  BaseLayer.emit(std::move(R), std::move(K), std::move(*TransformedMod));
27  else {
29  getExecutionSession().reportError(TransformedMod.takeError());
30  }
31 }
32 
33 } // End namespace orc.
34 } // End namespace llvm.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
std::function< Expected< std::unique_ptr< Module > >(std::unique_ptr< Module >)> TransformFunction
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
Definition: Core.h:40
Definition: BitVector.h:921
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:124
virtual void emit(MaterializationResponsibility R, VModuleKey K, std::unique_ptr< Module > M)=0
Emit should materialize the given IR.
IRTransformLayer2(ExecutionSession &ES, IRLayer &BaseLayer, TransformFunction Transform=identityTransform)
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:30
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:391
void emit(MaterializationResponsibility R, VModuleKey K, std::unique_ptr< Module > M) override
Emit should materialize the given IR.
Interface for layers that accept LLVM IR.
Definition: Layer.h:24
An ExecutionSession represents a running JIT program.
Definition: Core.h:735
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void failMaterialization()
Notify all unfinalized symbols that an error has occurred.
Definition: Core.cpp:653