diff options
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h b/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h index a05b0bd..21707ad 100644 --- a/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h +++ b/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h @@ -64,13 +64,13 @@ protected: // doesn't restore it aftewards. void createReductionRecipeCombiner(mlir::Location loc, mlir::Location locEnd, mlir::Value mainOp, - mlir::acc::ReductionRecipeOp recipe); - void createPrivateInitRecipe(mlir::Location loc, mlir::Location locEnd, - SourceRange exprRange, mlir::Value mainOp, - mlir::acc::PrivateRecipeOp recipe, - size_t numBounds, - llvm::ArrayRef<QualType> boundTypes, - const VarDecl *allocaDecl, QualType origType); + mlir::acc::ReductionRecipeOp recipe, + size_t numBounds); + void createInitRecipe(mlir::Location loc, mlir::Location locEnd, + SourceRange exprRange, mlir::Value mainOp, + mlir::Region &recipeInitRegion, size_t numBounds, + llvm::ArrayRef<QualType> boundTypes, + const VarDecl *allocaDecl, QualType origType); void createRecipeDestroySection(mlir::Location loc, mlir::Location locEnd, mlir::Value mainOp, CharUnits alignment, @@ -224,10 +224,10 @@ public: // TODO: OpenACC: This is a bit of a hackery to get this to not change for // the non-private recipes. This will be removed soon, when we get this // 'right' for firstprivate and reduction. - if constexpr (!std::is_same_v<RecipeTy, mlir::acc::PrivateRecipeOp>) { + if constexpr (std::is_same_v<RecipeTy, mlir::acc::FirstprivateRecipeOp>) { if (numBounds) { cgf.cgm.errorNYI(varRef->getSourceRange(), - "firstprivate/reduction-init with bounds"); + "firstprivate-init with bounds"); } boundTypes = {}; numBounds = 0; @@ -260,18 +260,25 @@ public: insertLocation = modBuilder.saveInsertionPoint(); if constexpr (std::is_same_v<RecipeTy, mlir::acc::PrivateRecipeOp>) { - createPrivateInitRecipe(loc, locEnd, varRef->getSourceRange(), mainOp, - recipe, numBounds, boundTypes, varRecipe, - origType); + createInitRecipe(loc, locEnd, varRef->getSourceRange(), mainOp, + recipe.getInitRegion(), numBounds, boundTypes, varRecipe, + origType); + } else if constexpr (std::is_same_v<RecipeTy, + mlir::acc::ReductionRecipeOp>) { + createInitRecipe(loc, locEnd, varRef->getSourceRange(), mainOp, + recipe.getInitRegion(), numBounds, boundTypes, varRecipe, + origType); + createReductionRecipeCombiner(loc, locEnd, mainOp, recipe, numBounds); } else { + static_assert(std::is_same_v<RecipeTy, mlir::acc::FirstprivateRecipeOp>); + // TODO: OpenACC: we probably want this to call createInitRecipe as well, + // but do so in a way that omits the 'initialization', so that we can do + // it separately, since it belongs in the 'copy' region. It also might + // need a way of getting the tempDeclEmission out of it for that purpose. createRecipeInitCopy(loc, locEnd, varRef->getSourceRange(), mainOp, recipe, varRecipe, temporary); } - if constexpr (std::is_same_v<RecipeTy, mlir::acc::ReductionRecipeOp>) { - createReductionRecipeCombiner(loc, locEnd, mainOp, recipe); - } - if (origType.isDestructedType()) createRecipeDestroySection( loc, locEnd, mainOp, cgf.getContext().getDeclAlign(varRecipe), |