carlo.bertolli marked an inline comment as done. carlo.bertolli added a comment.
I have addressed some of the comments and restructured the code as requested. Let me know about further comments. Thanks for making this a better patch! ================ Comment at: lib/CodeGen/CGOpenMPRuntime.h:669-692 @@ -668,1 +668,26 @@ + /// \brief Schedule types for 'omp for' loops (these enumerators are taken from + /// the enum sched_type in kmp.h). + enum OpenMPSchedType { + /// \brief Lower bound for default (unordered) versions. + OMP_sch_lower = 32, + OMP_sch_static_chunked = 33, + OMP_sch_static = 34, + OMP_sch_dynamic_chunked = 35, + OMP_sch_guided_chunked = 36, + OMP_sch_runtime = 37, + OMP_sch_auto = 38, + /// \brief Lower bound for 'ordered' versions. + OMP_ord_lower = 64, + OMP_ord_static_chunked = 65, + OMP_ord_static = 66, + OMP_ord_dynamic_chunked = 67, + OMP_ord_guided_chunked = 68, + OMP_ord_runtime = 69, + OMP_ord_auto = 70, + /// \brief dist_schedule types + OMP_dist_sch_static_chunked = 91, + OMP_dist_sch_static = 92, + OMP_sch_default = OMP_sch_static, + }; + ---------------- Fixed - now everything related to the openmp library is encapsulated back into the CGOpenMPRuntime.cpp file. ================ Comment at: lib/CodeGen/CGOpenMPRuntime.h:717-725 @@ -682,2 +716,11 @@ + /// \brief Check if the specified \a DistScheduleKind is static non-chunked. + /// This kind of distribute directive is emitted without outer loop. + /// \param ScheduleKind DistSchedule kind specified in the 'dist_schedule' + /// clause. + /// \param Chunked True if chunk is specified in the clause. + /// + virtual bool isDistStaticNonchunked(OpenMPDistScheduleClauseKind ScheduleKind, + bool Chunked) const; + virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, ---------------- No difference: deleted the latter. ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1540-1541 @@ +1539,4 @@ + const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); + + RT.emitDistributeStaticInit(*this, S.getLocStart(), ScheduleKind, + IVSize, IVSigned, IL, LB, UB, ST, Chunk); ---------------- If this is about missing comments for booleans - done. Otherwise, please be specific about the bad formatting I did. ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2185-2216 @@ -2147,2 +2184,34 @@ } +static std::pair<llvm::Value * /*Chunk*/, OpenMPDistScheduleClauseKind> +emitDistScheduleClause(CodeGenFunction &CGF, const OMPDistributeDirective &S, + bool OuterRegion) { + // Detect the distribute schedule kind and chunk. + auto ScheduleKind = OMPC_DIST_SCHEDULE_unknown; + llvm::Value *Chunk = nullptr; + if (const auto *C = S.getSingleClause<OMPDistScheduleClause>()) { + ScheduleKind = C->getDistScheduleKind(); + if (const auto *Ch = C->getChunkSize()) { + if (auto *ImpRef = cast_or_null<DeclRefExpr>(C->getHelperChunkSize())) { + if (OuterRegion) { + const VarDecl *ImpVar = cast<VarDecl>(ImpRef->getDecl()); + CGF.EmitVarDecl(*ImpVar); + CGF.EmitStoreThroughLValue( + CGF.EmitAnyExpr(Ch), + CGF.MakeAddrLValue(CGF.GetAddrOfLocalVar(ImpVar), + ImpVar->getType())); + } else { + Ch = ImpRef; + } + } + if (!C->getHelperChunkSize() || !OuterRegion) { + Chunk = CGF.EmitScalarExpr(Ch); + Chunk = CGF.EmitScalarConversion(Chunk, Ch->getType(), + S.getIterationVariable()->getType(), + S.getLocStart()); + } + } + } + return std::make_pair(Chunk, ScheduleKind); +} + ---------------- I will wait until a new patch related to this is submitted - if it has not already. ================ Comment at: lib/CodeGen/CodeGenFunction.h:2405 @@ -2397,2 +2404,3 @@ OpenMPDirectiveKind EmitSections(const OMPExecutableDirective &S); + void EmitOMPDistributeLoop(const OMPDistributeDirective &S); ---------------- Made EmitOMPDistributeLoop public. What else needs to be public? Repository: rL LLVM http://reviews.llvm.org/D17170 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits