LLVM  14.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 
18 #include <algorithm>
19 #include <memory>
20 
21 namespace llvm {
22 namespace orc {
23 
25  : public RTTIExtends<ObjectTransformLayer, ObjectLayer> {
26 public:
27  static char ID;
28 
29  using TransformFunction =
30  std::function<Expected<std::unique_ptr<MemoryBuffer>>(
31  std::unique_ptr<MemoryBuffer>)>;
32 
34  TransformFunction Transform = TransformFunction());
35 
36  void emit(std::unique_ptr<MaterializationResponsibility> R,
37  std::unique_ptr<MemoryBuffer> O) override;
38 
39  void setTransform(TransformFunction Transform) {
40  this->Transform = std::move(Transform);
41  }
42 
43 private:
44  ObjectLayer &BaseLayer;
45  TransformFunction Transform;
46 };
47 
48 } // end namespace orc
49 } // end namespace llvm
50 
51 #endif // LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
JITSymbol.h
llvm::orc::ObjectTransformLayer::emit
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Definition: ObjectTransformLayer.cpp:24
llvm::orc::ObjectTransformLayer::ObjectTransformLayer
ObjectTransformLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, TransformFunction Transform=TransformFunction())
Definition: ObjectTransformLayer.cpp:19
Layer.h
llvm::orc::ObjectTransformLayer::TransformFunction
std::function< Expected< std::unique_ptr< MemoryBuffer > >(std::unique_ptr< MemoryBuffer >)> TransformFunction
Definition: ObjectTransformLayer.h:31
llvm::orc::ObjectLayer
Interface for Layers that accept object files.
Definition: Layer.h:134
llvm::RTTIExtends
Inheritance utility for extensible RTTI.
Definition: ExtensibleRTTI.h:65
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:206
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::orc::ObjectTransformLayer::setTransform
void setTransform(TransformFunction Transform)
Definition: ObjectTransformLayer.h:39
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1346
llvm::orc::ObjectTransformLayer
Definition: ObjectTransformLayer.h:24
llvm::orc::ObjectTransformLayer::ID
static char ID
Definition: ObjectTransformLayer.h:27