OSDN Git Service

[ORC] Allow IRTransformLayer2's transform to be modified after initialization.
[android-x86/external-llvm.git] / include / llvm / ExecutionEngine / Orc / IRTransformLayer.h
index a802b6d..266a0f4 100644 (file)
@@ -29,13 +29,20 @@ public:
   using TransformFunction =
     std::function<Expected<std::unique_ptr<Module>>(std::unique_ptr<Module>)>;
 
-  IRTransformLayer2(ExecutionSession &ES,
-                    IRLayer &BaseLayer,
-                    TransformFunction Transform);
+  IRTransformLayer2(ExecutionSession &ES, IRLayer &BaseLayer,
+                    TransformFunction Transform = identityTransform);
+
+  void setTransform(TransformFunction Transform) {
+    this->Transform = std::move(Transform);
+  }
 
   void emit(MaterializationResponsibility R, VModuleKey K,
             std::unique_ptr<Module> M) override;
 
+  static std::unique_ptr<Module> identityTransform(std::unique_ptr<Module> M) {
+    return M;
+  }
+
 private:
   IRLayer &BaseLayer;
   TransformFunction Transform;