[flang-commits] [PATCH] D129156: Add -fpass-plugin option to Flang

Andrzej Warzynski via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Sep 29 13:29:32 PDT 2022


awarzynski added a comment.

Thanks for the updates!

In D129156#3807119 <https://reviews.llvm.org/D129156#3807119>, @tarunprabhu wrote:

> It is not clear if loading passes dynamically is supported on Windows and the test is designed to fail on that platform.

It isn't in your implementation, so it is safe to document it as unsupported on Windows :) In general, plugins in LLVM are not officially supported on Windows.



================
Comment at: flang/docs/FlangDriver.md:513-514
+
+Pass plugins are an extension to the frontend drive that make it possible to run
+out-of-tree LLVM passes on the LLVM-IR. The passes are run after lowering to 
+LLVM-IR. The exact position of the pass in the pipeline will depend on how it 
----------------
> Pass plugins are an extension to the frontend drive that make it possible to run out-of-tree LLVM passes on the LLVM-IR.

This isn't quite true. 

1. These plugins can be loaded from both the compiler and frontend drivers.
2. Both out-of-tree and in-tree passes are supported. 
3. This is not an extension to any of the drivers. The drivers that implement `-fpass-plugin` simply provide an interface to forward the specified plugin to LLVM (i.e. the middle-end).


================
Comment at: flang/docs/FlangDriver.md:515
+out-of-tree LLVM passes on the LLVM-IR. The passes are run after lowering to 
+LLVM-IR. The exact position of the pass in the pipeline will depend on how it 
+has been registered with the `llvm::PassBuilder`. See the documentation for 
----------------



================
Comment at: flang/docs/FlangDriver.md:516-517
+LLVM-IR. The exact position of the pass in the pipeline will depend on how it 
+has been registered with the `llvm::PassBuilder`. See the documentation for 
+`llvm::PassBuilder` for details. 
+
----------------
>  See the documentation for `llvm::PassBuilder` for details

Please, can you provide a link?


================
Comment at: flang/docs/FlangDriver.md:519-520
+
+The framework to enable pass plugins in Flang uses the exact same machinery as
+that used by clang and thus has the same capabilities and limitations. 
+
----------------
The capitalization is inconsistent. Please use either "Flang" and "Clang" or "flang" and "clang". Usually, "Clang"/"Flang" refers to the sub-project and "flang"/"clang" to the binaries. Note that tools in this document are surrounded with backticks (i.e. "`").


================
Comment at: flang/include/flang/Frontend/CodeGenOptions.h:49
+public:
+  std::vector<std::string> LLVMPassPlugins;
+
----------------
DOCUMENTME :)


================
Comment at: flang/include/flang/Frontend/CodeGenOptions.h:51
+
 public:
   // Define accessors/mutators for code generation options of enumeration type.
----------------
DELETEME


================
Comment at: flang/test/Driver/frontend-forwarding.f90:4
 
+! REQUIRES: plugins, shell
+
----------------
This will really limit this test. I'd rather have it run on all supported platforms (with plugins enabled *and* disabled) than not.


================
Comment at: flang/test/Driver/pass-plugin.f90:7-8
+
+! RUN: %flang -S %s -fpass-plugin=%llvmshlibdir/Bye.so -Xflang -fdebug-pass-manager -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-PASS-PLUGIN
+! RUN: %flang_fc1 -S %s -fpass-plugin=%llvmshlibdir/Bye.so -fdebug-pass-manager -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-PASS-PLUGIN
+
----------------



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

https://reviews.llvm.org/D129156



More information about the flang-commits mailing list