LLVM 17.0.0git
IRTransformLayer.h
Go to the documentation of this file.
1//===- IRTransformLayer.h - Run all IR through a functor --------*- C++ -*-===//
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//
9// Run all IR passed in through a user supplied functor.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
14#define LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
15
19#include <memory>
20
21namespace llvm {
22namespace orc {
23
24/// A layer that applies a transform to emitted modules.
25/// The transform function is responsible for locking the ThreadSafeContext
26/// before operating on the module.
27class IRTransformLayer : public IRLayer {
28public:
31
34
36 this->Transform = std::move(Transform);
37 }
38
39 void emit(std::unique_ptr<MaterializationResponsibility> R,
40 ThreadSafeModule TSM) override;
41
44 return TSM;
45 }
46
47private:
48 IRLayer &BaseLayer;
49 TransformFunction Transform;
50};
51
52} // end namespace orc
53} // end namespace llvm
54
55#endif // LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
dxil metadata emit
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
An ExecutionSession represents a running JIT program.
Definition: Core.h:1373
Interface for layers that accept LLVM IR.
Definition: Layer.h:67
A layer that applies a transform to emitted modules.
unique_function< Expected< ThreadSafeModule >(ThreadSafeModule, MaterializationResponsibility &R)> TransformFunction
void setTransform(TransformFunction Transform)
static ThreadSafeModule identityTransform(ThreadSafeModule TSM, MaterializationResponsibility &R)
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:524
An LLVM Module together with a shared ThreadSafeContext.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18