Enable CUDA Fortran for bbc

This commit is contained in:
Zhen Wang 2023-07-24 11:28:27 -07:00
parent 4ce7c4a92a
commit c5abddbf29
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,11 @@
! Test -fcuda option for bbc
! RUN: bbc -fcuda -o - %s | FileCheck %s
! CHECK-NOT: Unknown command line argument
program main
#if _CUDA
integer :: var = _CUDA
#endif
integer, device :: dvar
end program

View File

@ -190,6 +190,10 @@ static llvm::cl::opt<bool> useHLFIR("hlfir",
llvm::cl::desc("Lower to high level FIR"),
llvm::cl::init(false));
static llvm::cl::opt<bool> enableCUDA("fcuda",
llvm::cl::desc("enable CUDA Fortran"),
llvm::cl::init(false));
#define FLANG_EXCLUDE_CODEGEN
#include "flang/Tools/CLOptions.inc"
@ -412,6 +416,11 @@ int main(int argc, char **argv) {
options.predefinitions.emplace_back("_OPENACC", "202211");
}
// enable parsing of CUDA Fortran
if (enableCUDA) {
options.features.Enable(Fortran::common::LanguageFeature::CUDA);
}
Fortran::common::IntrinsicTypeDefaultKinds defaultKinds;
Fortran::parser::AllSources allSources;
Fortran::parser::AllCookedSources allCookedSources(allSources);