diff options
author | Valentin Clement <clementval@gmail.com> | 2022-03-09 20:35:14 +0300 |
---|---|---|
committer | Valentin Clement <clementval@gmail.com> | 2022-03-09 20:37:15 +0300 |
commit | 140aabec43d685ad3b957a4c8649112fde74031e (patch) | |
tree | 07530837cddb5ea99dbd2bce23dc9dac896f3f38 /flang | |
parent | 28322c25148e0dc70a48363b9b238520a612719d (diff) |
[flang] Add OpenACC flag to bbc
Add `-fopenacc` flag to the `bbc` tool.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D121117
Diffstat (limited to 'flang')
-rw-r--r-- | flang/test/Lower/OpenACC/pre-fir-tree01.f90 | 18 | ||||
-rw-r--r-- | flang/tools/bbc/bbc.cpp | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/flang/test/Lower/OpenACC/pre-fir-tree01.f90 b/flang/test/Lower/OpenACC/pre-fir-tree01.f90 new file mode 100644 index 000000000000..b1b4205856db --- /dev/null +++ b/flang/test/Lower/OpenACC/pre-fir-tree01.f90 @@ -0,0 +1,18 @@ +! RUN: bbc -fopenacc -pft-test -o %t %s | FileCheck %s +! RUN: %flang_fc1 -fopenacc -fdebug-dump-pft -o %t %s | FileCheck %s + +! Test structure of the Pre-FIR tree with OpenACC + +subroutine sub1(a, b, n) + real :: a(:), b(:) + integer :: n, i + !$acc parallel loop present(a, b) + do i = 1, n + b(i) = exp(a(i)) + end do +end subroutine + +! CHECK-LABEL: Subroutine sub1 +! CHECK: <<OpenACCConstruct>> +! CHECK: <<DoConstruct>> +! CHECK: <<End OpenACCConstruct>> diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp index a4a77855c279..81ab7895c4a4 100644 --- a/flang/tools/bbc/bbc.cpp +++ b/flang/tools/bbc/bbc.cpp @@ -84,6 +84,10 @@ static llvm::cl::opt<bool> enableOpenMP("fopenmp", llvm::cl::desc("enable openmp"), llvm::cl::init(false)); +static llvm::cl::opt<bool> enableOpenACC("fopenacc", + llvm::cl::desc("enable openacc"), + llvm::cl::init(false)); + #define FLANG_EXCLUDE_CODEGEN #include "flang/Tools/CLOptions.inc" @@ -251,6 +255,12 @@ int main(int argc, char **argv) { options.predefinitions.emplace_back("_OPENMP", "201511"); } + // enable parsing of OpenACC + if (enableOpenACC) { + options.features.Enable(Fortran::common::LanguageFeature::OpenACC); + options.predefinitions.emplace_back("_OPENACC", "201911"); + } + Fortran::common::IntrinsicTypeDefaultKinds defaultKinds; Fortran::parser::AllSources allSources; Fortran::parser::AllCookedSources allCookedSources(allSources); |