Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:54

0001 //===- ObjectTransformLayer.h - Run all objects through functor -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Run all objects passed in through a user supplied functor.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
0014 #define LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
0015 
0016 #include "llvm/ExecutionEngine/JITSymbol.h"
0017 #include "llvm/ExecutionEngine/Orc/Layer.h"
0018 #include <algorithm>
0019 #include <memory>
0020 
0021 namespace llvm {
0022 namespace orc {
0023 
0024 class ObjectTransformLayer
0025     : public RTTIExtends<ObjectTransformLayer, ObjectLayer> {
0026 public:
0027   static char ID;
0028 
0029   using TransformFunction =
0030       std::function<Expected<std::unique_ptr<MemoryBuffer>>(
0031           std::unique_ptr<MemoryBuffer>)>;
0032 
0033   ObjectTransformLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
0034                        TransformFunction Transform = TransformFunction());
0035 
0036   void emit(std::unique_ptr<MaterializationResponsibility> R,
0037             std::unique_ptr<MemoryBuffer> O) override;
0038 
0039   void setTransform(TransformFunction Transform) {
0040     this->Transform = std::move(Transform);
0041   }
0042 
0043 private:
0044   ObjectLayer &BaseLayer;
0045   TransformFunction Transform;
0046 };
0047 
0048 } // end namespace orc
0049 } // end namespace llvm
0050 
0051 #endif // LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H