aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTarun Prabhu <tarun@lanl.gov>2022-10-04 17:02:45 -0600
committerTarun Prabhu <tarun@lanl.gov>2022-10-04 17:02:45 -0600
commit43fe6f7cc35ded691bbc2fa844086d321e705d46 (patch)
tree22da7d7898f8dc43a439cb512f0551d26e2f6857 /flang/lib/Frontend/CompilerInvocation.cpp
parentece4bb5ab8941438e4ee0491b59f6d7be77dfec5 (diff)
downloadllvm-43fe6f7cc35ded691bbc2fa844086d321e705d46.zip
llvm-43fe6f7cc35ded691bbc2fa844086d321e705d46.tar.gz
llvm-43fe6f7cc35ded691bbc2fa844086d321e705d46.tar.bz2
[flang] Add -fpass-plugin option to Flang frontend
Add 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. - 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. 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 0ad63b0..b00a2a3d 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)) {