Skip to content

Commit 1ca3cea

Browse files
ddpaganIcohedron
authored andcommitted
[clang][OpenMP] New OpenMP 6.0 assumption clause, 'no_openmp_constructs' (llvm#125933)
Add initial parsing/sema support for new assumption clause so clause can be specified. For now, it's ignored, just like the others. Added support for 'no_openmp_construct' to release notes. Testing - Updated appropriate LIT tests. - Testing: check-all
1 parent 80b5e55 commit 1ca3cea

26 files changed

+158
-68
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ implementation.
412412
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
413413
| Extensions to interop construct | :none:`unclaimed` | :none:`unclaimed` | |
414414
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
415-
| no_openmp_constructs | :none:`unclaimed` | :none:`unclaimed` | |
415+
| no_openmp_constructs | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/125933 |
416416
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
417417
| safe_sync and progress with identifier and API | :none:`unclaimed` | :none:`unclaimed` | |
418418
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Python Binding Changes
278278

279279
OpenMP Support
280280
--------------
281+
- Added support 'no_openmp_constructs' assumption clause.
281282

282283
Improvements
283284
^^^^^^^^^^^^

clang/include/clang/AST/OpenMPClause.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,28 @@ class OMPNoOpenMPRoutinesClause final
24232423
OMPNoOpenMPRoutinesClause() : OMPNoChildClause() {}
24242424
};
24252425

2426+
/// This represents the 'no_openmp_constructs' clause in the
2427+
//// '#pragma omp assume' directive.
2428+
///
2429+
/// \code
2430+
/// #pragma omp assume no_openmp_constructs
2431+
/// \endcode
2432+
/// In this example directive '#pragma omp assume' has a 'no_openmp_constructs'
2433+
/// clause.
2434+
class OMPNoOpenMPConstructsClause final
2435+
: public OMPNoChildClause<llvm::omp::OMPC_no_openmp_constructs> {
2436+
public:
2437+
/// Build 'no_openmp_constructs' clause.
2438+
///
2439+
/// \param StartLoc Starting location of the clause.
2440+
/// \param EndLoc Ending location of the clause.
2441+
OMPNoOpenMPConstructsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2442+
: OMPNoChildClause(StartLoc, EndLoc) {}
2443+
2444+
/// Build an empty clause.
2445+
OMPNoOpenMPConstructsClause() : OMPNoChildClause() {}
2446+
};
2447+
24262448
/// This represents the 'no_parallelism' clause in the '#pragma omp assume'
24272449
/// directive.
24282450
///

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,6 +3544,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPRoutinesClause(
35443544
return true;
35453545
}
35463546

3547+
template <typename Derived>
3548+
bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPConstructsClause(
3549+
OMPNoOpenMPConstructsClause *) {
3550+
return true;
3551+
}
3552+
35473553
template <typename Derived>
35483554
bool RecursiveASTVisitor<Derived>::VisitOMPNoParallelismClause(
35493555
OMPNoParallelismClause *) {

clang/include/clang/Basic/AttrDocs.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5274,6 +5274,7 @@ optimization passes are aware of the following assumptions:
52745274
"omp_no_openmp"
52755275
"omp_no_openmp_routines"
52765276
"omp_no_parallelism"
5277+
"omp_no_openmp_constructs"
52775278

52785279
The OpenMP standard defines the meaning of OpenMP assumptions ("omp_XYZ" is
52795280
spelled "XYZ" in the `OpenMP 5.1 Standard`_).

clang/lib/AST/OpenMPClause.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,6 +2073,11 @@ void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
20732073
OS << "no_openmp_routines";
20742074
}
20752075

2076+
void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2077+
OMPNoOpenMPConstructsClause *) {
2078+
OS << "no_openmp_constructs";
2079+
}
2080+
20762081
void OMPClausePrinter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {
20772082
OS << "no_parallelism";
20782083
}

clang/lib/AST/StmtProfile.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ void OMPClauseProfiler::VisitOMPNoOpenMPClause(const OMPNoOpenMPClause *) {}
606606
void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
607607
const OMPNoOpenMPRoutinesClause *) {}
608608

609+
void OMPClauseProfiler::VisitOMPNoOpenMPConstructsClause(
610+
const OMPNoOpenMPConstructsClause *) {}
611+
609612
void OMPClauseProfiler::VisitOMPNoParallelismClause(
610613
const OMPNoParallelismClause *) {}
611614

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,7 @@ void Parser::ParseOpenMPClauses(OpenMPDirectiveKind DKind,
16931693
/// 'holds' '(' scalar-expression ')'
16941694
/// 'no_openmp'
16951695
/// 'no_openmp_routines'
1696+
/// 'no_openmp_constructs' (OpenMP 6.0)
16961697
/// 'no_parallelism'
16971698
///
16981699
void Parser::ParseOpenMPAssumesDirective(OpenMPDirectiveKind DKind,
@@ -3474,6 +3475,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
34743475
}
34753476
case OMPC_no_openmp:
34763477
case OMPC_no_openmp_routines:
3478+
case OMPC_no_openmp_constructs:
34773479
case OMPC_no_parallelism: {
34783480
if (!FirstClause) {
34793481
Diag(Tok, diag::err_omp_more_one_clause)

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23763,6 +23763,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPNullaryAssumptionClause(OpenMPClauseKind CK,
2376323763
return new (getASTContext()) OMPNoOpenMPRoutinesClause(Loc, RLoc);
2376423764
case OMPC_no_parallelism:
2376523765
return new (getASTContext()) OMPNoParallelismClause(Loc, RLoc);
23766+
case OMPC_no_openmp_constructs:
23767+
return new (getASTContext()) OMPNoOpenMPConstructsClause(Loc, RLoc);
2376623768
default:
2376723769
llvm_unreachable("Unexpected OpenMP clause");
2376823770
}

clang/lib/Sema/TreeTransform.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10627,6 +10627,11 @@ OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPRoutinesClause(
1062710627
return C;
1062810628
}
1062910629
template <typename Derived>
10630+
OMPClause *TreeTransform<Derived>::TransformOMPNoOpenMPConstructsClause(
10631+
OMPNoOpenMPConstructsClause *C) {
10632+
return C;
10633+
}
10634+
template <typename Derived>
1063010635
OMPClause *TreeTransform<Derived>::TransformOMPNoParallelismClause(
1063110636
OMPNoParallelismClause *C) {
1063210637
return C;

0 commit comments

Comments
 (0)