@@ -889,23 +889,24 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
889
889
890
890
// / Calls the specified callback function for all the loops in \p CurStmt,
891
891
// / from the outermost to the innermost.
892
- static bool
893
- doForAllLoops (Stmt *CurStmt, bool TryImperfectlyNestedLoops,
894
- unsigned NumLoops,
895
- llvm::function_ref<bool (unsigned , Stmt *)> Callback,
896
- llvm::function_ref<void(OMPLoopTransformationDirective *)>
897
- OnTransformationCallback);
892
+ static bool doForAllLoops (
893
+ Stmt *CurStmt, bool TryImperfectlyNestedLoops, unsigned NumLoops,
894
+ llvm::function_ref<bool (unsigned , Stmt *)> Callback,
895
+ llvm::function_ref<void(OMPCanonicalLoopNestTransformationDirective *)>
896
+ OnTransformationCallback);
898
897
static bool
899
898
doForAllLoops (const Stmt *CurStmt, bool TryImperfectlyNestedLoops,
900
899
unsigned NumLoops,
901
900
llvm::function_ref<bool (unsigned , const Stmt *)> Callback,
902
- llvm::function_ref<void(const OMPLoopTransformationDirective *)>
901
+ llvm::function_ref<
902
+ void(const OMPCanonicalLoopNestTransformationDirective *)>
903
903
OnTransformationCallback) {
904
904
auto &&NewCallback = [Callback](unsigned Cnt, Stmt *CurStmt) {
905
905
return Callback (Cnt, CurStmt);
906
906
};
907
907
auto &&NewTransformCb =
908
- [OnTransformationCallback](OMPLoopTransformationDirective *A) {
908
+ [OnTransformationCallback](
909
+ OMPCanonicalLoopNestTransformationDirective *A) {
909
910
OnTransformationCallback (A);
910
911
};
911
912
return doForAllLoops (const_cast <Stmt *>(CurStmt), TryImperfectlyNestedLoops,
@@ -918,7 +919,7 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
918
919
doForAllLoops (Stmt *CurStmt, bool TryImperfectlyNestedLoops,
919
920
unsigned NumLoops,
920
921
llvm::function_ref<bool (unsigned , Stmt *)> Callback) {
921
- auto &&TransformCb = [](OMPLoopTransformationDirective *) {};
922
+ auto &&TransformCb = [](OMPCanonicalLoopNestTransformationDirective *) {};
922
923
return doForAllLoops (CurStmt, TryImperfectlyNestedLoops, NumLoops, Callback,
923
924
TransformCb);
924
925
}
@@ -955,19 +956,18 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
955
956
}
956
957
};
957
958
958
- // / The base class for all loop transformation directives.
959
- class OMPLoopTransformationDirective : public OMPLoopBasedDirective {
959
+ // / The base class for all transformation directives of canonical loop nests.
960
+ class OMPCanonicalLoopNestTransformationDirective
961
+ : public OMPLoopBasedDirective {
960
962
friend class ASTStmtReader ;
961
963
962
964
// / Number of loops generated by this loop transformation.
963
965
unsigned NumGeneratedLoops = 0 ;
964
966
965
967
protected:
966
- explicit OMPLoopTransformationDirective (StmtClass SC,
967
- OpenMPDirectiveKind Kind,
968
- SourceLocation StartLoc,
969
- SourceLocation EndLoc,
970
- unsigned NumAssociatedLoops)
968
+ explicit OMPCanonicalLoopNestTransformationDirective (
969
+ StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc,
970
+ SourceLocation EndLoc, unsigned NumAssociatedLoops)
971
971
: OMPLoopBasedDirective(SC, Kind, StartLoc, EndLoc, NumAssociatedLoops) {}
972
972
973
973
// / Set the number of loops generated by this loop transformation.
@@ -5545,7 +5545,8 @@ class OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective {
5545
5545
};
5546
5546
5547
5547
// / This represents the '#pragma omp tile' loop transformation directive.
5548
- class OMPTileDirective final : public OMPLoopTransformationDirective {
5548
+ class OMPTileDirective final
5549
+ : public OMPCanonicalLoopNestTransformationDirective {
5549
5550
friend class ASTStmtReader ;
5550
5551
friend class OMPExecutableDirective ;
5551
5552
@@ -5557,9 +5558,9 @@ class OMPTileDirective final : public OMPLoopTransformationDirective {
5557
5558
5558
5559
explicit OMPTileDirective (SourceLocation StartLoc, SourceLocation EndLoc,
5559
5560
unsigned NumLoops)
5560
- : OMPLoopTransformationDirective(OMPTileDirectiveClass,
5561
- llvm::omp::OMPD_tile, StartLoc, EndLoc,
5562
- NumLoops) {
5561
+ : OMPCanonicalLoopNestTransformationDirective(
5562
+ OMPTileDirectiveClass, llvm::omp::OMPD_tile, StartLoc, EndLoc,
5563
+ NumLoops) {
5563
5564
setNumGeneratedLoops (2 * NumLoops);
5564
5565
}
5565
5566
@@ -5622,7 +5623,8 @@ class OMPTileDirective final : public OMPLoopTransformationDirective {
5622
5623
};
5623
5624
5624
5625
// / This represents the '#pragma omp stripe' loop transformation directive.
5625
- class OMPStripeDirective final : public OMPLoopTransformationDirective {
5626
+ class OMPStripeDirective final
5627
+ : public OMPCanonicalLoopNestTransformationDirective {
5626
5628
friend class ASTStmtReader ;
5627
5629
friend class OMPExecutableDirective ;
5628
5630
@@ -5634,9 +5636,9 @@ class OMPStripeDirective final : public OMPLoopTransformationDirective {
5634
5636
5635
5637
explicit OMPStripeDirective (SourceLocation StartLoc, SourceLocation EndLoc,
5636
5638
unsigned NumLoops)
5637
- : OMPLoopTransformationDirective(OMPStripeDirectiveClass,
5638
- llvm::omp::OMPD_stripe, StartLoc, EndLoc,
5639
- NumLoops) {
5639
+ : OMPCanonicalLoopNestTransformationDirective(
5640
+ OMPStripeDirectiveClass, llvm::omp::OMPD_stripe, StartLoc, EndLoc,
5641
+ NumLoops) {
5640
5642
setNumGeneratedLoops (2 * NumLoops);
5641
5643
}
5642
5644
@@ -5702,7 +5704,8 @@ class OMPStripeDirective final : public OMPLoopTransformationDirective {
5702
5704
// / #pragma omp unroll
5703
5705
// / for (int i = 0; i < 64; ++i)
5704
5706
// / \endcode
5705
- class OMPUnrollDirective final : public OMPLoopTransformationDirective {
5707
+ class OMPUnrollDirective final
5708
+ : public OMPCanonicalLoopNestTransformationDirective {
5706
5709
friend class ASTStmtReader ;
5707
5710
friend class OMPExecutableDirective ;
5708
5711
@@ -5713,9 +5716,9 @@ class OMPUnrollDirective final : public OMPLoopTransformationDirective {
5713
5716
};
5714
5717
5715
5718
explicit OMPUnrollDirective (SourceLocation StartLoc, SourceLocation EndLoc)
5716
- : OMPLoopTransformationDirective (OMPUnrollDirectiveClass,
5717
- llvm::omp::OMPD_unroll, StartLoc, EndLoc ,
5718
- 1 ) {}
5719
+ : OMPCanonicalLoopNestTransformationDirective (OMPUnrollDirectiveClass,
5720
+ llvm::omp::OMPD_unroll,
5721
+ StartLoc, EndLoc, 1 ) {}
5719
5722
5720
5723
// / Set the pre-init statements.
5721
5724
void setPreInits (Stmt *PreInits) {
@@ -5776,7 +5779,8 @@ class OMPUnrollDirective final : public OMPLoopTransformationDirective {
5776
5779
// / for (int i = 0; i < n; ++i)
5777
5780
// / ...
5778
5781
// / \endcode
5779
- class OMPReverseDirective final : public OMPLoopTransformationDirective {
5782
+ class OMPReverseDirective final
5783
+ : public OMPCanonicalLoopNestTransformationDirective {
5780
5784
friend class ASTStmtReader ;
5781
5785
friend class OMPExecutableDirective ;
5782
5786
@@ -5788,9 +5792,9 @@ class OMPReverseDirective final : public OMPLoopTransformationDirective {
5788
5792
5789
5793
explicit OMPReverseDirective (SourceLocation StartLoc, SourceLocation EndLoc,
5790
5794
unsigned NumLoops)
5791
- : OMPLoopTransformationDirective(OMPReverseDirectiveClass,
5792
- llvm::omp::OMPD_reverse, StartLoc,
5793
- EndLoc, NumLoops) {
5795
+ : OMPCanonicalLoopNestTransformationDirective(
5796
+ OMPReverseDirectiveClass, llvm::omp::OMPD_reverse, StartLoc, EndLoc ,
5797
+ NumLoops) {
5794
5798
setNumGeneratedLoops (NumLoops);
5795
5799
}
5796
5800
@@ -5848,7 +5852,8 @@ class OMPReverseDirective final : public OMPLoopTransformationDirective {
5848
5852
// / for (int j = 0; j < n; ++j)
5849
5853
// / ..
5850
5854
// / \endcode
5851
- class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
5855
+ class OMPInterchangeDirective final
5856
+ : public OMPCanonicalLoopNestTransformationDirective {
5852
5857
friend class ASTStmtReader ;
5853
5858
friend class OMPExecutableDirective ;
5854
5859
@@ -5860,9 +5865,9 @@ class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
5860
5865
5861
5866
explicit OMPInterchangeDirective (SourceLocation StartLoc,
5862
5867
SourceLocation EndLoc, unsigned NumLoops)
5863
- : OMPLoopTransformationDirective(OMPInterchangeDirectiveClass,
5864
- llvm::omp::OMPD_interchange, StartLoc,
5865
- EndLoc, NumLoops) {
5868
+ : OMPCanonicalLoopNestTransformationDirective(
5869
+ OMPInterchangeDirectiveClass, llvm::omp::OMPD_interchange, StartLoc,
5870
+ EndLoc, NumLoops) {
5866
5871
setNumGeneratedLoops (NumLoops);
5867
5872
}
5868
5873
0 commit comments