This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Pass] Enable printing pass options as part of `-help`.
ClosedPublic

Authored by rriddle on Feb 7 2020, 11:27 AM.

Details

Summary

This revision adds support for printing pass options as part of the normal help description. This also moves registered passes and pipelines into different sections of the help.

Example:

Compiler passes to run
  --pass-pipeline                                     -   ...
  Passes:
    --affine-data-copy-generate                       -   ...
    --convert-gpu-to-spirv                            -   ...
      --workgroup-size=<long>                         - ...
    --test-options-pass                               -   ...
      --list=<int>                                    - ...
      --string=<string>                               - ...
      --string-list=<string>                          - ...
  Pass Pipelines:
    --test-options-pass-pipeline                      -   ...
      --list=<int>                                    - ...
      --string=<string>                               - ...
      --string-list=<string>                          - ...

Diff Detail

Event Timeline

rriddle created this revision.Feb 7 2020, 11:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2020, 11:27 AM
jpienaar accepted this revision.Feb 7 2020, 1:11 PM

Nice, looks much cleaner. Mostly small nits.

mlir/include/mlir/Pass/PassOptions.h
191

Why not make it non-copyable?

mlir/lib/Pass/PassRegistry.cpp
43

So it has numSpaces + 1 empty space before - ? Could llvm::format make this simpler?

199–202

Nit: Hoist out into cmp lambda? I think it would make it easier to read (and may actually be shorter as it reduces whitespace)

550

Any way to make these less magical? E.g., we have 4 here, 5 above, 6 below and 2 for indent (which is matches my editor config so I won't complain 😛 )

This revision is now accepted and ready to land.Feb 7 2020, 1:11 PM
rriddle updated this revision to Diff 243283.Feb 7 2020, 2:05 PM
rriddle marked 6 inline comments as done.

Resolve comments

mlir/include/mlir/Pass/PassOptions.h
191

Done. I originally had this so that users could still call the copy constructor on Pass, but I just overrode that one as well.

mlir/lib/Pass/PassRegistry.cpp
550

I aligned all of the magic. I need to do a followup to the core LLVM CommandLine library at some point to allow for passing in a base indent.

This revision was automatically updated to reflect the committed changes.