LLVM 20.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
10
11namespace llvm {
12namespace orc {
13
15 TransformFunction Transform)
16 : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer),
17 Transform(std::move(Transform)) {}
18
19void IRTransformLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
20 ThreadSafeModule TSM) {
21 assert(TSM && "Module must not be null");
22
23 if (auto TransformedTSM = Transform(std::move(TSM), *R))
24 BaseLayer.emit(std::move(R), std::move(*TransformedTSM));
25 else {
26 R->failMaterialization();
27 getExecutionSession().reportError(TransformedTSM.takeError());
28 }
29}
30
31} // End namespace orc.
32} // End namespace llvm.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
An ExecutionSession represents a running JIT program.
Definition: Core.h:1339
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:1474
Interface for layers that accept LLVM IR.
Definition: Layer.h:67
virtual void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM)=0
Emit should materialize the given IR.
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:75
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, TransformFunction Transform=identityTransform)
An LLVM Module together with a shared ThreadSafeContext.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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:1873
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858