forked from OSchip/llvm-project
[ORC] Allow IRTransformLayer2's transform to be modified after initialization.
Also give the constructor's transform parameter a default no-op transform value. llvm-svn: 335665
This commit is contained in:
parent
2795a0a06e
commit
afc2758f55
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue