[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
This commit is contained in:
Valentin Clement 2022-03-09 18:35:14 +01:00
parent 28322c2514
commit 140aabec43
No known key found for this signature in database
GPG key ID: 086D54783C928776
2 changed files with 28 additions and 0 deletions

View file

@ -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>>

View file

@ -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);