This is an archive of the discontinued LLVM Phabricator instance.

Decouple registring passes from specifying argument/description
ClosedPublic

Authored by mehdi_amini on Jun 16 2021, 2:21 PM.

Details

Summary

This patch changes the (not recommended) static registration API from:

static PassRegistration<MyPass> reg("my-pass", "My Pass Description.");

to:

static PassRegistration<MyPass> reg;

And the explicit registration from:

void registerPass("my-pass", "My Pass Description.",
                  [] { return createMyPass(); });

To:

void registerPass([] { return createMyPass(); });

It is expected that Pass implementations overrides the getArgument() method
instead. This will ensure that pipeline description can be printed and parsed
back.

Diff Detail

Event Timeline

mehdi_amini created this revision.Jun 16 2021, 2:21 PM
mehdi_amini requested review of this revision.Jun 16 2021, 2:21 PM
rriddle accepted this revision.Jun 16 2021, 2:35 PM
This revision is now accepted and ready to land.Jun 16 2021, 2:35 PM

We should update the docs as well.

Update documentation

rriddle added inline comments.Jun 16 2021, 4:37 PM
mlir/docs/PassManagement.md
564–568

I think we need to explicitly call out the getArgument/getDescription methods. I don't think it would be clear right now that they are used for registration.

Document more the getArgument()/getDescription()

This revision was landed with ongoing or failed builds.Jun 16 2021, 4:42 PM
This revision was automatically updated to reflect the committed changes.