From d93bdd8bd52a9a28bb9553aed72866df88c6c4f4 Mon Sep 17 00:00:00 2001 From: Dominik Adamski Date: Fri, 19 May 2023 06:14:52 -0500 Subject: [OpenMP][MLIR][Flang][bbc][Driver] Add fopenmp-version and generate corresponding MLIR attribute This patch adds flag -fopenmp-version to the Flang frontend and bbc tool. This flag is lowered to MLIR OpenMP flag attribute. Differential Revision: https://reviews.llvm.org/D150354 Reviewed By: kiranchandramohan --- flang/lib/Frontend/CompilerInvocation.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 84478f2..1264907 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -720,9 +720,15 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, Fortran::common::LanguageFeature::OpenACC); } if (args.hasArg(clang::driver::options::OPT_fopenmp)) { + // By default OpenMP is set to 1.1 version + res.getLangOpts().OpenMPVersion = 11; res.getFrontendOpts().features.Enable( Fortran::common::LanguageFeature::OpenMP); - + if (int Version = getLastArgIntValue( + args, clang::driver::options::OPT_fopenmp_version_EQ, + res.getLangOpts().OpenMPVersion, diags)) { + res.getLangOpts().OpenMPVersion = Version; + } if (args.hasArg(clang::driver::options::OPT_fopenmp_is_device)) { res.getLangOpts().OpenMPIsDevice = 1; -- cgit v1.1