LLVM  15.0.0git
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  TransformFunction Transform)
17  : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer),
18  Transform(std::move(Transform)) {}
19 
20 void IRTransformLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
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 {
27  R->failMaterialization();
28  getExecutionSession().reportError(TransformedTSM.takeError());
29  }
30 }
31 
32 } // End namespace orc.
33 } // End namespace llvm.
MemoryBuffer.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::orc::ExecutionSession::reportError
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:1482
llvm::unique_function< Expected< ThreadSafeModule >(ThreadSafeModule, MaterializationResponsibility &R)>
IRTransformLayer.h
llvm::orc::IRLayer::emit
virtual void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM)=0
Emit should materialize the given IR.
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
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:1665
llvm::orc::IRLayer::getExecutionSession
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:75
llvm::orc::IRTransformLayer::emit
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
Definition: IRTransformLayer.cpp:20
std
Definition: BitVector.h:851
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1362
llvm::orc::IRTransformLayer::IRTransformLayer
IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, TransformFunction Transform=identityTransform)
Definition: IRTransformLayer.cpp:15
llvm::orc::ThreadSafeModule
An LLVM Module together with a shared ThreadSafeContext.
Definition: ThreadSafeModule.h:77
llvm::orc::IRLayer
Interface for layers that accept LLVM IR.
Definition: Layer.h:67