Lines Matching +full:lbp +full:- +full:enable

1 //===--- CGStmtOpenMP.cpp - Emit LLVM Code from Statements ----------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
44 #define TTL_CODEGEN_TYPE "target-teams-loop-codegen"
56 cast_or_null<DeclStmt>(CPI->getPreInitStmt())) { in emitPreInitStmt()
57 for (const auto *I : PreInit->decls()) { in emitPreInitStmt()
58 if (!I->hasAttr<OMPCaptureNoInitAttr>()) { in emitPreInitStmt()
74 (CGF.CapturedStmtInfo && CGF.CapturedStmtInfo->lookup(VD)) || in isCapturedVar()
76 cast<BlockDecl>(CGF.CurCodeDecl)->capturesVariable(VD)); in isCapturedVar()
93 for (const auto &C : CS->captures()) { in OMPLexicalScope()
96 assert(VD == VD->getCanonicalDecl() && in OMPLexicalScope()
102 VD->getType().getNonReferenceType(), VK_LValue, C.getLocation()); in OMPLexicalScope()
141 /// Private scope for OpenMP loop-based directives, that supports capturing
149 for (const auto *E : LD->counters()) { in emitPreInitStmt()
150 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in emitPreInitStmt()
151 EmittedAsPrivate.insert(VD->getCanonicalDecl()); in emitPreInitStmt()
153 CGF, VD, CGF.CreateMemTemp(VD->getType().getNonReferenceType())); in emitPreInitStmt()
156 for (const auto *C : LD->getClausesOfKind<OMPPrivateClause>()) { in emitPreInitStmt()
157 for (const Expr *IRef : C->varlists()) { in emitPreInitStmt()
159 cast<VarDecl>(cast<DeclRefExpr>(IRef)->getDecl()); in emitPreInitStmt()
160 if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) { in emitPreInitStmt()
161 QualType OrigVDTy = OrigVD->getType().getNonReferenceType(); in emitPreInitStmt()
174 LD->getInnermostCapturedStmt()->getCapturedStmt(), in emitPreInitStmt()
175 /*TryImperfectlyNestedLoops=*/true, LD->getLoopsNumber(), in emitPreInitStmt()
178 if (const Stmt *Init = CXXFor->getInit()) in emitPreInitStmt()
180 CGF.EmitStmt(CXXFor->getRangeStmt()); in emitPreInitStmt()
181 CGF.EmitStmt(CXXFor->getEndStmt()); in emitPreInitStmt()
185 PreInits = LD->getPreInits(); in emitPreInitStmt()
187 PreInits = Tile->getPreInits(); in emitPreInitStmt()
189 PreInits = Unroll->getPreInits(); in emitPreInitStmt()
191 PreInits = Reverse->getPreInits(); in emitPreInitStmt()
194 PreInits = Interchange->getPreInits(); in emitPreInitStmt()
196 llvm_unreachable("Unknown loop-based directive kind."); in emitPreInitStmt()
204 llvm::append_range(PreInitStmts, PreInitCompound->body()); in emitPreInitStmt()
212 for (Decl *I : PreInitDecl->decls()) in emitPreInitStmt()
234 (CGF.CapturedStmtInfo && CGF.CapturedStmtInfo->lookup(VD)) || in isCapturedVar()
236 cast<BlockDecl>(CGF.CurCodeDecl)->capturesVariable(VD)); in isCapturedVar()
246 cast_or_null<DeclStmt>(CPI->getPreInitStmt())) { in OMPSimdLexicalScope()
247 for (const auto *I : PreInit->decls()) { in OMPSimdLexicalScope()
248 if (!I->hasAttr<OMPCaptureNoInitAttr>()) { in OMPSimdLexicalScope()
258 for (const Expr *E : UDP->varlists()) { in OMPSimdLexicalScope()
259 const Decl *D = cast<DeclRefExpr>(E)->getDecl(); in OMPSimdLexicalScope()
264 for (const Expr *E : UDP->varlists()) { in OMPSimdLexicalScope()
274 if (const Expr *E = TG->getReductionRef()) in OMPSimdLexicalScope()
275 CGF.EmitVarDecl(*cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl())); in OMPSimdLexicalScope()
281 if (C->getModifier() != OMPC_REDUCTION_inscan) in OMPSimdLexicalScope()
283 for (const Expr *E : C->copy_array_temps()) in OMPSimdLexicalScope()
284 CopyArrayTemps.insert(cast<DeclRefExpr>(E)->getDecl()); in OMPSimdLexicalScope()
288 for (auto &C : CS->captures()) { in OMPSimdLexicalScope()
293 assert(VD == VD->getCanonicalDecl() && in OMPSimdLexicalScope()
299 VD->getType().getNonReferenceType(), VK_LValue, in OMPSimdLexicalScope()
304 CS = dyn_cast<CapturedStmt>(CS->getCapturedStmt()); in OMPSimdLexicalScope()
318 if (const auto *OrigVD = dyn_cast<VarDecl>(OrigDRE->getDecl())) { in EmitOMPSharedLValue()
319 OrigVD = OrigVD->getCanonicalDecl(); in EmitOMPSharedLValue()
322 (CapturedStmtInfo && CapturedStmtInfo->lookup(OrigVD)) || in EmitOMPSharedLValue()
325 OrigDRE->getType(), VK_LValue, OrigDRE->getExprLoc()); in EmitOMPSharedLValue()
355 auto CurField = RD->field_begin(); in GenerateOpenMPCapturedVars()
360 if (CurField->hasCapturedVLAType()) { in GenerateOpenMPCapturedVars()
361 const VariableArrayType *VAT = CurField->getCapturedVLAType(); in GenerateOpenMPCapturedVars()
362 llvm::Value *Val = VLASizeMap[VAT->getSizeExpr()]; in GenerateOpenMPCapturedVars()
364 } else if (CurCap->capturesThis()) { in GenerateOpenMPCapturedVars()
366 } else if (CurCap->capturesVariableByCopy()) { in GenerateOpenMPCapturedVars()
367 llvm::Value *CV = EmitLoadOfScalar(EmitLValue(*I), CurCap->getLocation()); in GenerateOpenMPCapturedVars()
371 if (!CurField->getType()->isAnyPointerType()) { in GenerateOpenMPCapturedVars()
375 Twine(CurCap->getCapturedVar()->getName(), ".casted")); in GenerateOpenMPCapturedVars()
381 Ctx.getPointerType(CurField->getType()), CurCap->getLocation()); in GenerateOpenMPCapturedVars()
383 MakeNaturalAlignAddrLValue(SrcAddrVal, CurField->getType()); in GenerateOpenMPCapturedVars()
389 CV = EmitLoadOfScalar(DstLV, CurCap->getLocation()); in GenerateOpenMPCapturedVars()
393 assert(CurCap->capturesVariable() && "Expected capture by reference."); in GenerateOpenMPCapturedVars()
414 if (T->isLValueReferenceType()) in getCanonicalParamType()
418 if (T->isPointerType()) in getCanonicalParamType()
419 return C.getPointerType(getCanonicalParamType(C, T->getPointeeType())); in getCanonicalParamType()
420 if (const ArrayType *A = T->getAsArrayTypeUnsafe()) { in getCanonicalParamType()
422 return getCanonicalParamType(C, VLA->getElementType()); in getCanonicalParamType()
423 if (!A->isVariablyModifiedType()) in getCanonicalParamType()
442 /// Location of the non-debug version of the outlined function.
460 const CapturedDecl *CD = FO.S->getCapturedDecl(); in emitOutlinedFunctionPrologue()
461 const RecordDecl *RD = FO.S->getCapturedRecordDecl(); in emitOutlinedFunctionPrologue()
462 assert(CD->hasBody() && "missing CapturedDecl body"); in emitOutlinedFunctionPrologue()
469 Args.append(CD->param_begin(), in emitOutlinedFunctionPrologue()
470 std::next(CD->param_begin(), CD->getContextParamPosition())); in emitOutlinedFunctionPrologue()
472 CD->param_begin(), in emitOutlinedFunctionPrologue()
473 std::next(CD->param_begin(), CD->getContextParamPosition())); in emitOutlinedFunctionPrologue()
474 auto I = FO.S->captures().begin(); in emitOutlinedFunctionPrologue()
480 Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(), in emitOutlinedFunctionPrologue()
486 for (const FieldDecl *FD : RD->fields()) { in emitOutlinedFunctionPrologue()
487 QualType ArgType = FD->getType(); in emitOutlinedFunctionPrologue()
497 ((I->capturesVariableByCopy() && !ArgType->isAnyPointerType()) || in emitOutlinedFunctionPrologue()
498 I->capturesVariableArrayType())) in emitOutlinedFunctionPrologue()
501 if (I->capturesVariable() || I->capturesVariableByCopy()) { in emitOutlinedFunctionPrologue()
502 CapVar = I->getCapturedVar(); in emitOutlinedFunctionPrologue()
503 II = CapVar->getIdentifier(); in emitOutlinedFunctionPrologue()
504 } else if (I->capturesThis()) { in emitOutlinedFunctionPrologue()
507 assert(I->capturesVariableArrayType()); in emitOutlinedFunctionPrologue()
510 if (ArgType->isVariablyModifiedType()) in emitOutlinedFunctionPrologue()
513 if (CapVar && (CapVar->getTLSKind() != clang::VarDecl::TLS_None)) { in emitOutlinedFunctionPrologue()
514 Arg = ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(), in emitOutlinedFunctionPrologue()
517 } else if (DebugFunctionDecl && (CapVar || I->capturesThis())) { in emitOutlinedFunctionPrologue()
520 CapVar ? CapVar->getBeginLoc() : FD->getBeginLoc(), in emitOutlinedFunctionPrologue()
521 CapVar ? CapVar->getLocation() : FD->getLocation(), II, ArgType, in emitOutlinedFunctionPrologue()
524 Arg = ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(), in emitOutlinedFunctionPrologue()
528 // Do not cast arguments if we emit function with non-original types. in emitOutlinedFunctionPrologue()
535 Args.append(std::next(CD->param_begin(), CD->getContextParamPosition() + 1), in emitOutlinedFunctionPrologue()
536 CD->param_end()); in emitOutlinedFunctionPrologue()
538 std::next(CD->param_begin(), CD->getContextParamPosition() + 1), in emitOutlinedFunctionPrologue()
539 CD->param_end()); in emitOutlinedFunctionPrologue()
550 if (CD->isNothrow()) in emitOutlinedFunctionPrologue()
551 F->setDoesNotThrow(); in emitOutlinedFunctionPrologue()
552 F->setDoesNotRecurse(); in emitOutlinedFunctionPrologue()
556 F->removeFnAttr(llvm::Attribute::NoInline); in emitOutlinedFunctionPrologue()
557 F->addFnAttr(llvm::Attribute::AlwaysInline); in emitOutlinedFunctionPrologue()
562 FO.UIntPtrCastRequired ? FO.Loc : FO.S->getBeginLoc(), in emitOutlinedFunctionPrologue()
564 : CD->getBody()->getBeginLoc()); in emitOutlinedFunctionPrologue()
565 unsigned Cnt = CD->getContextParamPosition(); in emitOutlinedFunctionPrologue()
566 I = FO.S->captures().begin(); in emitOutlinedFunctionPrologue()
567 for (const FieldDecl *FD : RD->fields()) { in emitOutlinedFunctionPrologue()
568 // Do not map arguments if we emit function with non-original types. in emitOutlinedFunctionPrologue()
578 if (I->capturesVariableByCopy() && FD->getType()->isAnyPointerType()) { in emitOutlinedFunctionPrologue()
579 const VarDecl *CurVD = I->getCapturedVar(); in emitOutlinedFunctionPrologue()
587 LValue ArgLVal = CGF.MakeAddrLValue(LocalAddr, Args[Cnt]->getType(), in emitOutlinedFunctionPrologue()
589 if (FD->hasCapturedVLAType()) { in emitOutlinedFunctionPrologue()
592 castValueFromUintptr(CGF, I->getLocation(), FD->getType(), in emitOutlinedFunctionPrologue()
593 Args[Cnt]->getName(), ArgLVal), in emitOutlinedFunctionPrologue()
594 FD->getType(), AlignmentSource::Decl); in emitOutlinedFunctionPrologue()
596 llvm::Value *ExprArg = CGF.EmitLoadOfScalar(ArgLVal, I->getLocation()); in emitOutlinedFunctionPrologue()
597 const VariableArrayType *VAT = FD->getCapturedVLAType(); in emitOutlinedFunctionPrologue()
598 VLASizes.try_emplace(Args[Cnt], VAT->getSizeExpr(), ExprArg); in emitOutlinedFunctionPrologue()
599 } else if (I->capturesVariable()) { in emitOutlinedFunctionPrologue()
600 const VarDecl *Var = I->getCapturedVar(); in emitOutlinedFunctionPrologue()
601 QualType VarTy = Var->getType(); in emitOutlinedFunctionPrologue()
603 if (ArgLVal.getType()->isLValueReferenceType()) { in emitOutlinedFunctionPrologue()
605 } else if (!VarTy->isVariablyModifiedType() || !VarTy->isPointerType()) { in emitOutlinedFunctionPrologue()
606 assert(ArgLVal.getType()->isPointerType()); in emitOutlinedFunctionPrologue()
608 ArgAddr, ArgLVal.getType()->castAs<PointerType>()); in emitOutlinedFunctionPrologue()
614 } else if (I->capturesVariableByCopy()) { in emitOutlinedFunctionPrologue()
615 assert(!FD->getType()->isAnyPointerType() && in emitOutlinedFunctionPrologue()
617 const VarDecl *Var = I->getCapturedVar(); in emitOutlinedFunctionPrologue()
621 CGF, I->getLocation(), FD->getType(), in emitOutlinedFunctionPrologue()
622 Args[Cnt]->getName(), ArgLVal) in emitOutlinedFunctionPrologue()
626 assert(I->capturesThis()); in emitOutlinedFunctionPrologue()
627 CXXThisValue = CGF.EmitLoadOfScalar(ArgLVal, I->getLocation()); in emitOutlinedFunctionPrologue()
652 Out << CapturedStmtInfo->getHelperName(); in GenerateOpenMPCapturedStmtFunction()
670 CapturedStmtInfo->EmitBody(*this, CD->getBody()); in GenerateOpenMPCapturedStmtFunction()
672 FinishFunction(CD->getBodyRBrace()); in GenerateOpenMPCapturedStmtFunction()
678 CapturedStmtInfo->getHelperName(), Loc); in GenerateOpenMPCapturedStmtFunction()
688 auto *PI = F->arg_begin(); in GenerateOpenMPCapturedStmtFunction()
694 I->second.second, in GenerateOpenMPCapturedStmtFunction()
695 I->second.first ? I->second.first->getType() : Arg->getType(), in GenerateOpenMPCapturedStmtFunction()
697 if (LV.getType()->isAnyComplexType()) in GenerateOpenMPCapturedStmtFunction()
698 LV.setAddress(LV.getAddress().withElementType(PI->getType())); in GenerateOpenMPCapturedStmtFunction()
703 CallArg = EI->second.second; in GenerateOpenMPCapturedStmtFunction()
707 Arg->getType(), AlignmentSource::Decl); in GenerateOpenMPCapturedStmtFunction()
711 CallArgs.emplace_back(WrapperCGF.EmitFromMemory(CallArg, Arg->getType())); in GenerateOpenMPCapturedStmtFunction()
719 //===----------------------------------------------------------------------===//
721 //===----------------------------------------------------------------------===//
725 // Perform element-by-element initialization. in EmitOMPAggregateAssign()
729 const ArrayType *ArrayTy = OriginalType->getAsArrayTypeUnsafe(); in EmitOMPAggregateAssign()
739 // The basic structure here is a while-do loop. in EmitOMPAggregateAssign()
753 Builder.CreatePHI(SrcBegin->getType(), 2, "omp.arraycpy.srcElementPast"); in EmitOMPAggregateAssign()
754 SrcElementPHI->addIncoming(SrcBegin, EntryBB); in EmitOMPAggregateAssign()
760 DestBegin->getType(), 2, "omp.arraycpy.destElementPast"); in EmitOMPAggregateAssign()
761 DestElementPHI->addIncoming(DestBegin, EntryBB); in EmitOMPAggregateAssign()
780 DestElementPHI->addIncoming(DestElementNext, Builder.GetInsertBlock()); in EmitOMPAggregateAssign()
781 SrcElementPHI->addIncoming(SrcElementNext, Builder.GetInsertBlock()); in EmitOMPAggregateAssign()
790 if (OriginalType->isArrayType()) { in EmitOMPCopy()
792 if (BO && BO->getOpcode() == BO_Assign) { in EmitOMPCopy()
834 for (const auto *D : C->varlists()) in EmitOMPFirstprivateClause()
836 cast<VarDecl>(cast<DeclRefExpr>(D)->getDecl())->getCanonicalDecl(), in EmitOMPFirstprivateClause()
837 C->getKind()); in EmitOMPFirstprivateClause()
847 const auto *IRef = C->varlist_begin(); in EmitOMPFirstprivateClause()
848 const auto *InitsRef = C->inits().begin(); in EmitOMPFirstprivateClause()
849 for (const Expr *IInit : C->private_copies()) { in EmitOMPFirstprivateClause()
850 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPFirstprivateClause()
852 Lastprivates.count(OrigVD->getCanonicalDecl()) > 0; in EmitOMPFirstprivateClause()
853 const FieldDecl *FD = CapturedStmtInfo->lookup(OrigVD); in EmitOMPFirstprivateClause()
854 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(IInit)->getDecl()); in EmitOMPFirstprivateClause()
856 !FD->getType()->isReferenceType() && in EmitOMPFirstprivateClause()
857 (!VD || !VD->hasAttr<OMPAllocateDeclAttr>())) { in EmitOMPFirstprivateClause()
858 EmittedAsFirstprivate.insert(OrigVD->getCanonicalDecl()); in EmitOMPFirstprivateClause()
865 if (DeviceConstTarget && OrigVD->getType().isConstant(getContext()) && in EmitOMPFirstprivateClause()
866 FD && FD->getType()->isReferenceType() && in EmitOMPFirstprivateClause()
867 (!VD || !VD->hasAttr<OMPAllocateDeclAttr>())) { in EmitOMPFirstprivateClause()
868 EmittedAsFirstprivate.insert(OrigVD->getCanonicalDecl()); in EmitOMPFirstprivateClause()
875 if (EmittedAsFirstprivate.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPFirstprivateClause()
877 cast<VarDecl>(cast<DeclRefExpr>(*InitsRef)->getDecl()); in EmitOMPFirstprivateClause()
881 (*IRef)->getType(), VK_LValue, (*IRef)->getExprLoc()); in EmitOMPFirstprivateClause()
895 assert(!CE && "Expected non-constant firstprivate."); in EmitOMPFirstprivateClause()
901 QualType Type = VD->getType(); in EmitOMPFirstprivateClause()
902 if (Type->isArrayType()) { in EmitOMPFirstprivateClause()
907 const Expr *Init = VD->getInit(); in EmitOMPFirstprivateClause()
922 Init->getType().getQualifiers(), in EmitOMPFirstprivateClause()
940 Lastprivates[OrigVD->getCanonicalDecl()] == in EmitOMPFirstprivateClause()
944 EmitLoadOfScalar(MakeAddrLValue(VDAddr, (*IRef)->getType(), in EmitOMPFirstprivateClause()
946 (*IRef)->getExprLoc()); in EmitOMPFirstprivateClause()
949 EmitStoreOfScalar(V, MakeAddrLValue(VDAddr, (*IRef)->getType(), in EmitOMPFirstprivateClause()
975 auto IRef = C->varlist_begin(); in EmitOMPPrivateClause()
976 for (const Expr *IInit : C->private_copies()) { in EmitOMPPrivateClause()
977 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPPrivateClause()
978 if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPPrivateClause()
979 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(IInit)->getDecl()); in EmitOMPPrivateClause()
1003 auto IRef = C->varlist_begin(); in EmitOMPCopyinClause()
1004 auto ISrcRef = C->source_exprs().begin(); in EmitOMPCopyinClause()
1005 auto IDestRef = C->destination_exprs().begin(); in EmitOMPCopyinClause()
1006 for (const Expr *AssignOp : C->assignment_ops()) { in EmitOMPCopyinClause()
1007 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPCopyinClause()
1008 QualType Type = VD->getType(); in EmitOMPCopyinClause()
1009 if (CopiedVars.insert(VD->getCanonicalDecl()).second) { in EmitOMPCopyinClause()
1016 assert(CapturedStmtInfo->lookup(VD) && in EmitOMPCopyinClause()
1019 (*IRef)->getType(), VK_LValue, (*IRef)->getExprLoc()); in EmitOMPCopyinClause()
1024 Address(VD->isStaticLocal() ? CGM.getStaticLocalDeclAddress(VD) in EmitOMPCopyinClause()
1026 CGM.getTypes().ConvertTypeForMem(VD->getType()), in EmitOMPCopyinClause()
1047 cast<VarDecl>(cast<DeclRefExpr>(*ISrcRef)->getDecl()); in EmitOMPCopyinClause()
1049 cast<VarDecl>(cast<DeclRefExpr>(*IDestRef)->getDecl()); in EmitOMPCopyinClause()
1058 // Exit out of copying procedure for non-master thread. in EmitOMPCopyinClause()
1073 for (const Expr *C : LoopDirective->counters()) { in EmitOMPLastprivateClauseInit()
1075 cast<VarDecl>(cast<DeclRefExpr>(C)->getDecl())->getCanonicalDecl()); in EmitOMPLastprivateClauseInit()
1084 const auto *IRef = C->varlist_begin(); in EmitOMPLastprivateClauseInit()
1085 const auto *IDestRef = C->destination_exprs().begin(); in EmitOMPLastprivateClauseInit()
1086 for (const Expr *IInit : C->private_copies()) { in EmitOMPLastprivateClauseInit()
1089 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPLastprivateClauseInit()
1092 if (AlreadyEmittedVars.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPLastprivateClauseInit()
1094 cast<VarDecl>(cast<DeclRefExpr>(*IDestRef)->getDecl()); in EmitOMPLastprivateClauseInit()
1097 CapturedStmtInfo->lookup(OrigVD) != nullptr, in EmitOMPLastprivateClauseInit()
1098 (*IRef)->getType(), VK_LValue, (*IRef)->getExprLoc()); in EmitOMPLastprivateClauseInit()
1103 if (IInit && !SIMDLCVs.count(OrigVD->getCanonicalDecl())) { in EmitOMPLastprivateClauseInit()
1104 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(IInit)->getDecl()); in EmitOMPLastprivateClauseInit()
1106 if (C->getKind() == OMPC_LASTPRIVATE_conditional) { in EmitOMPLastprivateClauseInit()
1147 return C->getKind() == OMPC_LASTPRIVATE_conditional; in EmitOMPLastprivateClauseFinal()
1162 auto IC = LoopDirective->counters().begin(); in EmitOMPLastprivateClauseFinal()
1163 for (const Expr *F : LoopDirective->finals()) { in EmitOMPLastprivateClauseFinal()
1165 cast<VarDecl>(cast<DeclRefExpr>(*IC)->getDecl())->getCanonicalDecl(); in EmitOMPLastprivateClauseFinal()
1174 auto IRef = C->varlist_begin(); in EmitOMPLastprivateClauseFinal()
1175 auto ISrcRef = C->source_exprs().begin(); in EmitOMPLastprivateClauseFinal()
1176 auto IDestRef = C->destination_exprs().begin(); in EmitOMPLastprivateClauseFinal()
1177 for (const Expr *AssignOp : C->assignment_ops()) { in EmitOMPLastprivateClauseFinal()
1179 cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPLastprivateClauseFinal()
1180 QualType Type = PrivateVD->getType(); in EmitOMPLastprivateClauseFinal()
1181 const auto *CanonicalVD = PrivateVD->getCanonicalDecl(); in EmitOMPLastprivateClauseFinal()
1183 // If lastprivate variable is a loop control variable for loop-based in EmitOMPLastprivateClauseFinal()
1189 cast<VarDecl>(cast<DeclRefExpr>(*ISrcRef)->getDecl()); in EmitOMPLastprivateClauseFinal()
1191 cast<VarDecl>(cast<DeclRefExpr>(*IDestRef)->getDecl()); in EmitOMPLastprivateClauseFinal()
1194 if (const auto *RefTy = PrivateVD->getType()->getAs<ReferenceType>()) in EmitOMPLastprivateClauseFinal()
1197 CGM.getTypes().ConvertTypeForMem(RefTy->getPointeeType()), in EmitOMPLastprivateClauseFinal()
1198 CGM.getNaturalTypeAlignment(RefTy->getPointeeType())); in EmitOMPLastprivateClauseFinal()
1200 if (C->getKind() == OMPC_LASTPRIVATE_conditional) in EmitOMPLastprivateClauseFinal()
1202 *this, MakeAddrLValue(PrivateAddr, (*IRef)->getType()), PrivateVD, in EmitOMPLastprivateClauseFinal()
1203 (*IRef)->getExprLoc()); in EmitOMPLastprivateClauseFinal()
1212 if (const Expr *PostUpdate = C->getPostUpdateExpr()) in EmitOMPLastprivateClauseFinal()
1233 if (ForInscan != (C->getModifier() == OMPC_REDUCTION_inscan)) in EmitOMPReductionClauseInit()
1235 Shareds.append(C->varlist_begin(), C->varlist_end()); in EmitOMPReductionClauseInit()
1236 Privates.append(C->privates().begin(), C->privates().end()); in EmitOMPReductionClauseInit()
1237 ReductionOps.append(C->reduction_ops().begin(), C->reduction_ops().end()); in EmitOMPReductionClauseInit()
1238 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPReductionClauseInit()
1239 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPReductionClauseInit()
1240 if (C->getModifier() == OMPC_REDUCTION_task) { in EmitOMPReductionClauseInit()
1241 Data.ReductionVars.append(C->privates().begin(), C->privates().end()); in EmitOMPReductionClauseInit()
1242 Data.ReductionOrigs.append(C->varlist_begin(), C->varlist_end()); in EmitOMPReductionClauseInit()
1243 Data.ReductionCopies.append(C->privates().begin(), C->privates().end()); in EmitOMPReductionClauseInit()
1244 Data.ReductionOps.append(C->reduction_ops().begin(), in EmitOMPReductionClauseInit()
1245 C->reduction_ops().end()); in EmitOMPReductionClauseInit()
1246 TaskLHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPReductionClauseInit()
1247 TaskRHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPReductionClauseInit()
1256 const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*IPriv)->getDecl()); in EmitOMPReductionClauseInit()
1276 const auto *LHSVD = cast<VarDecl>(cast<DeclRefExpr>(*ILHS)->getDecl()); in EmitOMPReductionClauseInit()
1277 const auto *RHSVD = cast<VarDecl>(cast<DeclRefExpr>(*IRHS)->getDecl()); in EmitOMPReductionClauseInit()
1278 QualType Type = PrivateVD->getType(); in EmitOMPReductionClauseInit()
1280 if (isaOMPArraySectionExpr && Type->isVariablyModifiedType()) { in EmitOMPReductionClauseInit()
1285 } else if ((isaOMPArraySectionExpr && Type->isScalarType()) || in EmitOMPReductionClauseInit()
1292 ConvertTypeForMem(RHSVD->getType()))); in EmitOMPReductionClauseInit()
1294 QualType Type = PrivateVD->getType(); in EmitOMPReductionClauseInit()
1301 OriginalAddr.withElementType(ConvertTypeForMem(LHSVD->getType())); in EmitOMPReductionClauseInit()
1306 ConvertTypeForMem(RHSVD->getType())) in EmitOMPReductionClauseInit()
1422 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(TaskRedRef)->getDecl()); in EmitOMPReductionClauseInit()
1425 /*Volatile=*/false, TaskRedRef->getType()); in EmitOMPReductionClauseInit()
1441 if (C->getModifier() == OMPC_REDUCTION_inscan) in EmitOMPReductionClauseFinal()
1444 Privates.append(C->privates().begin(), C->privates().end()); in EmitOMPReductionClauseFinal()
1445 LHSExprs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPReductionClauseFinal()
1446 RHSExprs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPReductionClauseFinal()
1447 ReductionOps.append(C->reduction_ops().begin(), C->reduction_ops().end()); in EmitOMPReductionClauseFinal()
1449 IsReductionWithTaskMod || C->getModifier() == OMPC_REDUCTION_task; in EmitOMPReductionClauseFinal()
1459 TeamsLoopCanBeParallel = TTLD->canBeParallelFor(); in EmitOMPReductionClauseFinal()
1479 if (const Expr *PostUpdate = C->getPostUpdateExpr()) { in emitPostUpdateForReductionClause()
1482 // If the first post-update expression is found, emit conditional in emitPostUpdateForReductionClause()
1514 for (const Expr *Ref : C->varlists()) { in checkForLastprivateConditionalUpdate()
1515 if (!Ref->getType()->isScalarType()) in checkForLastprivateConditionalUpdate()
1517 const auto *DRE = dyn_cast<DeclRefExpr>(Ref->IgnoreParenImpCasts()); in checkForLastprivateConditionalUpdate()
1520 PrivateDecls.insert(cast<VarDecl>(DRE->getDecl())); in checkForLastprivateConditionalUpdate()
1525 for (const Expr *Ref : C->varlists()) { in checkForLastprivateConditionalUpdate()
1526 if (!Ref->getType()->isScalarType()) in checkForLastprivateConditionalUpdate()
1528 const auto *DRE = dyn_cast<DeclRefExpr>(Ref->IgnoreParenImpCasts()); in checkForLastprivateConditionalUpdate()
1531 PrivateDecls.insert(cast<VarDecl>(DRE->getDecl())); in checkForLastprivateConditionalUpdate()
1536 for (const Expr *Ref : C->varlists()) { in checkForLastprivateConditionalUpdate()
1537 if (!Ref->getType()->isScalarType()) in checkForLastprivateConditionalUpdate()
1539 const auto *DRE = dyn_cast<DeclRefExpr>(Ref->IgnoreParenImpCasts()); in checkForLastprivateConditionalUpdate()
1542 PrivateDecls.insert(cast<VarDecl>(DRE->getDecl())); in checkForLastprivateConditionalUpdate()
1547 // Task reductions may be skipped - tasks are ignored. in checkForLastprivateConditionalUpdate()
1548 // Firstprivates do not return value but may be passed by reference - no need in checkForLastprivateConditionalUpdate()
1551 for (const Expr *Ref : C->varlists()) { in checkForLastprivateConditionalUpdate()
1552 if (!Ref->getType()->isScalarType()) in checkForLastprivateConditionalUpdate()
1554 const auto *DRE = dyn_cast<DeclRefExpr>(Ref->IgnoreParenImpCasts()); in checkForLastprivateConditionalUpdate()
1557 PrivateDecls.insert(cast<VarDecl>(DRE->getDecl())); in checkForLastprivateConditionalUpdate()
1572 CGF, S, *CS->getCapturedDecl()->param_begin(), InnermostKind, in emitCommonOMPParallelDirective()
1576 NumThreads = CGF.EmitScalarExpr(NumThreadsClause->getNumThreads(), in emitCommonOMPParallelDirective()
1579 CGF, NumThreads, NumThreadsClause->getBeginLoc()); in emitCommonOMPParallelDirective()
1584 CGF, ProcBindClause->getProcBindKind(), ProcBindClause->getBeginLoc()); in emitCommonOMPParallelDirective()
1588 if (C->getNameModifier() == OMPD_unknown || in emitCommonOMPParallelDirective()
1589 C->getNameModifier() == OMPD_parallel) { in emitCommonOMPParallelDirective()
1590 IfCond = C->getCondition(); in emitCommonOMPParallelDirective()
1608 const VarDecl *CVD = VD->getCanonicalDecl(); in isAllocatableDecl()
1609 if (!CVD->hasAttr<OMPAllocateDeclAttr>()) in isAllocatableDecl()
1611 const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); in isAllocatableDecl()
1613 return !((AA->getAllocatorType() == OMPAllocateDeclAttr::OMPDefaultMemAlloc || in isAllocatableDecl()
1614 AA->getAllocatorType() == OMPAllocateDeclAttr::OMPNullMemAlloc) && in isAllocatableDecl()
1615 !AA->getAllocator()); in isAllocatableDecl()
1642 const VarDecl *CVD = VD->getCanonicalDecl(); in getAddressOfLocalVariable()
1647 if (CVD->getType()->isVariablyModifiedType()) { in getAddressOfLocalVariable()
1648 Size = CGF.getTypeSize(CVD->getType()); in getAddressOfLocalVariable()
1649 // Align the size: ((size + align - 1) / align) * align in getAddressOfLocalVariable()
1651 Size, CGM.getSize(Align - CharUnits::fromQuantity(1))); in getAddressOfLocalVariable()
1655 CharUnits Sz = CGM.getContext().getTypeSizeInChars(CVD->getType()); in getAddressOfLocalVariable()
1659 const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); in getAddressOfLocalVariable()
1660 assert(AA->getAllocator() && in getAddressOfLocalVariable()
1661 "Expected allocator expression for non-default allocator."); in getAddressOfLocalVariable()
1662 llvm::Value *Allocator = CGF.EmitScalarExpr(AA->getAllocator()); in getAddressOfLocalVariable()
1665 if (Allocator->getType()->isIntegerTy()) in getAddressOfLocalVariable()
1667 else if (Allocator->getType()->isPointerTy()) in getAddressOfLocalVariable()
1673 getNameWithSeparators({CVD->getName(), ".void.addr"}, ".", ".")); in getAddressOfLocalVariable()
1680 CGF.ConvertTypeForMem(CGM.getContext().getPointerType(CVD->getType())), in getAddressOfLocalVariable()
1681 getNameWithSeparators({CVD->getName(), ".addr"}, ".", ".")); in getAddressOfLocalVariable()
1682 return Address(Addr, CGF.ConvertTypeForMem(CVD->getType()), Align); in getAddressOfLocalVariable()
1760 IfCond = EmitScalarExpr(C->getCondition(), in EmitOMPParallelDirective()
1765 NumThreads = EmitScalarExpr(NumThreadsClause->getNumThreads(), in EmitOMPParallelDirective()
1770 ProcBind = ProcBindClause->getProcBindKind(); in EmitOMPParallelDirective()
1787 // data-sharing attribute "shared". in EmitOMPParallelDirective()
1794 const Stmt *ParallelRegionBodyStmt = CS->getCapturedStmt(); in EmitOMPParallelDirective()
1805 AllocaInsertPt->getParent(), AllocaInsertPt->getIterator()); in EmitOMPParallelDirective()
1821 CGF.EmitStmt(S.getCapturedStmt(OMPD_parallel)->getCapturedStmt()); in EmitOMPParallelDirective()
1873 const Stmt *SimplifiedS = S->IgnoreContainers(); in emitBody()
1876 CGF.getContext().getSourceManager(), CS->getLBracLoc(), in emitBody()
1880 CodeGenFunction::LexicalScope Scope(CGF, S->getSourceRange()); in emitBody()
1881 for (const Stmt *CurStmt : CS->body()) in emitBody()
1887 SimplifiedS = Dir->getTransformedStmt(); in emitBody()
1889 SimplifiedS = CanonLoop->getLoopStmt(); in emitBody()
1891 S = For->getBody(); in emitBody()
1894 "Expected canonical for loop or range-based for loop."); in emitBody()
1896 CGF.EmitStmt(CXXFor->getLoopVarStmt()); in emitBody()
1897 S = CXXFor->getBody(); in emitBody()
1920 for (const Expr *UE : C->updates()) in EmitOMPLoopBody()
1931 // Check that loop counter in non-rectangular nest fits into the iteration in EmitOMPLoopBody()
1961 D.getInnermostCapturedStmt()->getCapturedStmt()->IgnoreContainers(); in EmitOMPLoopBody()
2010 // The caller is processing the loop-associated directive processing the \p in EmitOMPCollapsedCanonicalLoopNest()
2011 // Depth loops nested in \p S. Put the previous pending loop-associated in EmitOMPCollapsedCanonicalLoopNest()
2012 // directive to the stack. If the current loop-associated directive is a loop in EmitOMPCollapsedCanonicalLoopNest()
2015 // nest for the parent loop-associated directive. in EmitOMPCollapsedCanonicalLoopNest()
2034 const Stmt *SyntacticalLoop = S->getLoopStmt(); in EmitOMPCanonicalLoop()
2041 LexicalScope ForScope(*this, S->getSourceRange()); in EmitOMPCanonicalLoop()
2047 if (const Stmt *InitStmt = For->getInit()) in EmitOMPCanonicalLoop()
2049 BodyStmt = For->getBody(); in EmitOMPCanonicalLoop()
2052 if (const DeclStmt *RangeStmt = RangeFor->getRangeStmt()) in EmitOMPCanonicalLoop()
2054 if (const DeclStmt *BeginStmt = RangeFor->getBeginStmt()) in EmitOMPCanonicalLoop()
2056 if (const DeclStmt *EndStmt = RangeFor->getEndStmt()) in EmitOMPCanonicalLoop()
2058 if (const DeclStmt *LoopVarStmt = RangeFor->getLoopVarStmt()) in EmitOMPCanonicalLoop()
2060 BodyStmt = RangeFor->getBody(); in EmitOMPCanonicalLoop()
2062 llvm_unreachable("Expected for-stmt or range-based for-stmt"); in EmitOMPCanonicalLoop()
2064 // Emit closure for later use. By-value captures will be captured here. in EmitOMPCanonicalLoop()
2065 const CapturedStmt *DistanceFunc = S->getDistanceFunc(); in EmitOMPCanonicalLoop()
2067 const CapturedStmt *LoopVarFunc = S->getLoopVarFunc(); in EmitOMPCanonicalLoop()
2072 QualType LogicalTy = DistanceFunc->getCapturedDecl() in EmitOMPCanonicalLoop()
2073 ->getParam(0) in EmitOMPCanonicalLoop()
2074 ->getType() in EmitOMPCanonicalLoop()
2088 const DeclRefExpr *LoopVarRef = S->getLoopVarRef(); in EmitOMPCanonicalLoop()
2101 Builder.restoreIP(CL->getAfterIP()); in EmitOMPCanonicalLoop()
2123 const Stmt *SS = ICS->getCapturedStmt(); in EmitOMPInnerLoop()
2128 AS->getAttrs(), SourceLocToDebugLoc(R.getBegin()), in EmitOMPInnerLoop()
2134 // If there are any cleanups between here and the loop-exit scope, in EmitOMPInnerLoop()
2158 // Emit "IV = IV + 1" and a back-edge to the condition block. in EmitOMPInnerLoop()
2165 // Emit the fall-through block. in EmitOMPInnerLoop()
2175 for (const Expr *Init : C->inits()) { in EmitOMPLinearClauseInit()
2177 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(Init)->getDecl()); in EmitOMPLinearClauseInit()
2179 dyn_cast<DeclRefExpr>(VD->getInit()->IgnoreImpCasts())) { in EmitOMPLinearClauseInit()
2181 const auto *OrigVD = cast<VarDecl>(Ref->getDecl()); in EmitOMPLinearClauseInit()
2183 CapturedStmtInfo->lookup(OrigVD) != nullptr, in EmitOMPLinearClauseInit()
2184 VD->getInit()->getType(), VK_LValue, in EmitOMPLinearClauseInit()
2185 VD->getInit()->getExprLoc()); in EmitOMPLinearClauseInit()
2188 MakeAddrLValue(Emission.getAllocatedAddress(), VD->getType()), in EmitOMPLinearClauseInit()
2196 // If a step is not constant, it is pre-calculated before the loop. in EmitOMPLinearClauseInit()
2197 if (const auto *CS = cast_or_null<BinaryOperator>(C->getCalcStep())) in EmitOMPLinearClauseInit()
2198 if (const auto *SaveRef = cast<DeclRefExpr>(CS->getLHS())) { in EmitOMPLinearClauseInit()
2199 EmitVarDecl(*cast<VarDecl>(SaveRef->getDecl())); in EmitOMPLinearClauseInit()
2215 auto IC = C->varlist_begin(); in EmitOMPLinearClauseFinal()
2216 for (const Expr *F : C->finals()) { in EmitOMPLinearClauseFinal()
2219 // If the first post-update expression is found, emit conditional in EmitOMPLinearClauseFinal()
2227 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IC)->getDecl()); in EmitOMPLinearClauseFinal()
2229 CapturedStmtInfo->lookup(OrigVD) != nullptr, in EmitOMPLinearClauseFinal()
2230 (*IC)->getType(), VK_LValue, (*IC)->getExprLoc()); in EmitOMPLinearClauseFinal()
2238 if (const Expr *PostUpdate = C->getPostUpdateExpr()) in EmitOMPLinearClauseFinal()
2251 if (const Expr *AlignmentExpr = Clause->getAlignment()) { in emitAlignedClause()
2254 ClauseAlignment = AlignmentCI->getValue(); in emitAlignedClause()
2256 for (const Expr *E : Clause->varlists()) { in emitAlignedClause()
2260 // If no optional parameter is specified, implementation-defined default in emitAlignedClause()
2265 E->getType()->getPointeeType())) in emitAlignedClause()
2286 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPPrivateLoopCounters()
2287 const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl()); in EmitOMPPrivateLoopCounters()
2293 if (LocalDeclMap.count(VD) || CapturedStmtInfo->lookup(VD) || in EmitOMPPrivateLoopCounters()
2294 VD->hasGlobalStorage()) { in EmitOMPPrivateLoopCounters()
2296 LocalDeclMap.count(VD) || CapturedStmtInfo->lookup(VD), in EmitOMPPrivateLoopCounters()
2297 E->getType(), VK_LValue, E->getExprLoc()); in EmitOMPPrivateLoopCounters()
2306 if (!C->getNumForLoops()) in EmitOMPPrivateLoopCounters()
2308 for (unsigned I = S.getLoopsNumber(), E = C->getLoopNumIterations().size(); in EmitOMPPrivateLoopCounters()
2310 const auto *DRE = cast<DeclRefExpr>(C->getLoopCounter(I)); in EmitOMPPrivateLoopCounters()
2311 const auto *VD = cast<VarDecl>(DRE->getDecl()); in EmitOMPPrivateLoopCounters()
2312 // Override only those variables that can be captured to avoid re-emission in EmitOMPPrivateLoopCounters()
2314 if (DRE->refersToEnclosingVariableOrCapture()) { in EmitOMPPrivateLoopCounters()
2316 VD, CreateMemTemp(DRE->getType(), VD->getName())); in EmitOMPPrivateLoopCounters()
2337 // non-rectangular loops. in emitPreCond()
2342 assert(!E->getType().getNonReferenceType()->isRecordType() && in emitPreCond()
2344 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in emitPreCond()
2346 CGF.CreateMemTemp(VD->getType().getNonReferenceType()); in emitPreCond()
2367 for (const Expr *C : LoopDirective->counters()) { in EmitOMPLinearClause()
2369 cast<VarDecl>(cast<DeclRefExpr>(C)->getDecl())->getCanonicalDecl()); in EmitOMPLinearClause()
2373 auto CurPrivate = C->privates().begin(); in EmitOMPLinearClause()
2374 for (const Expr *E : C->varlists()) { in EmitOMPLinearClause()
2375 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPLinearClause()
2377 cast<VarDecl>(cast<DeclRefExpr>(*CurPrivate)->getDecl()); in EmitOMPLinearClause()
2378 if (!SIMDLCVs.count(VD->getCanonicalDecl())) { in EmitOMPLinearClause()
2399 RValue Len = CGF.EmitAnyExpr(C->getSimdlen(), AggValueSlot::ignored(), in emitSimdlenSafelenClause()
2402 CGF.LoopStack.setVectorizeWidth(Val->getZExtValue()); in emitSimdlenSafelenClause()
2404 // the memory instructions parallel, because loop-carried in emitSimdlenSafelenClause()
2408 RValue Len = CGF.EmitAnyExpr(C->getSafelen(), AggValueSlot::ignored(), in emitSimdlenSafelenClause()
2411 CGF.LoopStack.setVectorizeWidth(Val->getZExtValue()); in emitSimdlenSafelenClause()
2413 // the memory instructions parallel, because loop-carried in emitSimdlenSafelenClause()
2415 CGF.LoopStack.setParallel(/*Enable=*/false); in emitSimdlenSafelenClause()
2421 LoopStack.setParallel(/*Enable=*/true); in EmitOMPSimdInit()
2425 if (C->getKind() == OMPC_ORDER_concurrent) in EmitOMPSimdInit()
2426 LoopStack.setParallel(/*Enable=*/true); in EmitOMPSimdInit()
2432 return C->getModifier() == OMPC_REDUCTION_inscan; in EmitOMPSimdInit()
2435 LoopStack.setParallel(/*Enable=*/false); in EmitOMPSimdInit()
2447 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>((*IC))->getDecl()); in EmitOMPSimdFinal()
2448 const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>((*IPC))->getDecl()); in EmitOMPSimdFinal()
2450 if (LocalDeclMap.count(OrigVD) || CapturedStmtInfo->lookup(OrigVD) || in EmitOMPSimdFinal()
2451 OrigVD->hasGlobalStorage() || CED) { in EmitOMPSimdFinal()
2454 // If the first post-update expression is found, emit conditional in EmitOMPSimdFinal()
2464 OrigAddr = EmitLValue(CED->getInit()->IgnoreImpCasts()).getAddress(); in EmitOMPSimdFinal()
2468 (*IPC)->getType(), VK_LValue, (*IPC)->getExprLoc()); in EmitOMPSimdFinal()
2493 auto VDecl = cast<VarDecl>(Helper->getDecl()); in EmitOMPHelperVar()
2511 CGF.LoopStack.setVectorizeEnable(/*Enable=*/false); in emitCommonSimdLoop()
2519 (C->getNameModifier() == OMPD_unknown || in emitCommonSimdLoop()
2520 C->getNameModifier() == OMPD_simd)) { in emitCommonSimdLoop()
2521 IfCond = C->getCondition(); in emitCommonSimdLoop()
2552 // Emit: if (PreCond) - begin. in emitOMPSimdRegion()
2571 const auto *IVDecl = cast<VarDecl>(cast<DeclRefExpr>(IVExpr)->getDecl()); in emitOMPSimdRegion()
2579 CGF.EmitVarDecl(*cast<VarDecl>(LIExpr->getDecl())); in emitOMPSimdRegion()
2623 // Emit: if (PreCond) - end. in emitOMPSimdRegion()
2643 if (const Stmt *SyntacticalLoop = CanonLoop->getLoopStmt()) { in isSupportedByOpenMPIRBuilder()
2644 for (const Stmt *SubStmt : SyntacticalLoop->children()) { in isSupportedByOpenMPIRBuilder()
2648 for (const Stmt *CSSubStmt : CS->children()) { in isSupportedByOpenMPIRBuilder()
2666 if (const Expr *AlignmentExpr = Clause->getAlignment()) { in GetAlignedMapping()
2669 ClauseAlignment = AlignmentCI->getValue(); in GetAlignedMapping()
2671 for (const Expr *E : Clause->varlists()) { in GetAlignedMapping()
2675 // If no optional parameter is specified, implementation-defined default in GetAlignedMapping()
2680 E->getType()->getPointeeType())) in GetAlignedMapping()
2713 this->EmitAnyExpr(C->getSimdlen(), AggValueSlot::ignored(), in EmitOMPSimdDirective()
2721 this->EmitAnyExpr(C->getSafelen(), AggValueSlot::ignored(), in EmitOMPSimdDirective()
2728 if (C->getKind() == OpenMPOrderClauseKind ::OMPC_ORDER_concurrent) { in EmitOMPSimdDirective()
2765 // Emit the de-sugared statement. in EmitOMPTileDirective()
2771 // Emit the de-sugared statement. in EmitOMPReverseDirective()
2778 // Emit the de-sugared statement. in EmitOMPInterchangeDirective()
2791 // fully unrolled loop is non-transformable. For partial unrolling the in EmitOMPUnrollDirective()
2806 if (Expr *FactorExpr = PartialClause->getFactor()) { in EmitOMPUnrollDirective()
2807 Factor = FactorExpr->EvaluateKnownConstInt(getContext()).getZExtValue(); in EmitOMPUnrollDirective()
2825 // other loop-associated construct. Such a loop-associated construct will have in EmitOMPUnrollDirective()
2829 LoopStack.setUnrollState(LoopAttributes::Enable); in EmitOMPUnrollDirective()
2834 if (Expr *FactorExpr = PartialClause->getFactor()) { in EmitOMPUnrollDirective()
2836 FactorExpr->EvaluateKnownConstInt(getContext()).getZExtValue(); in EmitOMPUnrollDirective()
2854 const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); in EmitOMPOuterLoop()
2855 const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); in EmitOMPOuterLoop()
2883 // If there are any cleanups between here and the loop-exit scope, in EmitOMPOuterLoop()
2914 if (C->getKind() == OMPC_ORDER_concurrent) in EmitOMPOuterLoop()
2915 CGF.LoopStack.setParallel(/*Enable=*/true); in EmitOMPOuterLoop()
2949 // Emit the fall-through block. in EmitOMPOuterLoop()
2973 "static non-chunked schedule does not need outer loop"); in EmitOMPForOuterLoop()
2977 // OpenMP [2.7.1, Loop Construct, Description, table 2-1] in EmitOMPForOuterLoop()
3003 // run-sched-var ICV. If the ICV is set to auto, the schedule is in EmitOMPForOuterLoop()
3015 // OpenMP [2.7.1, Loop Construct, Description, table 2-1] in EmitOMPForOuterLoop()
3018 // the team in a round-robin fashion in the order of the thread number. in EmitOMPForOuterLoop()
3028 const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); in EmitOMPForOuterLoop()
3029 const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); in EmitOMPForOuterLoop()
3088 const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); in EmitOMPDistributeOuterLoop()
3089 const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); in EmitOMPDistributeOuterLoop()
3154 PrevLB, LS.getPrevLowerBoundVariable()->getExprLoc()); in emitDistributeParallelForInnerBounds()
3156 PrevLBVal, LS.getPrevLowerBoundVariable()->getType(), in emitDistributeParallelForInnerBounds()
3157 LS.getIterationVariable()->getType(), in emitDistributeParallelForInnerBounds()
3158 LS.getPrevLowerBoundVariable()->getExprLoc()); in emitDistributeParallelForInnerBounds()
3160 PrevUB, LS.getPrevUpperBoundVariable()->getExprLoc()); in emitDistributeParallelForInnerBounds()
3162 PrevUBVal, LS.getPrevUpperBoundVariable()->getType(), in emitDistributeParallelForInnerBounds()
3163 LS.getIterationVariable()->getType(), in emitDistributeParallelForInnerBounds()
3164 LS.getPrevUpperBoundVariable()->getExprLoc()); in emitDistributeParallelForInnerBounds()
3189 QualType IteratorTy = IVExpr->getType(); in emitDistributeParallelForDispatchBounds()
3224 HasCancel = D->hasCancel(); in emitInnerParallelForWhenCombined()
3226 HasCancel = D->hasCancel(); in emitInnerParallelForWhenCombined()
3229 HasCancel = D->hasCancel(); in emitInnerParallelForWhenCombined()
3314 const auto *IVDecl = cast<VarDecl>(IVExpr->getDecl()); in EmitOMPWorksharingLoop()
3321 EmitVarDecl(*cast<VarDecl>(LIExpr->getDecl())); in EmitOMPWorksharingLoop()
3329 // Check pre-condition. in EmitOMPWorksharingLoop()
3352 if (OrderedClause->getNumForLoops()) in EmitOMPWorksharingLoop()
3353 RT.emitDoacrossInit(*this, S, OrderedClause->getLoopNumIterations()); in EmitOMPWorksharingLoop()
3376 // initialization of firstprivate variables and post-update of in EmitOMPWorksharingLoop()
3397 ScheduleKind.Schedule = C->getScheduleKind(); in EmitOMPWorksharingLoop()
3398 ScheduleKind.M1 = C->getFirstScheduleModifier(); in EmitOMPWorksharingLoop()
3399 ScheduleKind.M2 = C->getSecondScheduleModifier(); in EmitOMPWorksharingLoop()
3400 ChunkExpr = C->getChunkSize(); in EmitOMPWorksharingLoop()
3410 Chunk = EmitScalarConversion(Chunk, ChunkExpr->getType(), in EmitOMPWorksharingLoop()
3411 S.getIterationVariable()->getType(), in EmitOMPWorksharingLoop()
3414 if (ChunkExpr->EvaluateAsInt(Result, getContext())) { in EmitOMPWorksharingLoop()
3419 const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); in EmitOMPWorksharingLoop()
3420 const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); in EmitOMPWorksharingLoop()
3449 if (C->getKind() == OMPC_ORDER_concurrent) in EmitOMPWorksharingLoop()
3450 CGF.LoopStack.setParallel(/*Enable=*/true); in EmitOMPWorksharingLoop()
3456 // OpenMP [2.7.1, Loop Construct, Description, table 2-1] in EmitOMPWorksharingLoop()
3523 // Emit post-update of the reduction variables if IsLastIter != 0. in EmitOMPWorksharingLoop()
3572 const unsigned IVSize = CGF.getContext().getTypeSize(IVExpr->getType()); in emitDispatchForLoopBounds()
3595 assert(C->getModifier() == OMPC_REDUCTION_inscan && in emitScanBasedDirectiveDecls()
3597 Shareds.append(C->varlist_begin(), C->varlist_end()); in emitScanBasedDirectiveDecls()
3598 Privates.append(C->privates().begin(), C->privates().end()); in emitScanBasedDirectiveDecls()
3599 ReductionOps.append(C->reduction_ops().begin(), C->reduction_ops().end()); in emitScanBasedDirectiveDecls()
3600 CopyArrayTemps.append(C->copy_array_temps().begin(), in emitScanBasedDirectiveDecls()
3601 C->copy_array_temps().end()); in emitScanBasedDirectiveDecls()
3611 const auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(IRef)->getDecl()); in emitScanBasedDirectiveDecls()
3614 if (PrivateVD->getType()->isVariablyModifiedType()) { in emitScanBasedDirectiveDecls()
3621 cast<VariableArrayType>((*ITA)->getType()->getAsArrayTypeUnsafe()) in emitScanBasedDirectiveDecls()
3622 ->getSizeExpr()), in emitScanBasedDirectiveDecls()
3625 CGF.EmitVarDecl(*cast<VarDecl>(cast<DeclRefExpr>(*ITA)->getDecl())); in emitScanBasedDirectiveDecls()
3635 /// <orig_var> = buffer[num_iters-1];
3649 assert(C->getModifier() == OMPC_REDUCTION_inscan && in emitScanBasedDirectiveFinals()
3651 Shareds.append(C->varlist_begin(), C->varlist_end()); in emitScanBasedDirectiveFinals()
3652 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in emitScanBasedDirectiveFinals()
3653 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in emitScanBasedDirectiveFinals()
3654 Privates.append(C->privates().begin(), C->privates().end()); in emitScanBasedDirectiveFinals()
3655 CopyOps.append(C->copy_ops().begin(), C->copy_ops().end()); in emitScanBasedDirectiveFinals()
3656 CopyArrayElems.append(C->copy_array_elems().begin(), in emitScanBasedDirectiveFinals()
3657 C->copy_array_elems().end()); in emitScanBasedDirectiveFinals()
3671 cast<ArraySubscriptExpr>(CopyArrayElem)->getIdx()), in emitScanBasedDirectiveFinals()
3676 PrivateExpr->getType(), DestLVal.getAddress(), SrcLVal.getAddress(), in emitScanBasedDirectiveFinals()
3677 cast<VarDecl>(cast<DeclRefExpr>(LHSs[I])->getDecl()), in emitScanBasedDirectiveFinals()
3678 cast<VarDecl>(cast<DeclRefExpr>(RHSs[I])->getDecl()), CopyOps[I]); in emitScanBasedDirectiveFinals()
3692 /// for (size cnt = last_iter; cnt >= pow(2, k); --k)
3693 /// buffer[i] op= buffer[i-pow(2,k)];
3697 /// red = InclusiveScan ? buffer[i] : buffer[i-1];
3714 assert(C->getModifier() == OMPC_REDUCTION_inscan && in emitScanBasedDirective()
3716 Privates.append(C->privates().begin(), C->privates().end()); in emitScanBasedDirective()
3717 ReductionOps.append(C->reduction_ops().begin(), C->reduction_ops().end()); in emitScanBasedDirective()
3718 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in emitScanBasedDirective()
3719 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in emitScanBasedDirective()
3720 CopyArrayElems.append(C->copy_array_elems().begin(), in emitScanBasedDirective()
3721 C->copy_array_elems().end()); in emitScanBasedDirective()
3761 Counter->addIncoming(llvm::ConstantInt::get(CGF.IntTy, 0), InputBB); in emitScanBasedDirective()
3762 Pow2K->addIncoming(llvm::ConstantInt::get(CGF.SizeTy, 1), InputBB); in emitScanBasedDirective()
3763 // for (size i = n - 1; i >= 2 ^ k; --i) in emitScanBasedDirective()
3764 // tmp[i] op= tmp[i-pow2k]; in emitScanBasedDirective()
3773 IVal->addIncoming(NMin1, LoopBB); in emitScanBasedDirective()
3779 const auto *LHSVD = cast<VarDecl>(cast<DeclRefExpr>(*ILHS)->getDecl()); in emitScanBasedDirective()
3780 const auto *RHSVD = cast<VarDecl>(cast<DeclRefExpr>(*IRHS)->getDecl()); in emitScanBasedDirective()
3786 cast<ArraySubscriptExpr>(CopyArrayElem)->getIdx()), in emitScanBasedDirective()
3797 cast<ArraySubscriptExpr>(CopyArrayElem)->getIdx()), in emitScanBasedDirective()
3812 IVal->addIncoming(NextIVal, CGF.Builder.GetInsertBlock()); in emitScanBasedDirective()
3818 Counter->addIncoming(Next, CGF.Builder.GetInsertBlock()); in emitScanBasedDirective()
3822 Pow2K->addIncoming(NextPow2K, CGF.Builder.GetInsertBlock()); in emitScanBasedDirective()
3848 return C->getModifier() == OMPC_REDUCTION_inscan; in emitWorksharingDirective()
3896 if (SC->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) in isSupportedByOpenMPIRBuilder()
3898 if (SC->getSecondScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) in isSupportedByOpenMPIRBuilder()
3900 switch (SC->getScheduleKind()) { in isSupportedByOpenMPIRBuilder()
3951 convertClauseKindToSchedKind(SchedClause->getScheduleKind()); in EmitOMPForDirective()
3952 if (const Expr *ChunkSizeExpr = SchedClause->getChunkSize()) in EmitOMPForDirective()
3964 AllocaInsertPt->getParent(), AllocaInsertPt->getIterator()); in EmitOMPForDirective()
4022 const Stmt *CapturedStmt = S.getInnermostCapturedStmt()->getCapturedStmt(); in EmitSections()
4034 ? CGF.Builder.getInt32(CS->size() - 1) in EmitSections()
4063 // case <NumSection> - 1: in EmitSections()
4064 // <SectionStmt[<NumSection> - 1]>; in EmitSections()
4071 ExitBB, CS == nullptr ? 1 : CS->size()); in EmitSections()
4074 for (const Stmt *SubStmt : CS->children()) { in EmitSections()
4077 SwitchStmt->addCase(CGF.Builder.getInt32(CaseNumber), CaseBB); in EmitSections()
4085 SwitchStmt->addCase(CGF.Builder.getInt32(0), CaseBB); in EmitSections()
4095 // initialization of firstprivate variables and post-update of lastprivate in EmitSections()
4109 // Emit static non-chunked loop. in EmitSections()
4134 // Emit post-update of the reduction variables if IsLastIter != 0. in EmitSections()
4150 HasCancel = OSD->hasCancel(); in EmitSections()
4152 HasCancel = OPSD->hasCancel(); in EmitSections()
4178 const Stmt *CapturedStmt = S.getInnermostCapturedStmt()->getCapturedStmt(); in EmitOMPSectionsDirective()
4182 for (const Stmt *SubStmt : CS->children()) { in EmitOMPSectionsDirective()
4206 // data-sharing attribute "shared". in EmitOMPSectionsDirective()
4215 AllocaInsertPt->getParent(), AllocaInsertPt->getIterator()); in EmitOMPSectionsDirective()
4273 CopyprivateVars.append(C->varlists().begin(), C->varlists().end()); in EmitOMPSingleDirective()
4274 DestExprs.append(C->destination_exprs().begin(), in EmitOMPSingleDirective()
4275 C->destination_exprs().end()); in EmitOMPSingleDirective()
4276 SrcExprs.append(C->source_exprs().begin(), C->source_exprs().end()); in EmitOMPSingleDirective()
4277 AssignmentOps.append(C->assignment_ops().begin(), in EmitOMPSingleDirective()
4278 C->assignment_ops().end()); in EmitOMPSingleDirective()
4287 CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); in EmitOMPSingleDirective()
4351 Filter = FilterClause->getThreadID(); in emitMasked()
4364 Filter = FilterClause->getThreadID(); in EmitOMPMaskedDirective()
4399 Hint = HintClause->getHint(); in EmitOMPCriticalDirective()
4434 Hint = HintClause->getHint(); in EmitOMPCriticalDirective()
4461 return C->getModifier() == OMPC_REDUCTION_inscan; in EmitOMPParallelForDirective()
4495 return C->getModifier() == OMPC_REDUCTION_inscan; in EmitOMPParallelForSimdDirective()
4596 for (const Decl *D : S->decls()) { in VisitDeclStmt()
4598 if (VD->hasLocalStorage()) in VisitDeclStmt()
4609 for (const Stmt *Child : S->children()) in VisitStmt()
4626 return C->getDependencyKind() == OMPC_DEPEND_outallmemory || in buildDependences()
4627 C->getDependencyKind() == OMPC_DEPEND_inoutallmemory; in buildDependences()
4642 OpenMPDependClauseKind Kind = C->getDependencyKind(); in buildDependences()
4648 Data.Dependences.emplace_back(C->getDependencyKind(), C->getModifier()); in buildDependences()
4649 DD.DepExprs.append(C->varlist_begin(), C->varlist_end()); in buildDependences()
4659 auto I = CS->getCapturedDecl()->param_begin(); in EmitOMPTaskBasedDirective()
4666 const Expr *Cond = Clause->getCondition(); in EmitOMPTaskBasedDirective()
4678 const Expr *Prio = Clause->getPriority(); in EmitOMPTaskBasedDirective()
4681 EmitScalarExpr(Prio), Prio->getType(), in EmitOMPTaskBasedDirective()
4683 Prio->getExprLoc())); in EmitOMPTaskBasedDirective()
4690 auto IRef = C->varlist_begin(); in EmitOMPTaskBasedDirective()
4691 for (const Expr *IInit : C->private_copies()) { in EmitOMPTaskBasedDirective()
4692 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPTaskBasedDirective()
4693 if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPTaskBasedDirective()
4703 auto IRef = C->varlist_begin(); in EmitOMPTaskBasedDirective()
4704 auto IElemInitRef = C->inits().begin(); in EmitOMPTaskBasedDirective()
4705 for (const Expr *IInit : C->private_copies()) { in EmitOMPTaskBasedDirective()
4706 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPTaskBasedDirective()
4707 if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPTaskBasedDirective()
4719 auto IRef = C->varlist_begin(); in EmitOMPTaskBasedDirective()
4720 auto ID = C->destination_exprs().begin(); in EmitOMPTaskBasedDirective()
4721 for (const Expr *IInit : C->private_copies()) { in EmitOMPTaskBasedDirective()
4722 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl()); in EmitOMPTaskBasedDirective()
4723 if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) { in EmitOMPTaskBasedDirective()
4728 std::make_pair(cast<VarDecl>(cast<DeclRefExpr>(*ID)->getDecl()), in EmitOMPTaskBasedDirective()
4737 Data.ReductionVars.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTaskBasedDirective()
4738 Data.ReductionOrigs.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTaskBasedDirective()
4739 Data.ReductionCopies.append(C->privates().begin(), C->privates().end()); in EmitOMPTaskBasedDirective()
4740 Data.ReductionOps.append(C->reduction_ops().begin(), in EmitOMPTaskBasedDirective()
4741 C->reduction_ops().end()); in EmitOMPTaskBasedDirective()
4742 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPTaskBasedDirective()
4743 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPTaskBasedDirective()
4752 Checker.Visit(S.getInnermostCapturedStmt()->getCapturedStmt()); in EmitOMPTaskBasedDirective()
4767 CGF.CapturedStmtInfo->getCaptureFields(); in EmitOMPTaskBasedDirective()
4768 llvm::Value *ContextValue = CGF.CapturedStmtInfo->getContextValue(); in EmitOMPTaskBasedDirective()
4785 const VarDecl *SharedVar = It->first; in EmitOMPTaskBasedDirective()
4786 RecordDecl *CaptureRecord = It->second->getParent(); in EmitOMPTaskBasedDirective()
4790 Layout.getFieldOffset(It->second->getFieldIndex()) / CharWidth; in EmitOMPTaskBasedDirective()
4792 (void)DI->EmitDeclareOfAutoVariable(SharedVar, ContextValue, in EmitOMPTaskBasedDirective()
4805 Declare->setExpression(llvm::DIExpression::get(Ctx, Ops)); in EmitOMPTaskBasedDirective()
4807 llvm::Instruction &Last = CGF.Builder.GetInsertBlock()->back(); in EmitOMPTaskBasedDirective()
4809 UpdateExpr(DDI->getContext(), DDI, Offset); in EmitOMPTaskBasedDirective()
4814 CGF.Builder.GetInsertBlock()->getTrailingDbgRecords()) { in EmitOMPTaskBasedDirective()
4816 llvm::filterDbgVars(Marker->getDbgRecordRange()))) { in EmitOMPTaskBasedDirective()
4829 CGF.GetAddrOfLocalVar(CS->getCapturedDecl()->getParam(CopyFnParam))); in EmitOMPTaskBasedDirective()
4831 CS->getCapturedDecl()->getParam(PrivatesParam))); in EmitOMPTaskBasedDirective()
4837 ParamTypes.push_back(PrivatesPtr->getType()); in EmitOMPTaskBasedDirective()
4839 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPTaskBasedDirective()
4841 CGF.getContext().getPointerType(E->getType()), ".priv.ptr.addr"); in EmitOMPTaskBasedDirective()
4847 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPTaskBasedDirective()
4849 CGF.CreateMemTemp(CGF.getContext().getPointerType(E->getType()), in EmitOMPTaskBasedDirective()
4857 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPTaskBasedDirective()
4859 CGF.CreateMemTemp(CGF.getContext().getPointerType(E->getType()), in EmitOMPTaskBasedDirective()
4866 QualType Ty = VD->getType().getNonReferenceType(); in EmitOMPTaskBasedDirective()
4867 if (VD->getType()->isLValueReferenceType()) in EmitOMPTaskBasedDirective()
4887 const auto *OrigVD = cast<VarDecl>(Pair.second->getDecl()); in EmitOMPTaskBasedDirective()
4890 CGF.CapturedStmtInfo->lookup(OrigVD) != nullptr, in EmitOMPTaskBasedDirective()
4891 Pair.second->getType(), VK_LValue, in EmitOMPTaskBasedDirective()
4892 Pair.second->getExprLoc()); in EmitOMPTaskBasedDirective()
4898 CGF.ConvertTypeForMem(Pair.first->getType().getNonReferenceType()), in EmitOMPTaskBasedDirective()
4903 (void)DI->EmitDeclareOfAutoVariable( in EmitOMPTaskBasedDirective()
4910 QualType VDType = Pair.first->getType().getNonReferenceType(); in EmitOMPTaskBasedDirective()
4911 if (Pair.first->getType()->isLValueReferenceType()) in EmitOMPTaskBasedDirective()
4937 CGF.ConvertTypeForMem(Pair.first->getType().getNonReferenceType()), in EmitOMPTaskBasedDirective()
4946 CGF.GetAddrOfLocalVar(CS->getCapturedDecl()->getParam(9))); in EmitOMPTaskBasedDirective()
4961 Data.ReductionCopies[Cnt]->getType()), in EmitOMPTaskBasedDirective()
4962 Data.ReductionCopies[Cnt]->getExprLoc()), in EmitOMPTaskBasedDirective()
4963 CGF.ConvertTypeForMem(Data.ReductionCopies[Cnt]->getType()), in EmitOMPTaskBasedDirective()
4976 auto IPriv = C->privates().begin(); in EmitOMPTaskBasedDirective()
4977 auto IRed = C->reduction_ops().begin(); in EmitOMPTaskBasedDirective()
4978 auto ITD = C->taskgroup_descriptors().begin(); in EmitOMPTaskBasedDirective()
4979 for (const Expr *Ref : C->varlists()) { in EmitOMPTaskBasedDirective()
5007 TRExpr->getExprLoc()); in EmitOMPTaskBasedDirective()
5016 CGF.getContext().getPointerType(InRedPrivs[Cnt]->getType()), in EmitOMPTaskBasedDirective()
5017 InRedPrivs[Cnt]->getExprLoc()), in EmitOMPTaskBasedDirective()
5018 CGF.ConvertTypeForMem(InRedPrivs[Cnt]->getType()), in EmitOMPTaskBasedDirective()
5060 PrivateVD->setInitStyle(VarDecl::CInit); in createImplicitFirstprivateForType()
5061 PrivateVD->setInit(ImplicitCastExpr::Create(C, ElemType, CK_LValueToRValue, in createImplicitFirstprivateForType()
5076 QualType SharedsTy = getContext().getRecordType(CS->getCapturedRecordDecl()); in EmitOMPTargetTaskBasedDirective()
5077 auto I = CS->getCapturedDecl()->param_begin(); in EmitOMPTargetTaskBasedDirective()
5085 auto IRef = C->varlist_begin(); in EmitOMPTargetTaskBasedDirective()
5086 auto IElemInitRef = C->inits().begin(); in EmitOMPTargetTaskBasedDirective()
5087 for (auto *IInit : C->private_copies()) { in EmitOMPTargetTaskBasedDirective()
5098 Data.ReductionVars.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTargetTaskBasedDirective()
5099 Data.ReductionOrigs.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTargetTaskBasedDirective()
5100 Data.ReductionCopies.append(C->privates().begin(), C->privates().end()); in EmitOMPTargetTaskBasedDirective()
5101 Data.ReductionOps.append(C->reduction_ops().begin(), in EmitOMPTargetTaskBasedDirective()
5102 C->reduction_ops().end()); in EmitOMPTargetTaskBasedDirective()
5103 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPTargetTaskBasedDirective()
5104 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPTargetTaskBasedDirective()
5131 // If there is no user-defined mapper, the mapper array will be nullptr. In in EmitOMPTargetTaskBasedDirective()
5149 CGF.GetAddrOfLocalVar(CS->getCapturedDecl()->getParam(CopyFnParam))); in EmitOMPTargetTaskBasedDirective()
5151 CS->getCapturedDecl()->getParam(PrivatesParam))); in EmitOMPTargetTaskBasedDirective()
5157 ParamTypes.push_back(PrivatesPtr->getType()); in EmitOMPTargetTaskBasedDirective()
5159 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPTargetTaskBasedDirective()
5161 CGF.CreateMemTemp(CGF.getContext().getPointerType(E->getType()), in EmitOMPTargetTaskBasedDirective()
5174 CGF.ConvertTypeForMem(Pair.first->getType().getNonReferenceType()), in EmitOMPTargetTaskBasedDirective()
5202 CGF, TL->getThreadLimit(), S.getBeginLoc()); in EmitOMPTargetTaskBasedDirective()
5228 CGF.GetAddrOfLocalVar(CS->getCapturedDecl()->getParam(4))); in processInReduction()
5243 Data.ReductionCopies[Cnt]->getType()), in processInReduction()
5244 Data.ReductionCopies[Cnt]->getExprLoc()), in processInReduction()
5245 CGF.ConvertTypeForMem(Data.ReductionCopies[Cnt]->getType()), in processInReduction()
5257 auto IPriv = C->privates().begin(); in processInReduction()
5258 auto IRed = C->reduction_ops().begin(); in processInReduction()
5259 auto ITD = C->taskgroup_descriptors().begin(); in processInReduction()
5260 for (const Expr *Ref : C->varlists()) { in processInReduction()
5284 CGF.EmitLoadOfScalar(CGF.EmitLValue(TRExpr), TRExpr->getExprLoc()); in processInReduction()
5293 CGF.getContext().getPointerType(InRedPrivs[Cnt]->getType()), in processInReduction()
5294 InRedPrivs[Cnt]->getExprLoc()), in processInReduction()
5295 CGF.ConvertTypeForMem(InRedPrivs[Cnt]->getType()), in processInReduction()
5308 QualType SharedsTy = getContext().getRecordType(CS->getCapturedRecordDecl()); in EmitOMPTaskDirective()
5311 if (C->getNameModifier() == OMPD_unknown || in EmitOMPTaskDirective()
5312 C->getNameModifier() == OMPD_task) { in EmitOMPTaskDirective()
5313 IfCond = C->getCondition(); in EmitOMPTaskDirective()
5322 CGF.EmitStmt(CS->getCapturedStmt()); in EmitOMPTaskDirective()
5343 Expr *ME = MC ? MC->getMessageString() : nullptr; in EmitOMPErrorDirective()
5346 if (!SC || SC->getSeverityKind() == OMPC_SEVERITY_fatal) in EmitOMPErrorDirective()
5373 InsertPointTy AllocaIP(AllocaInsertPt->getParent(), in EmitOMPTaskgroupDirective()
5374 AllocaInsertPt->getIterator()); in EmitOMPTaskgroupDirective()
5379 EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); in EmitOMPTaskgroupDirective()
5394 Data.ReductionVars.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTaskgroupDirective()
5395 Data.ReductionOrigs.append(C->varlist_begin(), C->varlist_end()); in EmitOMPTaskgroupDirective()
5396 Data.ReductionCopies.append(C->privates().begin(), C->privates().end()); in EmitOMPTaskgroupDirective()
5397 Data.ReductionOps.append(C->reduction_ops().begin(), in EmitOMPTaskgroupDirective()
5398 C->reduction_ops().end()); in EmitOMPTaskgroupDirective()
5399 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPTaskgroupDirective()
5400 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPTaskgroupDirective()
5405 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitOMPTaskgroupDirective()
5408 /*Volatile=*/false, E->getType()); in EmitOMPTaskgroupDirective()
5410 CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); in EmitOMPTaskgroupDirective()
5421 [&S]() -> ArrayRef<const Expr *> { in EmitOMPFlushDirective()
5423 return llvm::ArrayRef(FlushClause->varlist_begin(), in EmitOMPFlushDirective()
5424 FlushClause->varlist_end()); in EmitOMPFlushDirective()
5432 LValue DOLVal = EmitLValue(DO->getDepobj()); in EmitOMPDepobjDirective()
5434 OMPTaskDataTy::DependData Dependencies(DC->getDependencyKind(), in EmitOMPDepobjDirective()
5435 DC->getModifier()); in EmitOMPDepobjDirective()
5436 Dependencies.DepExprs.append(DC->varlist_begin(), DC->varlist_end()); in EmitOMPDepobjDirective()
5438 *this, Dependencies, DC->getBeginLoc()); in EmitOMPDepobjDirective()
5443 CGM.getOpenMPRuntime().emitDestroyClause(*this, DOLVal, DC->getBeginLoc()); in EmitOMPDepobjDirective()
5448 *this, DOLVal, UC->getDependencyKind(), UC->getBeginLoc()); in EmitOMPDepobjDirective()
5467 if (C->getModifier() != OMPC_REDUCTION_inscan) in EmitOMPScanDirective()
5469 Shareds.append(C->varlist_begin(), C->varlist_end()); in EmitOMPScanDirective()
5470 Privates.append(C->privates().begin(), C->privates().end()); in EmitOMPScanDirective()
5471 LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end()); in EmitOMPScanDirective()
5472 RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end()); in EmitOMPScanDirective()
5473 ReductionOps.append(C->reduction_ops().begin(), C->reduction_ops().end()); in EmitOMPScanDirective()
5474 CopyOps.append(C->copy_ops().begin(), C->copy_ops().end()); in EmitOMPScanDirective()
5475 CopyArrayTemps.append(C->copy_array_temps().begin(), in EmitOMPScanDirective()
5476 C->copy_array_temps().end()); in EmitOMPScanDirective()
5477 CopyArrayElems.append(C->copy_array_elems().begin(), in EmitOMPScanDirective()
5478 C->copy_array_elems().end()); in EmitOMPScanDirective()
5483 // For simd directive and simd-based directives in simd only mode, use the in EmitOMPScanDirective()
5537 *cast<VarDecl>(cast<DeclRefExpr>(TempExpr)->getDecl())); in EmitOMPScanDirective()
5540 EmitOMPCopy(PrivateExpr->getType(), DestLVal.getAddress(), in EmitOMPScanDirective()
5542 cast<VarDecl>(cast<DeclRefExpr>(LHSs[I])->getDecl()), in EmitOMPScanDirective()
5543 cast<VarDecl>(cast<DeclRefExpr>(RHSs[I])->getDecl()), in EmitOMPScanDirective()
5563 PrivateExpr->getType(), DestLVal.getAddress(), SrcLVal.getAddress(), in EmitOMPScanDirective()
5564 cast<VarDecl>(cast<DeclRefExpr>(LHSs[I])->getDecl()), in EmitOMPScanDirective()
5565 cast<VarDecl>(cast<DeclRefExpr>(RHSs[I])->getDecl()), CopyOps[I]); in EmitOMPScanDirective()
5583 ->IgnoreParenImpCasts(); in EmitOMPScanDirective()
5585 llvm::Value *IdxVal = EmitLoadOfScalar(IdxLVal, IVExpr->getExprLoc()); in EmitOMPScanDirective()
5594 cast<ArraySubscriptExpr>(CopyArrayElem)->getIdx()), in EmitOMPScanDirective()
5599 PrivateExpr->getType(), DestLVal.getAddress(), SrcLVal.getAddress(), in EmitOMPScanDirective()
5600 cast<VarDecl>(cast<DeclRefExpr>(LHSs[I])->getDecl()), in EmitOMPScanDirective()
5601 cast<VarDecl>(cast<DeclRefExpr>(RHSs[I])->getDecl()), CopyOps[I]); in EmitOMPScanDirective()
5614 ->IgnoreParenImpCasts(); in EmitOMPScanDirective()
5616 llvm::Value *IdxVal = EmitLoadOfScalar(IdxLVal, IVExpr->getExprLoc()); in EmitOMPScanDirective()
5625 // Use idx - 1 iteration for exclusive scan. in EmitOMPScanDirective()
5635 cast<ArraySubscriptExpr>(CopyArrayElem)->getIdx()), in EmitOMPScanDirective()
5640 PrivateExpr->getType(), DestLVal.getAddress(), SrcLVal.getAddress(), in EmitOMPScanDirective()
5641 cast<VarDecl>(cast<DeclRefExpr>(LHSs[I])->getDecl()), in EmitOMPScanDirective()
5642 cast<VarDecl>(cast<DeclRefExpr>(RHSs[I])->getDecl()), CopyOps[I]); in EmitOMPScanDirective()
5658 const auto *IVDecl = cast<VarDecl>(IVExpr->getDecl()); in EmitOMPDistributeLoop()
5665 EmitVarDecl(*cast<VarDecl>(LIExpr->getDecl())); in EmitOMPDistributeLoop()
5673 // Check pre-condition. in EmitOMPDistributeLoop()
5716 // on initialization of firstprivate variables and post-update of in EmitOMPDistributeLoop()
5737 ScheduleKind = C->getDistScheduleKind(); in EmitOMPDistributeLoop()
5738 if (const Expr *Ch = C->getChunkSize()) { in EmitOMPDistributeLoop()
5740 Chunk = EmitScalarConversion(Chunk, Ch->getType(), in EmitOMPDistributeLoop()
5741 S.getIterationVariable()->getType(), in EmitOMPDistributeLoop()
5749 const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); in EmitOMPDistributeLoop()
5750 const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); in EmitOMPDistributeLoop()
5755 // assigned to the teams of the league in a round-robin fashion in the in EmitOMPDistributeLoop()
5859 // Emit post-update of the reduction variables if IsLastIter != 0. in EmitOMPDistributeLoop()
5898 Fn->setDoesNotRecurse(); in emitOutlinedOrderedFunction()
5907 unsigned NumLoops = C->getNumLoops(); in emitRestoreIP()
5912 const Expr *CounterVal = C->getLoopData(I); in emitRestoreIP()
5915 CGF.EmitScalarExpr(CounterVal), CounterVal->getType(), Int64Ty, in emitRestoreIP()
5916 CounterVal->getExprLoc()); in emitRestoreIP()
5936 InsertPointTy AllocaIP(AllocaInsertPt->getParent(), in EmitOMPOrderedDirective()
5937 AllocaInsertPt->getIterator()); in EmitOMPOrderedDirective()
5970 *this, CS->getCapturedStmt(), AllocaIP, CodeGenIP, "ordered"); in EmitOMPOrderedDirective()
6008 CGF.EmitStmt(CS->getCapturedStmt()); in EmitOMPOrderedDirective()
6036 DestType->castAs<ComplexType>()->getElementType(); in convertToComplexValue()
6040 ScalarVal, llvm::Constant::getNullValue(ScalarVal->getType())); in convertToComplexValue()
6043 QualType SrcElementType = SrcType->castAs<ComplexType>()->getElementType(); in convertToComplexValue()
6045 DestType->castAs<ComplexType>()->getElementType(); in convertToComplexValue()
6094 assert(V->isLValue() && "V of 'omp atomic read' is not lvalue"); in emitOMPAtomicReadExpr()
6095 assert(X->isLValue() && "X of 'omp atomic read' is not lvalue"); in emitOMPAtomicReadExpr()
6117 CGF.emitOMPSimpleStore(VLValue, Res, X->getType().getNonReferenceType(), Loc); in emitOMPAtomicReadExpr()
6125 assert(X->isLValue() && "X of 'omp atomic write' is not lvalue"); in emitOMPAtomicWriteExpr()
6159 (Update.getScalarVal()->getType() != X.getAddress().getElementType())) || in emitOMPAtomicRMW()
6165 if (T->isIntegerTy()) in emitOMPAtomicRMW()
6168 if (T->isFloatingPointTy() && (BO == BO_Add || BO == BO_Sub)) in emitOMPAtomicRMW()
6174 if (!CheckAtomicSupport(Update.getScalarVal()->getType(), BO) || in emitOMPAtomicRMW()
6178 bool IsInteger = X.getAddress().getElementType()->isIntegerTy(); in emitOMPAtomicRMW()
6200 RMWOp = X.getType()->hasSignedIntegerRepresentation() in emitOMPAtomicRMW()
6211 RMWOp = X.getType()->hasSignedIntegerRepresentation() in emitOMPAtomicRMW()
6256 X.getType()->hasSignedIntegerRepresentation()); in emitOMPAtomicRMW()
6271 // x binop= expr; -> xrval + expr; in EmitOMPAtomicSimpleUpdateExpr()
6272 // x++, ++x -> xrval + 1; in EmitOMPAtomicSimpleUpdateExpr()
6273 // x--, --x -> xrval - 1; in EmitOMPAtomicSimpleUpdateExpr()
6274 // x = x binop expr; -> xrval binop expr in EmitOMPAtomicSimpleUpdateExpr()
6275 // x = expr Op x; - > expr binop xrval; in EmitOMPAtomicSimpleUpdateExpr()
6283 // Perform compare-and-swap procedure. in EmitOMPAtomicSimpleUpdateExpr()
6294 assert(isa<BinaryOperator>(UE->IgnoreImpCasts()) && in emitOMPAtomicUpdateExpr()
6296 const auto *BOUE = cast<BinaryOperator>(UE->IgnoreImpCasts()); in emitOMPAtomicUpdateExpr()
6298 // x binop= expr; -> xrval + expr; in emitOMPAtomicUpdateExpr()
6299 // x++, ++x -> xrval + 1; in emitOMPAtomicUpdateExpr()
6300 // x--, --x -> xrval - 1; in emitOMPAtomicUpdateExpr()
6301 // x = x binop expr; -> xrval binop expr in emitOMPAtomicUpdateExpr()
6302 // x = expr Op x; - > expr binop xrval; in emitOMPAtomicUpdateExpr()
6303 assert(X->isLValue() && "X of 'omp atomic update' is not lvalue"); in emitOMPAtomicUpdateExpr()
6306 const auto *LHS = cast<OpaqueValueExpr>(BOUE->getLHS()->IgnoreImpCasts()); in emitOMPAtomicUpdateExpr()
6307 const auto *RHS = cast<OpaqueValueExpr>(BOUE->getRHS()->IgnoreImpCasts()); in emitOMPAtomicUpdateExpr()
6316 XLValue, ExprRValue, BOUE->getOpcode(), IsXLHSInRHSPart, AO, Loc, Gen); in emitOMPAtomicUpdateExpr()
6361 assert(X->isLValue() && "X of 'omp atomic capture' is not lvalue"); in emitOMPAtomicCaptureExpr()
6362 assert(V->isLValue() && "V of 'omp atomic capture' is not lvalue"); in emitOMPAtomicCaptureExpr()
6370 assert(isa<BinaryOperator>(UE->IgnoreImpCasts()) && in emitOMPAtomicCaptureExpr()
6372 const auto *BOUE = cast<BinaryOperator>(UE->IgnoreImpCasts()); in emitOMPAtomicCaptureExpr()
6374 // x binop= expr; -> xrval + expr; in emitOMPAtomicCaptureExpr()
6375 // x++, ++x -> xrval + 1; in emitOMPAtomicCaptureExpr()
6376 // x--, --x -> xrval - 1; in emitOMPAtomicCaptureExpr()
6377 // x = x binop expr; -> xrval binop expr in emitOMPAtomicCaptureExpr()
6378 // x = expr Op x; - > expr binop xrval; in emitOMPAtomicCaptureExpr()
6379 const auto *LHS = cast<OpaqueValueExpr>(BOUE->getLHS()->IgnoreImpCasts()); in emitOMPAtomicCaptureExpr()
6380 const auto *RHS = cast<OpaqueValueExpr>(BOUE->getRHS()->IgnoreImpCasts()); in emitOMPAtomicCaptureExpr()
6382 NewVValType = XRValExpr->getType(); in emitOMPAtomicCaptureExpr()
6393 XLValue, ExprRValue, BOUE->getOpcode(), IsXLHSInRHSPart, AO, Loc, Gen); in emitOMPAtomicCaptureExpr()
6410 NewVValType = X->getType().getNonReferenceType(); in emitOMPAtomicCaptureExpr()
6411 ExprRValue = convertToType(CGF, ExprRValue, E->getType(), in emitOMPAtomicCaptureExpr()
6412 X->getType().getNonReferenceType(), Loc); in emitOMPAtomicCaptureExpr()
6427 // Emit post-update store to 'v' of old/new 'x' value. in emitOMPAtomicCaptureExpr()
6472 switch (cast<BinaryOperator>(CE)->getOpcode()) { in emitOMPAtomicCompareExpr()
6490 if (X->getType() == E->getType()) in emitOMPAtomicCompareExpr()
6492 const Expr *NewE = E->IgnoreImplicitAsWritten(); in emitOMPAtomicCompareExpr()
6494 if (NewE->getType() == X->getType()) in emitOMPAtomicCompareExpr()
6496 return CGF.EmitScalarConversion(V, NewE->getType(), X->getType(), Loc); in emitOMPAtomicCompareExpr()
6504 E->getType()->hasSignedIntegerRepresentation()); in emitOMPAtomicCompareExpr()
6509 D->getType()->hasSignedIntegerRepresentation()); in emitOMPAtomicCompareExpr()
6513 X->getType()->hasSignedIntegerRepresentation(), in emitOMPAtomicCompareExpr()
6514 X->getType().isVolatileQualified()}; in emitOMPAtomicCompareExpr()
6520 V->getType()->hasSignedIntegerRepresentation(), in emitOMPAtomicCompareExpr()
6521 V->getType().isVolatileQualified()}; in emitOMPAtomicCompareExpr()
6527 R->getType()->hasSignedIntegerRepresentation(), in emitOMPAtomicCompareExpr()
6528 R->getType().isVolatileQualified()}; in emitOMPAtomicCompareExpr()
6601 OpenMPClauseKind K = C->getClauseKind(); in EmitOMPAtomicDirective()
6640 OpenMPClauseKind FailParameter = FailClause->getFailParameter(); in EmitOMPAtomicDirective()
6669 CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); in emitCommonOMPTargetDirective()
6681 if (C->getNameModifier() == OMPD_unknown || in emitCommonOMPTargetDirective()
6682 C->getNameModifier() == OMPD_target) { in emitCommonOMPTargetDirective()
6683 IfCond = C->getCondition(); in emitCommonOMPTargetDirective()
6692 Device.setPointerAndInt(C->getDevice(), C->getModifier()); in emitCommonOMPTargetDirective()
6731 const OMPLoopDirective &D) -> llvm::Value * { in emitCommonOMPTargetDirective()
6756 CGF.EmitStmt(S.getCapturedStmt(OMPD_target)->getCapturedStmt()); in emitTargetRegion()
6788 CGF, S, *CS->getCapturedDecl()->param_begin(), InnermostKind, in emitCommonOMPTeamsDirective()
6794 const Expr *NumTeams = NT ? NT->getNumTeams() : nullptr; in emitCommonOMPTeamsDirective()
6795 const Expr *ThreadLimit = TL ? TL->getThreadLimit() : nullptr; in emitCommonOMPTeamsDirective()
6817 CGF.EmitStmt(S.getCapturedStmt(OMPD_teams)->getCapturedStmt()); in EmitOMPTeamsDirective()
6839 CGF.EmitStmt(CS->getCapturedStmt()); in emitTargetTeamsRegion()
7060 Device = EmitScalarExpr(C->getDevice()); in EmitOMPInteropDirective()
7084 EmitLValue(C->getInteropVar()).getPointer(*this); in EmitOMPInteropDirective()
7087 if (C->getIsTarget()) { in EmitOMPInteropDirective()
7090 assert(C->getIsTargetSync() && in EmitOMPInteropDirective()
7091 "Expected interop-type target/targetsync"); in EmitOMPInteropDirective()
7104 EmitLValue(C->getInteropVar()).getPointer(*this); in EmitOMPInteropDirective()
7115 EmitLValue(C->getInteropVar()).getPointer(*this); in EmitOMPInteropDirective()
7235 if (C->getNameModifier() == OMPD_unknown || in EmitOMPCancelDirective()
7236 C->getNameModifier() == OMPD_cancel) { in EmitOMPCancelDirective()
7237 IfCond = C->getCondition(); in EmitOMPCancelDirective()
7282 const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(OrigVarIt)->getDecl()); in EmitOMPUseDevicePtrClause()
7293 const auto *ME = cast<MemberExpr>(OED->getInit()); in EmitOMPUseDevicePtrClause()
7294 assert(isa<CXXThisExpr>(ME->getBase()->IgnoreImpCasts()) && in EmitOMPUseDevicePtrClause()
7296 MatchingVD = ME->getMemberDecl(); in EmitOMPUseDevicePtrClause()
7305 llvm::Type *Ty = ConvertTypeForMem(OrigVD->getType().getNonReferenceType()); in EmitOMPUseDevicePtrClause()
7310 Address(InitAddrIt->second, Ty, in EmitOMPUseDevicePtrClause()
7319 const Expr *Base = Ref->IgnoreParenImpCasts(); in getBaseDecl()
7321 Base = OASE->getBase()->IgnoreParenImpCasts(); in getBaseDecl()
7323 Base = ASE->getBase()->IgnoreParenImpCasts(); in getBaseDecl()
7324 return cast<VarDecl>(cast<DeclRefExpr>(Base)->getDecl()); in getBaseDecl()
7343 const auto *ME = cast<MemberExpr>(OED->getInit()); in EmitOMPUseDeviceAddrClause()
7344 assert(isa<CXXThisExpr>(ME->getBase()) && in EmitOMPUseDeviceAddrClause()
7346 MatchingVD = ME->getMemberDecl(); in EmitOMPUseDeviceAddrClause()
7355 llvm::Type *Ty = ConvertTypeForMem(OrigVD->getType().getNonReferenceType()); in EmitOMPUseDeviceAddrClause()
7358 Address(InitAddrIt->second, Ty, in EmitOMPUseDeviceAddrClause()
7362 if (isa<DeclRefExpr>(Ref->IgnoreParenImpCasts()) || in EmitOMPUseDeviceAddrClause()
7363 MatchingVD->getType()->isArrayType()) { in EmitOMPUseDeviceAddrClause()
7365 OrigVD->getType().getNonReferenceType()); in EmitOMPUseDeviceAddrClause()
7368 PtrTy->castAs<PointerType>()); in EmitOMPUseDeviceAddrClause()
7399 CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); in EmitOMPTargetDataDirective()
7407 // Call the pre-action to change the status of PrivatizeDevicePointers if in EmitOMPTargetDataDirective()
7429 for (const Expr *E : C->varlists()) { in EmitOMPTargetDataDirective()
7430 const Decl *D = cast<DeclRefExpr>(E)->getDecl(); in EmitOMPTargetDataDirective()
7435 for (const Expr *E : C->varlists()) { in EmitOMPTargetDataDirective()
7473 IfCond = C->getCondition(); in EmitOMPTargetDataDirective()
7478 Device = C->getDevice(); in EmitOMPTargetDataDirective()
7498 IfCond = C->getCondition(); in EmitOMPTargetEnterDataDirective()
7503 Device = C->getDevice(); in EmitOMPTargetEnterDataDirective()
7519 IfCond = C->getCondition(); in EmitOMPTargetExitDataDirective()
7524 Device = C->getDevice(); in EmitOMPTargetExitDataDirective()
7546 CGF.EmitStmt(CS->getCapturedStmt()); in emitTargetParallelRegion()
7660 const auto *VDecl = cast<VarDecl>(Helper->getDecl()); in mapParam()
7673 QualType SharedsTy = getContext().getRecordType(CS->getCapturedRecordDecl()); in EmitOMPTaskLoopBasedDirective()
7676 if (C->getNameModifier() == OMPD_unknown || in EmitOMPTaskLoopBasedDirective()
7677 C->getNameModifier() == OMPD_taskloop) { in EmitOMPTaskLoopBasedDirective()
7678 IfCond = C->getCondition(); in EmitOMPTaskLoopBasedDirective()
7692 Data.Schedule.setPointer(EmitScalarExpr(Clause->getGrainsize())); in EmitOMPTaskLoopBasedDirective()
7696 Data.Schedule.setPointer(EmitScalarExpr(Clause->getNumTasks())); in EmitOMPTaskLoopBasedDirective()
7706 // Emit: if (PreCond) - begin. in EmitOMPTaskLoopBasedDirective()
7729 auto *I = CS->getCapturedDecl()->param_begin(); in EmitOMPTaskLoopBasedDirective()
7730 auto *LBP = std::next(I, LowerBound); in EmitOMPTaskLoopBasedDirective() local
7734 mapParam(CGF, cast<DeclRefExpr>(S.getLowerBoundVariable()), *LBP, in EmitOMPTaskLoopBasedDirective()
7747 const auto *IVDecl = cast<VarDecl>(cast<DeclRefExpr>(IVExpr)->getDecl()); in EmitOMPTaskLoopBasedDirective()
7755 CGF.EmitVarDecl(*cast<VarDecl>(LIExpr->getDecl())); in EmitOMPTaskLoopBasedDirective()
7778 // Emit: if (PreCond) - end. in EmitOMPTaskLoopBasedDirective()
7789 (*LIP)->getType(), S.getBeginLoc()))); in EmitOMPTaskLoopBasedDirective()
7795 (*LIP)->getType(), S.getBeginLoc())); in EmitOMPTaskLoopBasedDirective()
7911 IfCond = C->getCondition(); in EmitOMPTargetUpdateDirective()
7916 Device = C->getDevice(); in EmitOMPTargetUpdateDirective()
7928 cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt(); in EmitOMPGenericLoopDirective()
7930 if (ForS && !isa<DeclStmt>(ForS->getInit())) { in EmitOMPGenericLoopDirective()
8149 for (const Expr *Ref : C->varlists()) { in EmitSimpleOMPExecutableDirective()
8150 const auto *DRE = cast<DeclRefExpr>(Ref->IgnoreParenImpCasts()); in EmitSimpleOMPExecutableDirective()
8153 const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()); in EmitSimpleOMPExecutableDirective()
8154 if (!VD || VD->hasLocalStorage()) in EmitSimpleOMPExecutableDirective()
8169 for (const Expr *E : LD->counters()) { in EmitSimpleOMPExecutableDirective()
8170 const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl()); in EmitSimpleOMPExecutableDirective()
8171 if (!VD->hasLocalStorage() && !CGF.LocalDeclMap.count(VD)) { in EmitSimpleOMPExecutableDirective()
8182 if (!C->getNumForLoops()) in EmitSimpleOMPExecutableDirective()
8184 for (unsigned I = LD->getLoopsNumber(), in EmitSimpleOMPExecutableDirective()
8185 E = C->getLoopNumIterations().size(); in EmitSimpleOMPExecutableDirective()
8188 cast<DeclRefExpr>(C->getLoopCounter(I))->getDecl())) { in EmitSimpleOMPExecutableDirective()
8197 CGF.EmitStmt(D.getInnermostCapturedStmt()->getCapturedStmt()); in EmitSimpleOMPExecutableDirective()