Files
clang-p2996/flang/test/Lower/OpenMP/sections-pft.f90
Shraiysh Vaishay ae1623b306 [flang][Parser] Add a node for individual sections in sections construct
This patch adds parser nodes for each indivudual section in sections
construct. This should help with the translation to FIR. `!$omp section`
was not recognized as a construct and hence needed special handling.

`OpenMPSectionsConstruct` contains a list of `OpenMPConstruct`. Each
such `OpenMPConstruct` wraps an `OpenMPSectionConstruct`
(section, not sections). An `OpenMPSectionConstruct` is a wrapper around
a `Block`.

Reviewed By: kiranchandramohan, peixin

Differential Revision: https://reviews.llvm.org/D121680
2022-03-18 21:55:35 +05:30

92 lines
2.3 KiB
Fortran

! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
subroutine openmp_sections(x, y)
integer, intent(inout)::x, y
!==============================================================================
! empty construct
!==============================================================================
!$omp sections
!$omp end sections
!CHECK: OpenMPConstruct
!CHECK: End OpenMPConstruct
!==============================================================================
! single section, without `!$omp section`
!==============================================================================
!$omp sections
call F1()
!$omp end sections
!CHECK: OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: End OpenMPConstruct
!==============================================================================
! single section with `!$omp section`
!==============================================================================
!$omp sections
!$omp section
call F1
!$omp end sections
!CHECK: OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: End OpenMPConstruct
!==============================================================================
! multiple sections
!==============================================================================
!$omp sections
!$omp section
call F1
!$omp section
call F2
!$omp section
call F3
!$omp end sections
!CHECK: OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: End OpenMPConstruct
!==============================================================================
! multiple sections with clauses
!==============================================================================
!$omp sections PRIVATE(x) FIRSTPRIVATE(y)
!$omp section
call F1
!$omp section
call F2
!$omp section
call F3
!$omp end sections NOWAIT
!CHECK: OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: OpenMPConstruct
!CHECK: CallStmt
!CHECK: End OpenMPConstruct
!CHECK: End OpenMPConstruct
end subroutine openmp_sections