@@ -994,7 +994,9 @@ class OMPLoopTransformationDirective : public OMPLoopBasedDirective {
994994 static bool classof (const Stmt *T) {
995995 Stmt::StmtClass C = T->getStmtClass ();
996996 return C == OMPTileDirectiveClass || C == OMPUnrollDirectiveClass ||
997- C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass;
997+ C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass ||
998+ C == OMPStripeDirectiveClass;
999+ ;
9981000 }
9991001};
10001002
@@ -5560,7 +5562,7 @@ class OMPTileDirective final : public OMPLoopTransformationDirective {
55605562 : OMPLoopTransformationDirective(OMPTileDirectiveClass,
55615563 llvm::omp::OMPD_tile, StartLoc, EndLoc,
55625564 NumLoops) {
5563- setNumGeneratedLoops (3 * NumLoops);
5565+ setNumGeneratedLoops (2 * NumLoops);
55645566 }
55655567
55665568 void setPreInits (Stmt *PreInits) {
@@ -5621,6 +5623,82 @@ class OMPTileDirective final : public OMPLoopTransformationDirective {
56215623 }
56225624};
56235625
5626+ // / This represents the '#pragma omp stripe' loop transformation directive.
5627+ class OMPStripeDirective final : public OMPLoopTransformationDirective {
5628+ friend class ASTStmtReader ;
5629+ friend class OMPExecutableDirective ;
5630+
5631+ // / Default list of offsets.
5632+ enum {
5633+ PreInitsOffset = 0 ,
5634+ TransformedStmtOffset,
5635+ };
5636+
5637+ explicit OMPStripeDirective (SourceLocation StartLoc, SourceLocation EndLoc,
5638+ unsigned NumLoops)
5639+ : OMPLoopTransformationDirective(OMPStripeDirectiveClass,
5640+ llvm::omp::OMPD_stripe, StartLoc, EndLoc,
5641+ NumLoops) {
5642+ setNumGeneratedLoops (2 * NumLoops);
5643+ }
5644+
5645+ void setPreInits (Stmt *PreInits) {
5646+ Data->getChildren ()[PreInitsOffset] = PreInits;
5647+ }
5648+
5649+ void setTransformedStmt (Stmt *S) {
5650+ Data->getChildren ()[TransformedStmtOffset] = S;
5651+ }
5652+
5653+ public:
5654+ // / Create a new AST node representation for '#pragma omp stripe'.
5655+ // /
5656+ // / \param C Context of the AST.
5657+ // / \param StartLoc Location of the introducer (e.g. the 'omp' token).
5658+ // / \param EndLoc Location of the directive's end (e.g. the tok::eod).
5659+ // / \param Clauses The directive's clauses.
5660+ // / \param NumLoops Number of associated loops (number of items in the
5661+ // / 'sizes' clause).
5662+ // / \param AssociatedStmt The outermost associated loop.
5663+ // / \param TransformedStmt The loop nest after striping, or nullptr in
5664+ // / dependent contexts.
5665+ // / \param PreInits Helper preinits statements for the loop nest.
5666+ static OMPStripeDirective *
5667+ Create (const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5668+ ArrayRef<OMPClause *> Clauses, unsigned NumLoops, Stmt *AssociatedStmt,
5669+ Stmt *TransformedStmt, Stmt *PreInits);
5670+
5671+ // / Build an empty '#pragma omp stripe' AST node for deserialization.
5672+ // /
5673+ // / \param C Context of the AST.
5674+ // / \param NumClauses Number of clauses to allocate.
5675+ // / \param NumLoops Number of associated loops to allocate.
5676+ static OMPStripeDirective *
5677+ CreateEmpty (const ASTContext &C, unsigned NumClauses, unsigned NumLoops);
5678+
5679+ // / Gets/sets the associated loops after striping.
5680+ // /
5681+ // / This is in de-sugared format stored as a CompoundStmt.
5682+ // /
5683+ // / \code
5684+ // / for (...)
5685+ // / ...
5686+ // / \endcode
5687+ // /
5688+ // / Note that if the generated loops a become associated loops of another
5689+ // / directive, they may need to be hoisted before them.
5690+ Stmt *getTransformedStmt () const {
5691+ return Data->getChildren ()[TransformedStmtOffset];
5692+ }
5693+
5694+ // / Return preinits statement.
5695+ Stmt *getPreInits () const { return Data->getChildren ()[PreInitsOffset]; }
5696+
5697+ static bool classof (const Stmt *T) {
5698+ return T->getStmtClass () == OMPStripeDirectiveClass;
5699+ }
5700+ };
5701+
56245702// / This represents the '#pragma omp unroll' loop transformation directive.
56255703// /
56265704// / \code
0 commit comments