Lines Matching +full:compute +full:-
1 //===--- SemaOpenACC.cpp - Semantic Analysis for OpenACC constructs -------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
357 return C->getClauseKind() == Clause.getClauseKind(); in checkAlreadyHasClauseOfKind()
362 S.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in checkAlreadyHasClauseOfKind()
371 // This is only a requirement on compute and loop constructs so far, so this in checkValidAfterDeviceType()
379 // the directive or up to the next device_type clause are device-specific in checkValidAfterDeviceType()
465 << Clause.getClauseKind() << (*Itr)->getClauseKind(); in Visit()
466 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in Visit()
495 // Restrictions only properly implemented on 'compute' constructs, and in VisitDefaultClause()
496 // 'compute' constructs are the only construct that can do anything with in VisitDefaultClause()
519 // Restrictions only properly implemented on 'compute' constructs, and in VisitIfClause()
520 // 'compute' constructs are the only construct that can do anything with in VisitIfClause()
542 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitIfClause()
552 // Restrictions only properly implemented on 'compute' constructs, and in VisitSelfClause()
553 // 'compute' constructs are the only construct that can do anything with in VisitSelfClause()
559 // 'var-list' instead of a condition expression, so semantics/handling has in VisitSelfClause()
576 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitSelfClause()
585 // Restrictions only properly implemented on 'compute' constructs, and in VisitNumGangsClause()
586 // 'compute' constructs are the only construct that can do anything with in VisitNumGangsClause()
628 SemaRef.Diag((*Parallel)->getBeginLoc(), in VisitNumGangsClause()
640 // Restrictions only properly implemented on 'compute' constructs, and in VisitNumWorkersClause()
641 // 'compute' constructs are the only construct that can do anything with in VisitNumWorkersClause()
661 // Restrictions only properly implemented on 'compute' constructs, and in VisitVectorLengthClause()
662 // 'compute' constructs are the only construct that can do anything with in VisitVectorLengthClause()
682 // Restrictions only properly implemented on 'compute' constructs, and in VisitAsyncClause()
683 // 'compute' constructs are the only construct that can do anything with in VisitAsyncClause()
704 // Restrictions only properly implemented on 'compute' and 'loop' in VisitPrivateClause()
705 // constructs, and 'compute'/'loop' constructs are the only construct that in VisitPrivateClause()
713 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitPrivateClause()
723 // Restrictions only properly implemented on 'compute' constructs, and in VisitFirstPrivateClause()
724 // 'compute' constructs are the only construct that can do anything with in VisitFirstPrivateClause()
730 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitFirstPrivateClause()
740 // Restrictions only properly implemented on 'compute' constructs, and in VisitNoCreateClause()
741 // 'compute' constructs are the only construct that can do anything with in VisitNoCreateClause()
746 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitNoCreateClause()
756 // Restrictions only properly implemented on 'compute' constructs, and in VisitPresentClause()
757 // 'compute' constructs are the only construct that can do anything with in VisitPresentClause()
762 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitPresentClause()
772 // Restrictions only properly implemented on 'compute' constructs, and in VisitCopyClause()
773 // 'compute' constructs are the only construct that can do anything with in VisitCopyClause()
778 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitCopyClause()
788 // Restrictions only properly implemented on 'compute' constructs, and in VisitCopyInClause()
789 // 'compute' constructs are the only construct that can do anything with in VisitCopyInClause()
794 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitCopyInClause()
804 // Restrictions only properly implemented on 'compute' constructs, and in VisitCopyOutClause()
805 // 'compute' constructs are the only construct that can do anything with in VisitCopyOutClause()
810 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitCopyOutClause()
820 // Restrictions only properly implemented on 'compute' constructs, and in VisitCreateClause()
821 // 'compute' constructs are the only construct that can do anything with in VisitCreateClause()
826 // really isn't anything to do here. GCC does some duplicate-finding, though in VisitCreateClause()
836 // Restrictions only properly implemented on 'compute' constructs, and in VisitAttachClause()
837 // 'compute' constructs are the only construct that can do anything with in VisitAttachClause()
857 // Restrictions only properly implemented on 'compute' constructs, and in VisitDevicePtrClause()
858 // 'compute' constructs are the only construct that can do anything with in VisitDevicePtrClause()
879 // Restrictions only properly implemented on 'compute' constructs, and in VisitWaitClause()
880 // 'compute' constructs are the only construct that can do anything with in VisitWaitClause()
892 // Restrictions only properly implemented on 'compute' and 'loop' in VisitDeviceTypeClause()
893 // constructs, and 'compute'/'loop' constructs are the only construct that in VisitDeviceTypeClause()
925 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitAutoClause()
948 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitIndependentClause()
972 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitSeqClause()
985 << Clause.getClauseKind() << (*Itr)->getClauseKind(); in VisitSeqClause()
986 SemaRef.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitSeqClause()
999 // Restrictions only properly implemented on 'compute' constructs, and in VisitReductionClause()
1000 // 'compute' constructs are the only construct that can do anything with in VisitReductionClause()
1014 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size(); in VisitReductionClause()
1020 SemaRef.Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here); in VisitReductionClause()
1048 // Compute constructs end up taking their 'loop'. in AssociatedStmtRAII()
1095 assert((!Result || Result->getClauseKind() == Clause.getClauseKind()) && in ActOnClause()
1140 // << Clause.getClauseKind() << (*Itr)->getClauseKind(); in ActOnClause()
1141 // Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here); in ActOnClause()
1159 VarExpr = VarExpr->IgnoreParenCasts(); in CheckReductionVar()
1162 return Ty->isDependentType() || Ty->isScalarType(); in CheckReductionVar()
1171 Diag(VarExpr->getExprLoc(), diag::err_acc_reduction_type) in CheckReductionVar()
1175 } else if (auto *RD = VarExpr->getType()->getAsRecordDecl()) { in CheckReductionVar()
1176 if (!RD->isStruct() && !RD->isClass()) { in CheckReductionVar()
1177 Diag(VarExpr->getExprLoc(), diag::err_acc_reduction_composite_type) in CheckReductionVar()
1178 << /*not class or struct*/ 0 << VarExpr->getType(); in CheckReductionVar()
1182 if (!RD->isCompleteDefinition()) { in CheckReductionVar()
1183 Diag(VarExpr->getExprLoc(), diag::err_acc_reduction_composite_type) in CheckReductionVar()
1184 << /*incomplete*/ 1 << VarExpr->getType(); in CheckReductionVar()
1188 CXXRD && !CXXRD->isAggregate()) { in CheckReductionVar()
1189 Diag(VarExpr->getExprLoc(), diag::err_acc_reduction_composite_type) in CheckReductionVar()
1190 << /*aggregate*/ 2 << VarExpr->getType(); in CheckReductionVar()
1194 for (FieldDecl *FD : RD->fields()) { in CheckReductionVar()
1195 if (!TypeIsValid(FD->getType())) { in CheckReductionVar()
1196 Diag(VarExpr->getExprLoc(), in CheckReductionVar()
1198 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc); in CheckReductionVar()
1202 } else if (!TypeIsValid(VarExpr->getType())) { in CheckReductionVar()
1203 Diag(VarExpr->getExprLoc(), diag::err_acc_reduction_type) in CheckReductionVar()
1204 << VarExpr->getType() << /*Sub array base type*/ 0; in CheckReductionVar()
1217 // ensure that we can still work and don't check any construct-specific in ActOnConstruct()
1271 return T->isIntegerType(); in ActOnIntExpr()
1282 << T << IntExpr->getSourceRange(); in ActOnIntExpr()
1295 return S.Diag(Conv->getLocation(), diag::note_acc_int_expr_conversion) in ActOnIntExpr()
1296 << ConvTy->isEnumeralType() << ConvTy; in ActOnIntExpr()
1306 return S.Diag(Conv->getLocation(), diag::note_acc_int_expr_conversion) in ActOnIntExpr()
1307 << ConvTy->isEnumeralType() << ConvTy; in ActOnIntExpr()
1323 if (!IntExpr->isTypeDependent() && !IntExpr->getType()->isIntegerType()) in ActOnIntExpr()
1338 if (!VarExpr || VarExpr->containsErrors()) in CheckVarIsPointerType()
1341 if (isa<ArraySectionExpr>(VarExpr->IgnoreParenImpCasts()) || in CheckVarIsPointerType()
1342 VarExpr->hasPlaceholderType(BuiltinType::ArraySection)) { in CheckVarIsPointerType()
1343 Diag(VarExpr->getExprLoc(), diag::err_array_section_use) << /*OpenACC=*/0; in CheckVarIsPointerType()
1344 Diag(VarExpr->getExprLoc(), diag::note_acc_expected_pointer_var); in CheckVarIsPointerType()
1348 QualType Ty = VarExpr->getType(); in CheckVarIsPointerType()
1352 if (Ty->isDependentType()) in CheckVarIsPointerType()
1355 if (!Ty->isPointerType()) in CheckVarIsPointerType()
1356 return Diag(VarExpr->getExprLoc(), diag::err_acc_var_not_pointer_type) in CheckVarIsPointerType()
1362 Expr *CurVarExpr = VarExpr->IgnoreParenImpCasts(); in ActOnVar()
1364 // Sub-arrays/subscript-exprs are fine as long as the base is a in ActOnVar()
1368 CurVarExpr = SubScrpt->getBase()->IgnoreParenImpCasts(); in ActOnVar()
1371 cast<ArraySectionExpr>(CurVarExpr)->getBase()->IgnoreParenImpCasts(); in ActOnVar()
1377 DRE->getFoundDecl()->getCanonicalDecl())) in ActOnVar()
1387 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl())) in ActOnVar()
1408 Diag(VarExpr->getExprLoc(), diag::err_acc_not_a_var_ref) in ActOnVar()
1421 if (Base->hasPlaceholderType() && in ActOnArraySectionExpr()
1422 !Base->hasPlaceholderType(BuiltinType::ArraySection)) { in ActOnArraySectionExpr()
1428 if (LowerBound && LowerBound->getType()->isNonOverloadPlaceholderType()) { in ActOnArraySectionExpr()
1437 if (Length && Length->getType()->isNonOverloadPlaceholderType()) { in ActOnArraySectionExpr()
1451 if (!Base->isTypeDependent()) { in ActOnArraySectionExpr()
1452 if (OriginalBaseTy->isAnyPointerType()) { in ActOnArraySectionExpr()
1453 ResultTy = OriginalBaseTy->getPointeeType(); in ActOnArraySectionExpr()
1454 } else if (OriginalBaseTy->isArrayType()) { in ActOnArraySectionExpr()
1455 ResultTy = OriginalBaseTy->getAsArrayTypeUnsafe()->getElementType(); in ActOnArraySectionExpr()
1458 Diag(Base->getExprLoc(), diag::err_acc_typecheck_subarray_value) in ActOnArraySectionExpr()
1459 << Base->getSourceRange()); in ActOnArraySectionExpr()
1462 if (ResultTy->isFunctionType()) { in ActOnArraySectionExpr()
1463 Diag(Base->getExprLoc(), diag::err_acc_subarray_function_type) in ActOnArraySectionExpr()
1464 << ResultTy << Base->getSourceRange(); in ActOnArraySectionExpr()
1468 if (SemaRef.RequireCompleteType(Base->getExprLoc(), ResultTy, in ActOnArraySectionExpr()
1473 if (!Base->hasPlaceholderType(BuiltinType::ArraySection)) { in ActOnArraySectionExpr()
1483 SemaRef.CreateRecoveryExpr(E->getBeginLoc(), E->getEndLoc(), E, Ty); in ActOnArraySectionExpr()
1487 // Ensure both of the expressions are int-exprs. in ActOnArraySectionExpr()
1488 if (LowerBound && !LowerBound->isTypeDependent()) { in ActOnArraySectionExpr()
1491 LowerBound->getExprLoc(), LowerBound); in ActOnArraySectionExpr()
1499 if (Length && !Length->isTypeDependent()) { in ActOnArraySectionExpr()
1502 Length->getExprLoc(), Length); in ActOnArraySectionExpr()
1512 (!OriginalBaseTy->isDependentType() && in ActOnArraySectionExpr()
1513 !OriginalBaseTy->isConstantArrayType() && in ActOnArraySectionExpr()
1514 !OriginalBaseTy->isDependentSizedArrayType()))) { in ActOnArraySectionExpr()
1515 bool IsArray = !OriginalBaseTy.isNull() && OriginalBaseTy->isArrayType(); in ActOnArraySectionExpr()
1518 // double-diagnose here. in ActOnArraySectionExpr()
1534 if (!OriginalBaseTy.isNull() && OriginalBaseTy->isConstantArrayType()) { in ActOnArraySectionExpr()
1536 BaseSize = ArrayTy->getSize(); in ActOnArraySectionExpr()
1539 auto GetBoundValue = [&](Expr *E) -> std::optional<llvm::APSInt> { in ActOnArraySectionExpr()
1540 if (!E || E->isInstantiationDependent()) in ActOnArraySectionExpr()
1544 if (!E->EvaluateAsInt(Res, Context)) in ActOnArraySectionExpr()
1554 if (LowerBoundValue->isNegative()) { in ActOnArraySectionExpr()
1555 Diag(LowerBound->getExprLoc(), diag::err_acc_subarray_negative) in ActOnArraySectionExpr()
1558 LowerBound = GetRecovery(LowerBound, LowerBound->getType()); in ActOnArraySectionExpr()
1562 Diag(LowerBound->getExprLoc(), diag::err_acc_subarray_out_of_range) in ActOnArraySectionExpr()
1566 LowerBound = GetRecovery(LowerBound, LowerBound->getType()); in ActOnArraySectionExpr()
1572 if (LengthValue->isNegative()) { in ActOnArraySectionExpr()
1573 Diag(Length->getExprLoc(), diag::err_acc_subarray_negative) in ActOnArraySectionExpr()
1576 Length = GetRecovery(Length, Length->getType()); in ActOnArraySectionExpr()
1580 Diag(Length->getExprLoc(), diag::err_acc_subarray_out_of_range) in ActOnArraySectionExpr()
1584 Length = GetRecovery(Length, Length->getType()); in ActOnArraySectionExpr()
1589 auto AddAPSInt = [](llvm::APSInt LHS, llvm::APSInt RHS) -> llvm::APSInt { in ActOnArraySectionExpr()
1603 Diag(Base->getExprLoc(), in ActOnArraySectionExpr()
1610 LowerBound = GetRecovery(LowerBound, LowerBound->getType()); in ActOnArraySectionExpr()
1612 Length = GetRecovery(Length, Length->getType()); in ActOnArraySectionExpr()
1615 // If any part of the expression is dependent, return a dependent sub-array. in ActOnArraySectionExpr()
1617 if (Base->isTypeDependent() || in ActOnArraySectionExpr()
1618 (LowerBound && LowerBound->isInstantiationDependent()) || in ActOnArraySectionExpr()
1619 (Length && Length->isInstantiationDependent())) in ActOnArraySectionExpr()
1659 // If we are in the scope of a compute construct, add this to the list of in ActOnEndStmtDirective()
1660 // loop constructs that need assigning to the next closing compute in ActOnEndStmtDirective()
1693 Diag(AssocStmt.get()->getBeginLoc(), diag::err_acc_loop_not_for_loop); in ActOnAssociatedStmt()