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