LLVM 22.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
20#include <memory>
21
22namespace llvm {
23namespace orc {
24
25/// A layer that applies a transform to emitted modules.
26/// The transform function is responsible for locking the ThreadSafeContext
27/// before operating on the module.
29public:
32
34 TransformFunction Transform = identityTransform);
35
37 this->Transform = std::move(Transform);
38 }
39
40 void emit(std::unique_ptr<MaterializationResponsibility> R,
41 ThreadSafeModule TSM) override;
42
45 return TSM;
46 }
47
48private:
49 IRLayer &BaseLayer;
50 TransformFunction Transform;
51};
52
53} // end namespace orc
54} // end namespace llvm
55
56#endif // LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
#define LLVM_ABI
Definition: Compiler.h:213
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:1355
Interface for layers that accept LLVM IR.
Definition: Layer.h:68
A layer that applies a transform to emitted modules.
void setTransform(TransformFunction Transform)
static ThreadSafeModule identityTransform(ThreadSafeModule TSM, MaterializationResponsibility &R)
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:576
An LLVM Module together with a shared ThreadSafeContext.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18