Index: clang/include/clang/AST/StmtOpenMP.h =================================================================== --- clang/include/clang/AST/StmtOpenMP.h +++ clang/include/clang/AST/StmtOpenMP.h @@ -5945,6 +5945,30 @@ unsigned CollapsedNum, ArrayRef Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs); + struct LoopDirCrParam { + const ASTContext *C; + SourceLocation StartLoc; + SourceLocation EndLoc; + unsigned CollapsedNum; + ArrayRef Clauses; + Stmt *AssociatedStmt; + const HelperExprs Exprs; + + LoopDirCrParam(const ASTContext &C, SourceLocation StartLoc, + SourceLocation EndLoc, unsigned CollapsedNum, + ArrayRef Clauses, Stmt *AssociatedStmt, + const HelperExprs &Exprs) + : C(&C), StartLoc(StartLoc), EndLoc(EndLoc), CollapsedNum(CollapsedNum), + Clauses(Clauses), AssociatedStmt(AssociatedStmt), Exprs(Exprs) {} + }; + + void LoopParamInit(const ASTContext &C, SourceLocation StartLoc, + SourceLocation EndLoc, unsigned CollapsedNum, + ArrayRef Clauses, Stmt *AssociatedStmt, + const HelperExprs &Exprs); + + struct LoopDirCrParam *LoopDirCrParmV; + /// Creates an empty directive with a place for \a NumClauses clauses. /// /// \param C AST context. Index: clang/lib/AST/StmtOpenMP.cpp =================================================================== --- clang/lib/AST/StmtOpenMP.cpp +++ clang/lib/AST/StmtOpenMP.cpp @@ -2340,6 +2340,10 @@ Dir->setDependentInits(Exprs.DependentInits); Dir->setFinalsConditions(Exprs.FinalsConditions); Dir->setPreInits(Exprs.PreInits); + + Dir->LoopParamInit(C, StartLoc, EndLoc, CollapsedNum, Clauses, AssociatedStmt, + Exprs); + return Dir; } @@ -2351,6 +2355,14 @@ numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum); } +void OMPGenericLoopDirective::LoopParamInit( + const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + unsigned CollapsedNum, ArrayRef Clauses, Stmt *AssociatedStmt, + const HelperExprs &Exprs) { + this->LoopDirCrParmV = new LoopDirCrParam(C, StartLoc, EndLoc, CollapsedNum, + Clauses, AssociatedStmt, Exprs); +} + OMPTeamsGenericLoopDirective *OMPTeamsGenericLoopDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef Clauses, Stmt *AssociatedStmt, Index: clang/lib/CodeGen/CGStmtOpenMP.cpp =================================================================== --- clang/lib/CodeGen/CGStmtOpenMP.cpp +++ clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -7785,6 +7785,49 @@ CGF.EmitStmt(CS); } }; + /* Bind */ + for (const auto *C : S.getClausesOfKind()) { + OpenMPBindClauseKind bindParam = C->getBindKind(); + switch (bindParam) { + case OMPC_BIND_parallel: { + OMPForDirective *ompForD = OMPForDirective::Create( + *(S.LoopDirCrParmV->C), S.LoopDirCrParmV->StartLoc, + S.LoopDirCrParmV->EndLoc, S.LoopDirCrParmV->CollapsedNum, + S.LoopDirCrParmV->Clauses, S.LoopDirCrParmV->AssociatedStmt, + S.LoopDirCrParmV->Exprs, NULL, 0); + EmitOMPForDirective(*ompForD); + return; + break; + } + case OMPC_BIND_teams: { + OMPDistributeDirective *ompDistD = OMPDistributeDirective::Create( + *(S.LoopDirCrParmV->C), S.LoopDirCrParmV->StartLoc, + S.LoopDirCrParmV->EndLoc, S.LoopDirCrParmV->CollapsedNum, + S.LoopDirCrParmV->Clauses, S.LoopDirCrParmV->AssociatedStmt, + S.LoopDirCrParmV->Exprs); + EmitOMPDistributeDirective(*ompDistD); + return; + break; + } + case OMPC_BIND_thread: { + /* + OMPSimdDirective *ompSimdD = OMPSimdDirective::Create( + *(S.LoopDirCrParmV->C), + S.LoopDirCrParmV->StartLoc, + S.LoopDirCrParmV->EndLoc, + S.LoopDirCrParmV->CollapsedNum, + S.LoopDirCrParmV->Clauses, + S.LoopDirCrParmV->AssociatedStmt, + S.LoopDirCrParmV->Exprs); + EmitOMPSimdDirective(*ompSimdD); + return; + */ + break; + } + case OMPC_BIND_unknown: + return; + } + } OMPLexicalScope Scope(*this, S, OMPD_unknown); CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_loop, CodeGen); }