This is an archive of the discontinued LLVM Phabricator instance.

[Flang] Allow registering plugin extensions with the pass builder.
ClosedPublic

Authored by mnadeem on Nov 8 2022, 2:39 PM.

Details

Summary

Pass plugins are compiled and linked dynamically by default. Setting
LLVM_${NAME}_LINK_INTO_TOOLS to ON turns the project into a
statically linked extension. Projects like Polly can be used this way by
adding -DLLVM_POLLY_LINK_INTO_TOOLS=ON to the cmake command.

The changes in this patch makes the PassBuilder in Flang aware of statically
linked pass plugins, see the documentation for more details:
https://github.com/llvm/llvm-project/blob/main/llvm/docs/WritingAnLLVMNewPMPass.rst#id21

Diff Detail

Event Timeline

mnadeem created this revision.Nov 8 2022, 2:39 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
mnadeem requested review of this revision.Nov 8 2022, 2:39 PM
mnadeem updated this revision to Diff 474114.Nov 8 2022, 4:52 PM

Hey @mnadeem , thanks for sending this!

  1. Could you add a test? I would hope that you can re-use Bye, similarly to https://reviews.llvm.org/D129156.
  2. Could you document how to use this?
mnadeem edited the summary of this revision. (Show Details)Nov 9 2022, 11:49 AM

Hey @mnadeem , thanks for sending this!

  1. Could you add a test? I would hope that you can re-use Bye, similarly to https://reviews.llvm.org/D129156.
  2. Could you document how to use this?

@awarzynski
I'll work on adding a test. I have updated the summary of this revision, would that suffice as documentation?

mnadeem updated this revision to Diff 474357.Nov 9 2022, 1:59 PM

Added a test and did the relevant test config changes.

awarzynski accepted this revision.Nov 10 2022, 12:27 AM

Thanks for the updates!

I have updated the summary of this revision, would that suffice as documentation?

I was hoping for a note in https://github.com/llvm/llvm-project/blob/main/flang/docs/FlangDriver.md#frontend-driver-plugins,. Even if it was just to make folks aware that from now on the behavior in Flang can be changed with LLVM_${NAME}_LINK_INTO_TOOLS. Because this is basically what this patch does, doesn't it? This is fine too :)

flang/test/Driver/pass-plugin.f90
4

[nit] More specifically, when https://reviews.llvm.org/D129156. is merged, right?

This revision is now accepted and ready to land.Nov 10 2022, 12:27 AM