LLVM 19.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
12namespace llvm {
13namespace orc {
14
16 TransformFunction Transform)
17 : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer),
18 Transform(std::move(Transform)) {}
19
20void 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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
An ExecutionSession represents a running JIT program.
Definition: Core.h:1425
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:1563
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:1858
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858