LLVM  8.0.1
ObjectTransformLayer.cpp
Go to the documentation of this file.
1 //===---------- ObjectTransformLayer.cpp - Object 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  ObjectLayer &BaseLayer,
18  TransformFunction Transform)
19  : ObjectLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
20 
22  std::unique_ptr<MemoryBuffer> O) {
23  assert(O && "Module must not be null");
24 
25  if (auto TransformedObj = Transform(std::move(O)))
26  BaseLayer.emit(std::move(R), std::move(*TransformedObj));
27  else {
29  getExecutionSession().reportError(TransformedObj.takeError());
30  }
31 }
32 
33 } // End namespace orc.
34 } // End namespace llvm.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Definition: BitVector.h:938
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:155
ExecutionSession & getExecutionSession()
Returns the execution session for this layer.
Definition: Layer.h:120
virtual void emit(MaterializationResponsibility R, std::unique_ptr< MemoryBuffer > O)=0
Emit should materialize the given IR.
void emit(MaterializationResponsibility R, std::unique_ptr< MemoryBuffer > O) override
Emit should materialize the given IR.
An ExecutionSession represents a running JIT program.
Definition: Core.h:697
std::function< Expected< std::unique_ptr< MemoryBuffer > >(std::unique_ptr< MemoryBuffer >)> TransformFunction
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:754
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
Interface for Layers that accept object files.
Definition: Layer.h:114
ObjectTransformLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, TransformFunction Transform)