Skip to content

Commit c68c289

Browse files
[Flang][OpenMP] Add support for proc_bind=primary (#99319)
The support was missing only in the parser, all other phases handle the primary option for proc_bind. Fixes one of the issues in parsing for gomp/affinity-1.f90. (https://discourse.llvm.org/t/proposal-rename-flang-new-to-flang/69462/60)
1 parent b8c4c58 commit c68c289

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ TYPE_PARSER(construct<OmpDefaultClause>(
3131
"SHARED" >> pure(OmpDefaultClause::Type::Shared) ||
3232
"NONE" >> pure(OmpDefaultClause::Type::None)))
3333

34-
// 2.5 PROC_BIND (MASTER | CLOSE | SPREAD)
34+
// 2.5 PROC_BIND (MASTER | CLOSE | PRIMARY | SPREAD )
3535
TYPE_PARSER(construct<OmpProcBindClause>(
3636
"CLOSE" >> pure(OmpProcBindClause::Type::Close) ||
3737
"MASTER" >> pure(OmpProcBindClause::Type::Master) ||
38+
"PRIMARY" >> pure(OmpProcBindClause::Type::Primary) ||
3839
"SPREAD" >> pure(OmpProcBindClause::Type::Spread)))
3940

4041
// 2.15.5.1 MAP ([ [ALWAYS[,]] map-type : ] variable-name-list)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
! RUN: %flang_fc1 -fdebug-unparse -fopenmp %s | FileCheck --ignore-case %s
2+
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
3+
4+
! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY)
5+
6+
! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
7+
! PARSE-TREE: OmpBeginBlockDirective
8+
! PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = parallel
9+
! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> Type = Primary
10+
subroutine sb1
11+
!$omp parallel proc_bind(primary)
12+
print *, "Hello"
13+
!$omp end parallel
14+
end subroutine

0 commit comments

Comments
 (0)