LLVM 22.0.0git
ObjectTransformLayer.h
Go to the documentation of this file.
1//===- ObjectTransformLayer.h - Run all objects through 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 objects passed in through a user supplied functor.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
14#define LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
15
19#include <algorithm>
20#include <memory>
21
22namespace llvm {
23namespace orc {
24
26 : public RTTIExtends<ObjectTransformLayer, ObjectLayer> {
27public:
28 static char ID;
29
31 std::function<Expected<std::unique_ptr<MemoryBuffer>>(
32 std::unique_ptr<MemoryBuffer>)>;
33
36
37 void emit(std::unique_ptr<MaterializationResponsibility> R,
38 std::unique_ptr<MemoryBuffer> O) override;
39
41 this->Transform = std::move(Transform);
42 }
43
44private:
45 ObjectLayer &BaseLayer;
46 TransformFunction Transform;
47};
48
49} // end namespace orc
50} // end namespace llvm
51
52#endif // LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
#define LLVM_ABI
Definition Compiler.h:213
Inheritance utility for extensible RTTI.
An ExecutionSession represents a running JIT program.
Definition Core.h:1355
Interface for Layers that accept object files.
Definition Layer.h:134
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
std::function< Expected< std::unique_ptr< MemoryBuffer > >( std::unique_ptr< MemoryBuffer >)> TransformFunction
ObjectTransformLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, TransformFunction Transform=TransformFunction())
void setTransform(TransformFunction Transform)
This is an optimization pass for GlobalISel generic memory operations.