This is an archive of the discontinued LLVM Phabricator instance.

Change pass registration generated code to allow users to selectively register passes
ClosedPublic

Authored by mehdi_amini on Apr 2 2020, 10:44 AM.

Details

Summary

This slightly tweaks the generated code from:

#ifdef GEN_PASS_REGISTRATION
::mlir::registerPass("flag1", ...
::mlir::registerPass("flag2", ...
#endif // GEN_PASS_REGISTRATION

to:

#ifdef GEN_PASS_REGISTRATION
#define GEN_PASS_REGISTRATION_Pass1
#define GEN_PASS_REGISTRATION_Pass2
#endif // GEN_PASS_REGISTRATION

#ifdef GEN_PASS_REGISTRATION_Pass1
::mlir::registerPass("flag1", ...
#endif
#ifdef GEN_PASS_REGISTRATION_Pass1
::mlir::registerPass("flag2", ...
#endif

That way the generated code can be included by defining the
GEN_PASS_REGISTRATION macro as currenty and register all the passes,
but one can also define only GEN_PASS_REGISTRATION_Pass1 to register a
subset of the passes.

Diff Detail

Event Timeline

mehdi_amini created this revision.Apr 2 2020, 10:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 10:44 AM
rriddle accepted this revision.Apr 2 2020, 11:07 AM

Thanks, I have a revision that does this but haven't sent it out for review yet.

This revision is now accepted and ready to land.Apr 2 2020, 11:07 AM
This revision was automatically updated to reflect the committed changes.