aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTarun Prabhu <tarun@lanl.gov>2022-11-10 07:56:03 -0700
committerTarun Prabhu <tarun@lanl.gov>2022-11-10 08:03:46 -0700
commitc3821b8d2aacd1d7c0281db1b8db011e1158cf4d (patch)
tree8827d248ee8888d44d9217354a35286c2d9d449c /flang/lib/Frontend/CompilerInvocation.cpp
parentf3e8a117d2bc8d439434db5cb77b1c8a425a38c0 (diff)
downloadllvm-c3821b8d2aacd1d7c0281db1b8db011e1158cf4d.zip
llvm-c3821b8d2aacd1d7c0281db1b8db011e1158cf4d.tar.gz
llvm-c3821b8d2aacd1d7c0281db1b8db011e1158cf4d.tar.bz2
[flang] Add -fpass-plugin option to flang
This patch adds the -fpass-plugin option to flang which dynamically loads LLVM passes from the shared object passed as the argument to the flag. The behavior of the option is designed to replicate that of the same option in clang and thus has the same capabilities and limitations. Features: Multiple instances of -fpass-plugin=path-to-file can be specified and each of the files will be loaded in that order. The flag can be passed to both flang-new and flang-new -fc1. The flag will be listed when the -help flag is passed to both flang-new and flang-new -fc1. It will also be listed when the --help-hidden flag is passed. Limitations: Dynamically loaded plugins are not supported in clang on Windows and are not supported in flang either. Addenda: Some minor stylistic changes are made in the files that were modified to enable this functionality. Those changes make the naming of functions more consistent, but do not change any functionality that is not directly related to enabling -fpass-plugin. Differential Revision: https://reviews.llvm.org/D129156
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 4ae35762..f0f070e 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -125,6 +125,9 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
clang::driver::options::OPT_fno_debug_pass_manager, false))
opts.DebugPassManager = 1;
+ for (auto *a : args.filtered(clang::driver::options::OPT_fpass_plugin_EQ))
+ opts.LLVMPassPlugins.push_back(a->getValue());
+
// -mrelocation-model option.
if (const llvm::opt::Arg *A =
args.getLastArg(clang::driver::options::OPT_mrelocation_model)) {