[PATCH] D108283: [flang][driver] Add documentation for Plugins

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 22 09:55:13 PDT 2021


awarzynski added a comment.

@Meinersbur, thank you for your comments! Quickly replying before I go away for 2 weeks.

In D108283#2958136 <https://reviews.llvm.org/D108283#2958136>, @Meinersbur wrote:

> Is `PluginParseTreeAction` the only supported kind of plugin? It seems clang's equivalent would be `PluginASTAction` which is abstract, why does `PluginParseTreeAction` provide a default implementation?

That's an oversight, it should be abstract: https://reviews.llvm.org/D108518. Thanks for pointing this out!

> Note that clang/LLVM's newer `-fpass-plugin` has a different design that avoids global registries and instead calls a function in the loaded library.

Avoiding global registries would be nice, so this is worth looking into, thanks!  Isn't -fpass-plugin <https://github.com/llvm/llvm-project/blob/40fd2d93c0ac694dce49e1d52f585752d011d884/clang/include/clang/Driver/Options.td#L2475-L2478>  for middle-end plugins though?



================
Comment at: flang/docs/FlangDriver.md:361
+* `-load <dsopath>` for loading the dynamic shared object of the Plugin
+* `-plugin <name>` for calling the registered Plugin
+
----------------
Meinersbur wrote:
> clang also supports `-fplugin`. Does flang as well?
IIUC, `-fplugin` is a `clang` flag that's translated into `-load` for `clang -cc1` (see [[ https://github.com/llvm/llvm-project/blob/40fd2d93c0ac694dce49e1d52f585752d011d884/clang/lib/Driver/ToolChains/Clang.cpp#L6525-L6530 | here ]]). For now, we have limited Flang plugins to `flang-new -fc1`. It would be worth clarifying somewhere in this document.

Once we add support for `-fplugin` (this should be rather straightforward), we can update this document.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108283/new/

https://reviews.llvm.org/D108283



More information about the llvm-commits mailing list