aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorValentin Clement (バレンタイン クレメン) <clementval@gmail.com>2024-03-13 09:14:40 -0700
committerGitHub <noreply@github.com>2024-03-13 09:14:40 -0700
commit8a8ef1cacfcd7745d2b6ad00431e6fa9ab9a2fb4 (patch)
tree355e4c61b21d78fe6713e8103eaa8d8e68d1adda /flang/lib/Frontend/CompilerInvocation.cpp
parentf1015d1701d86c4e640cdbfd1928a958aea921d6 (diff)
downloadllvm-8a8ef1cacfcd7745d2b6ad00431e6fa9ab9a2fb4.zip
llvm-8a8ef1cacfcd7745d2b6ad00431e6fa9ab9a2fb4.tar.gz
llvm-8a8ef1cacfcd7745d2b6ad00431e6fa9ab9a2fb4.tar.bz2
[flang][cuda] Enable cuda with -x cuda option (#84944)
Flang driver was already able to enable the CUDA language feature base on the file extension but there was no command line option. This PR adds one.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 4707de0..2e3fa1f 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -581,6 +581,8 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
// pre-processed inputs.
.Case("f95", Language::Fortran)
.Case("f95-cpp-input", Language::Fortran)
+ // CUDA Fortran
+ .Case("cuda", Language::Fortran)
.Default(Language::Unknown);
// Flang's intermediate representations.
@@ -877,6 +879,13 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
if (args.hasArg(clang::driver::options::OPT_flarge_sizes))
res.getDefaultKinds().set_sizeIntegerKind(8);
+ // -x cuda
+ auto language = args.getLastArgValue(clang::driver::options::OPT_x);
+ if (language.equals("cuda")) {
+ res.getFrontendOpts().features.Enable(
+ Fortran::common::LanguageFeature::CUDA);
+ }
+
// -fopenmp and -fopenacc
if (args.hasArg(clang::driver::options::OPT_fopenacc)) {
res.getFrontendOpts().features.Enable(