diff options
author | Cameron McInally <cameron.mcinally@nyu.edu> | 2025-05-30 09:50:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-30 07:50:18 -0600 |
commit | ce9cef79ea3f1ee86e4dc674d4c05b2fa8b3c7a8 (patch) | |
tree | c87fcf2a99733b656f80f810875af5c89bdcf6b4 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 99ae675fb7957f3eb8b65e9086dae4bbc722f221 (diff) | |
download | llvm-ce9cef79ea3f1ee86e4dc674d4c05b2fa8b3c7a8.zip llvm-ce9cef79ea3f1ee86e4dc674d4c05b2fa8b3c7a8.tar.gz llvm-ce9cef79ea3f1ee86e4dc674d4c05b2fa8b3c7a8.tar.bz2 |
[flang] Add support for -mprefer-vector-width=<value> (#142073)
This patch adds support for the -mprefer-vector-width= command line
option. The parsing of this options is equivalent to Clang's and it is
implemented by setting the "prefer-vector-width" function attribute.
Co-authored-by: Cameron McInally <cmcinally@nvidia.com>
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index ba25318..90a0029 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -309,6 +309,20 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts, for (auto *a : args.filtered(clang::driver::options::OPT_fpass_plugin_EQ)) opts.LLVMPassPlugins.push_back(a->getValue()); + // -mprefer_vector_width option + if (const llvm::opt::Arg *a = args.getLastArg( + clang::driver::options::OPT_mprefer_vector_width_EQ)) { + llvm::StringRef s = a->getValue(); + unsigned width; + if (s == "none") + opts.PreferVectorWidth = "none"; + else if (s.getAsInteger(10, width)) + diags.Report(clang::diag::err_drv_invalid_value) + << a->getAsString(args) << a->getValue(); + else + opts.PreferVectorWidth = s.str(); + } + // -fembed-offload-object option for (auto *a : args.filtered(clang::driver::options::OPT_fembed_offload_object_EQ)) |