PSA: change in pass registration (please update your APIs!)

Hi all,

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.

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(); });

The reason for this change is that the existing API is duplicating the information on the pass identifier/argument in the registration API and on the pass itself (see the getArgument() method)
The latter is used for printing the pass pipeline and generating reproducers on failure. However the registration API made it easy to not provide an implementation for getArgument() in the concrete Pass, which lead to reproducer that couldn’t be parsed back. Instead we will make the getArgument() mandatory in passes, and not provide the redundant information in the registration API call.

Here is an example of how the ~100 test passes were updated in-tree: D104426.

You may validate that you don’t have any use of the deprecated APIs with this patch that removes them all.

2 Likes

I hit issues with this change in some of our projects, so it is worth mentioning that if this change broke you right now, it is likely because you call the registration API generated from the TableGen definition for the pass, but your pass implementation didn’t inherit from the MyPassBase class generated by TableGen.

It’s been 3 months, I plan to delete the deprecated APIs in the coming days.