diff options
author | Mike Rice <michael.p.rice@intel.com> | 2022-05-17 10:11:00 -0700 |
---|---|---|
committer | Mike Rice <michael.p.rice@intel.com> | 2022-05-24 10:28:59 -0700 |
commit | 9ba937112fa6d4076e4a98b587a334786b6c0d9c (patch) | |
tree | 2a591903e5099b93103cdaf137ca5906066834b1 /clang/lib/Sema/SemaOpenMP.cpp | |
parent | 8527f9e4437fbecb529babb674777eb2cab99ca5 (diff) | |
download | llvm-9ba937112fa6d4076e4a98b587a334786b6c0d9c.zip llvm-9ba937112fa6d4076e4a98b587a334786b6c0d9c.tar.gz llvm-9ba937112fa6d4076e4a98b587a334786b6c0d9c.tar.bz2 |
[OpenMP] Add parsing/sema support for omp_all_memory reserved locator
Adds support for the reserved locator 'omp_all_memory' for use
in depend clauses with 'out' or 'inout' dependence-types.
Differential Revision: https://reviews.llvm.org/D125828
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 42c3dbc..ce65fe4 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -16158,8 +16158,9 @@ OMPClause *Sema::ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation EndLoc) { if (Kind == OMPC_DEPEND_unknown || Kind == OMPC_DEPEND_source || Kind == OMPC_DEPEND_sink || Kind == OMPC_DEPEND_depobj) { - SmallVector<unsigned> Except = {OMPC_DEPEND_source, OMPC_DEPEND_sink, - OMPC_DEPEND_depobj}; + SmallVector<unsigned> Except = { + OMPC_DEPEND_source, OMPC_DEPEND_sink, OMPC_DEPEND_depobj, + OMPC_DEPEND_outallmemory, OMPC_DEPEND_inoutallmemory}; if (LangOpts.OpenMP < 51) Except.push_back(OMPC_DEPEND_inoutset); Diag(KindKwLoc, diag::err_omp_unexpected_clause_value) @@ -16969,20 +16970,17 @@ OMPClause *Sema::ActOnOpenMPFilterClause(Expr *ThreadID, StartLoc, LParenLoc, EndLoc); } -OMPClause *Sema::ActOnOpenMPVarListClause( - OpenMPClauseKind Kind, ArrayRef<Expr *> VarList, Expr *DepModOrTailExpr, - const OMPVarListLocTy &Locs, SourceLocation ColonLoc, - CXXScopeSpec &ReductionOrMapperIdScopeSpec, - DeclarationNameInfo &ReductionOrMapperId, int ExtraModifier, - ArrayRef<OpenMPMapModifierKind> MapTypeModifiers, - ArrayRef<SourceLocation> MapTypeModifiersLoc, bool IsMapTypeImplicit, - SourceLocation ExtraModifierLoc, - ArrayRef<OpenMPMotionModifierKind> MotionModifiers, - ArrayRef<SourceLocation> MotionModifiersLoc) { +OMPClause *Sema::ActOnOpenMPVarListClause(OpenMPClauseKind Kind, + ArrayRef<Expr *> VarList, + const OMPVarListLocTy &Locs, + OpenMPVarListDataTy &Data) { SourceLocation StartLoc = Locs.StartLoc; SourceLocation LParenLoc = Locs.LParenLoc; SourceLocation EndLoc = Locs.EndLoc; OMPClause *Res = nullptr; + int ExtraModifier = Data.ExtraModifier; + SourceLocation ExtraModifierLoc = Data.ExtraModifierLoc; + SourceLocation ColonLoc = Data.ColonLoc; switch (Kind) { case OMPC_private: Res = ActOnOpenMPPrivateClause(VarList, StartLoc, LParenLoc, EndLoc); @@ -17006,28 +17004,28 @@ OMPClause *Sema::ActOnOpenMPVarListClause( Res = ActOnOpenMPReductionClause( VarList, static_cast<OpenMPReductionClauseModifier>(ExtraModifier), StartLoc, LParenLoc, ExtraModifierLoc, ColonLoc, EndLoc, - ReductionOrMapperIdScopeSpec, ReductionOrMapperId); + Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId); break; case OMPC_task_reduction: - Res = ActOnOpenMPTaskReductionClause(VarList, StartLoc, LParenLoc, ColonLoc, - EndLoc, ReductionOrMapperIdScopeSpec, - ReductionOrMapperId); + Res = ActOnOpenMPTaskReductionClause( + VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, + Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId); break; case OMPC_in_reduction: - Res = ActOnOpenMPInReductionClause(VarList, StartLoc, LParenLoc, ColonLoc, - EndLoc, ReductionOrMapperIdScopeSpec, - ReductionOrMapperId); + Res = ActOnOpenMPInReductionClause( + VarList, StartLoc, LParenLoc, ColonLoc, EndLoc, + Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId); break; case OMPC_linear: assert(0 <= ExtraModifier && ExtraModifier <= OMPC_LINEAR_unknown && "Unexpected linear modifier."); Res = ActOnOpenMPLinearClause( - VarList, DepModOrTailExpr, StartLoc, LParenLoc, + VarList, Data.DepModOrTailExpr, StartLoc, LParenLoc, static_cast<OpenMPLinearClauseKind>(ExtraModifier), ExtraModifierLoc, ColonLoc, EndLoc); break; case OMPC_aligned: - Res = ActOnOpenMPAlignedClause(VarList, DepModOrTailExpr, StartLoc, + Res = ActOnOpenMPAlignedClause(VarList, Data.DepModOrTailExpr, StartLoc, LParenLoc, ColonLoc, EndLoc); break; case OMPC_copyin: @@ -17043,26 +17041,30 @@ OMPClause *Sema::ActOnOpenMPVarListClause( assert(0 <= ExtraModifier && ExtraModifier <= OMPC_DEPEND_unknown && "Unexpected depend modifier."); Res = ActOnOpenMPDependClause( - DepModOrTailExpr, static_cast<OpenMPDependClauseKind>(ExtraModifier), - ExtraModifierLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc); + {static_cast<OpenMPDependClauseKind>(ExtraModifier), ExtraModifierLoc, + ColonLoc, Data.OmpAllMemoryLoc}, + Data.DepModOrTailExpr, VarList, StartLoc, LParenLoc, EndLoc); break; case OMPC_map: assert(0 <= ExtraModifier && ExtraModifier <= OMPC_MAP_unknown && "Unexpected map modifier."); Res = ActOnOpenMPMapClause( - MapTypeModifiers, MapTypeModifiersLoc, ReductionOrMapperIdScopeSpec, - ReductionOrMapperId, static_cast<OpenMPMapClauseKind>(ExtraModifier), - IsMapTypeImplicit, ExtraModifierLoc, ColonLoc, VarList, Locs); + Data.MapTypeModifiers, Data.MapTypeModifiersLoc, + Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId, + static_cast<OpenMPMapClauseKind>(ExtraModifier), Data.IsMapTypeImplicit, + ExtraModifierLoc, ColonLoc, VarList, Locs); break; case OMPC_to: - Res = ActOnOpenMPToClause(MotionModifiers, MotionModifiersLoc, - ReductionOrMapperIdScopeSpec, ReductionOrMapperId, - ColonLoc, VarList, Locs); + Res = + ActOnOpenMPToClause(Data.MotionModifiers, Data.MotionModifiersLoc, + Data.ReductionOrMapperIdScopeSpec, + Data.ReductionOrMapperId, ColonLoc, VarList, Locs); break; case OMPC_from: - Res = ActOnOpenMPFromClause(MotionModifiers, MotionModifiersLoc, - ReductionOrMapperIdScopeSpec, - ReductionOrMapperId, ColonLoc, VarList, Locs); + Res = ActOnOpenMPFromClause(Data.MotionModifiers, Data.MotionModifiersLoc, + Data.ReductionOrMapperIdScopeSpec, + Data.ReductionOrMapperId, ColonLoc, VarList, + Locs); break; case OMPC_use_device_ptr: Res = ActOnOpenMPUseDevicePtrClause(VarList, Locs); @@ -17077,7 +17079,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause( Res = ActOnOpenMPHasDeviceAddrClause(VarList, Locs); break; case OMPC_allocate: - Res = ActOnOpenMPAllocateClause(DepModOrTailExpr, VarList, StartLoc, + Res = ActOnOpenMPAllocateClause(Data.DepModOrTailExpr, VarList, StartLoc, LParenLoc, ColonLoc, EndLoc); break; case OMPC_nontemporal: @@ -17091,7 +17093,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause( break; case OMPC_affinity: Res = ActOnOpenMPAffinityClause(StartLoc, LParenLoc, ColonLoc, EndLoc, - DepModOrTailExpr, VarList); + Data.DepModOrTailExpr, VarList); break; case OMPC_if: case OMPC_depobj: @@ -19684,10 +19686,12 @@ OMPClause *Sema::ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, } OMPClause * -Sema::ActOnOpenMPDependClause(Expr *DepModifier, OpenMPDependClauseKind DepKind, - SourceLocation DepLoc, SourceLocation ColonLoc, - ArrayRef<Expr *> VarList, SourceLocation StartLoc, - SourceLocation LParenLoc, SourceLocation EndLoc) { +Sema::ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, + Expr *DepModifier, ArrayRef<Expr *> VarList, + SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc) { + OpenMPDependClauseKind DepKind = Data.DepKind; + SourceLocation DepLoc = Data.DepLoc; if (DSAStack->getCurrentDirective() == OMPD_ordered && DepKind != OMPC_DEPEND_source && DepKind != OMPC_DEPEND_sink) { Diag(DepLoc, diag::err_omp_unexpected_clause_value) @@ -19706,9 +19710,9 @@ Sema::ActOnOpenMPDependClause(Expr *DepModifier, OpenMPDependClauseKind DepKind, ((LangOpts.OpenMP < 50 || DSAStack->getCurrentDirective() == OMPD_depobj) && DepKind == OMPC_DEPEND_depobj))) { - SmallVector<unsigned, 3> Except; - Except.push_back(OMPC_DEPEND_source); - Except.push_back(OMPC_DEPEND_sink); + SmallVector<unsigned, 6> Except = {OMPC_DEPEND_source, OMPC_DEPEND_sink, + OMPC_DEPEND_outallmemory, + OMPC_DEPEND_inoutallmemory}; if (LangOpts.OpenMP < 50 || DSAStack->getCurrentDirective() == OMPD_depobj) Except.push_back(OMPC_DEPEND_depobj); if (LangOpts.OpenMP < 51) @@ -19934,12 +19938,14 @@ Sema::ActOnOpenMPDependClause(Expr *DepModifier, OpenMPDependClauseKind DepKind, << 1 << DSAStack->getParentLoopControlVariable(VarList.size() + 1); } if (DepKind != OMPC_DEPEND_source && DepKind != OMPC_DEPEND_sink && - Vars.empty()) + DepKind != OMPC_DEPEND_outallmemory && + DepKind != OMPC_DEPEND_inoutallmemory && Vars.empty()) return nullptr; - auto *C = OMPDependClause::Create(Context, StartLoc, LParenLoc, EndLoc, - DepModifier, DepKind, DepLoc, ColonLoc, - Vars, TotalDepCount.getZExtValue()); + auto *C = OMPDependClause::Create( + Context, StartLoc, LParenLoc, EndLoc, + {DepKind, DepLoc, Data.ColonLoc, Data.OmpAllMemoryLoc}, DepModifier, Vars, + TotalDepCount.getZExtValue()); if ((DepKind == OMPC_DEPEND_sink || DepKind == OMPC_DEPEND_source) && DSAStack->isParentOrderedRegion()) DSAStack->addDoacrossDependClause(C, OpsOffs); |