This is an archive of the discontinued LLVM Phabricator instance.

Remove deprecated registration APIs (NFC)
ClosedPublic

Authored by mehdi_amini on Jun 16 2021, 5:01 PM.

Details

Summary

In D104421, we changed the API for pass registration.
Before you would write:

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

while now you’d only write:

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

If you’re using TableGen to define your pass registration, you shouldn’t have anything to do. If you’re using directly the C++ API here are some changes.
Your project may also be broken even if you use TableGen and you call the
generated registration API in case your pass implementation didn’t inherit from
the MyPassBase class generated by TableGen.

If you don't use TableGen, the "my-pass" and "My Pass Description." fields must
be provided by overriding methods on the pass itself:

llvm::StringRef getArgument() const final { return "my-pass"; }
llvm::StringRef getDescription() const final {
  return "My Pass Description.";
}

Diff Detail

Event Timeline

mehdi_amini created this revision.Jun 16 2021, 5:01 PM
mehdi_amini requested review of this revision.Jun 16 2021, 5:01 PM
rriddle accepted this revision.Jun 16 2021, 5:23 PM

Can you fix the description?

mlir/lib/Pass/PassRegistry.cpp
122

This can use pass-> now.

This revision is now accepted and ready to land.Jun 16 2021, 5:23 PM

Rebase and update

mehdi_amini edited the summary of this revision. (Show Details)Sep 1 2021, 11:36 AM
mehdi_amini marked an inline comment as done.
This revision was landed with ongoing or failed builds.Sep 1 2021, 11:53 AM
This revision was automatically updated to reflect the committed changes.