From e002a38b20e3ac40aecbbfa0774f8ba7b9690b0c Mon Sep 17 00:00:00 2001 From: Andrew Gozillon Date: Tue, 7 Mar 2023 12:39:16 -0600 Subject: [Flang][OpenMP][MLIR][Driver][bbc] Add -fopenmp-is-device flag to Flang -fc1 & the bbc tool, and omp.is_device attribute Adds the -fopenmp-is-device flag to bbc and Flang's -fc1 (but not flang-new) and in addition adds an omp.is_device attribute onto the module when fopenmp is passed, this is a boolean attribute that is set to false or true dependent on if fopenmp-is-device is specified alongside the fopenmp flag on the commandline when invoking flang or bbc. Reviewers: awarzynski kiranchandramohan Differential Revision: https://reviews.llvm.org/D144864 --- flang/lib/Frontend/CompilerInvocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 4fb1eb8..d043444 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -670,6 +670,10 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, if (args.hasArg(clang::driver::options::OPT_fopenmp)) { res.getFrontendOpts().features.Enable( Fortran::common::LanguageFeature::OpenMP); + + if (args.hasArg(clang::driver::options::OPT_fopenmp_is_device)) { + res.getLangOpts().OpenMPIsDevice = 1; + } } // -pedantic -- cgit v1.1