diff options
author | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-04-24 09:46:03 -0500 |
---|---|---|
committer | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-04-24 10:06:21 -0500 |
commit | 2e634367be6a2ed6b8a4ee5c29b720dd90c0d70a (patch) | |
tree | 798cdc22286454e3588deacfb5f19103b2a6b8c2 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | ebd6b5dc6426c5a759d9ed588fe6b972319736ff (diff) | |
download | llvm-2e634367be6a2ed6b8a4ee5c29b720dd90c0d70a.zip llvm-2e634367be6a2ed6b8a4ee5c29b720dd90c0d70a.tar.gz llvm-2e634367be6a2ed6b8a4ee5c29b720dd90c0d70a.tar.bz2 |
[Flang][OpenMP][Driver][MLIR] Port fopenmp-host-ir-file-path flag and add MLIR module attribute to proliferate to OpenMP IR lowering
This patch ports the fopenmp-host-ir-file-path flag from Clang to Flang-new, this flag
is added by the driver to the device pass when doing two phase compilation (device + host).
This flag is then applied to the module when compiling during the OpenMP device phase.
This file can then be utilised during lowering of the OpenMP dialect to LLVM-IR, which
allows the device and host to maintain 1:1 mapping of OpenMP metadata for variables
during lowering via the OpenMPIRBuilders loadOffloadInfoMetadata facilities
(which is used for declare target and I believe target regions as well).
Reviewer: awarzynski
Differential Revision: https://reviews.llvm.org/D148038
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index c6d5152..6672777 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -726,6 +726,16 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, if (args.hasArg(clang::driver::options::OPT_fopenmp_is_device)) { res.getLangOpts().OpenMPIsDevice = 1; + // Get OpenMP host file path if any and report if a non existent file is + // found + if (auto *arg = args.getLastArg( + clang::driver::options::OPT_fopenmp_host_ir_file_path)) { + res.getLangOpts().OMPHostIRFile = arg->getValue(); + if (!llvm::sys::fs::exists(res.getLangOpts().OMPHostIRFile)) + diags.Report(clang::diag::err_drv_omp_host_ir_file_not_found) + << res.getLangOpts().OMPHostIRFile; + } + if (args.hasFlag( clang::driver::options::OPT_fopenmp_assume_teams_oversubscription, clang::driver::options:: |