Skip to content

Commit 5a7876e

Browse files
committed
[TSAR, Tfm, Loop, Reversal] Implement loop reversal transformation.
Merged in loop-reverse (pull request)
2 parents 5b87371 + 8e03fe0 commit 5a7876e

File tree

6 files changed

+710
-1
lines changed

6 files changed

+710
-1
lines changed

include/tsar/Support/DiagnosticKinds.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,18 @@ def warn_interchange_not_for_loop: Warning<"unable to interchange not for-loop">
195195
def warn_interchange_dependency: Warning<"unable to interchange loop with data dependencies (use the 'nostrict' clause to force transformation)">;
196196
def warn_interchange_no_analysis: Warning<"absence of analysis results prevents loop interchange (use the 'nostrict' clause to force transformation">;
197197

198+
def warn_reverse_not_for_loop: Warning<"unable to reverse not for-loop">;
199+
def warn_disable_loop_reversal: Warning<"disable loop reversal">;
200+
def warn_reverse_induction_mismatch: Warning<"unable to find a reversible loop with the '%0' induction variable">;
201+
def warn_reverse_number_mismatch: Warning<"unable to find %0 reversible loop in the nest">;
202+
def warn_reverse_not_canonical: Warning<"unable to reverse loop being not in a canonical loop form">;
203+
def warn_reverse_multiple_exits: Warning<"unable to reverse loop having multiple exits (use the 'nostrict' clause to force transformation)">;
204+
def warn_reverse_unsafe_cfg: Warning<"unable to reverse loop with unsafe control flow (use the 'nostrict' clause to force transformation)">;
205+
def warn_reverse_no_analysis: Warning<"absence of analysis results prevents loop reversal (use the 'nostrict' clause to force transformation">;
206+
def warn_reverse_dependency: Warning<"unable to reverse loop with data dependencies (use the 'nostrict' clause to force transformation)">;
207+
def warn_reverse_increment_complex: Warning<"complex increment expression prevents loop reversal">;
208+
def warn_reverse_condition_complex: Warning<"complex conditional expression prevents loop reversal">;
209+
def warn_reverse_initialization_complex: Warning<"complex initialization expression prevents loop reversal">;
210+
198211
// Fortran-specific diagnostics.
199212
def warn_fortran_no_execution_part: Warning<"unable to locate execution-part statmenets">;

include/tsar/Support/Directives.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def Replace : Clause<"replace", Transform,
140140

141141
def With : Clause<"with", Transform, [LParen, Identifier, RParen]>;
142142

143+
def LoopReverse: Clause<"reverse", Transform,
144+
[LParen, OneOf<[PPIdentifier,NumericConstant]>, RParen]>;
145+
143146
def Private : Clause<"private", Analysis,
144147
[LParen, Identifier, ZeroOrMore<[Comma, Identifier]>, RParen]>;
145148

include/tsar/Transform/Clang/Passes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,11 @@ FunctionPass * createClangLoopInterchange();
8787

8888
/// Initialize a pass to intergchange loops in a loop nest.
8989
void initializeClangLoopInterchangePass(PassRegistry &Registry);
90+
91+
/// Initialize a pass to reverse loop.
92+
void initializeClangLoopReversePass(PassRegistry &Registry);
93+
94+
/// Create a pass to reverse loop.
95+
ModulePass *createClangLoopReverse();
9096
}
9197
#endif//TSAR_CLANG_TRANSFORM_PASSES_H

lib/Transform/Clang/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(TRANSFORM_SOURCES Passes.cpp ExprPropagation.cpp Inline.cpp RenameLocal.cpp
22
DeadDeclsElimination.cpp Format.cpp OpenMPAutoPar.cpp
33
SharedMemoryAutoPar.cpp DVMHSMAutoPar.cpp StructureReplacement.cpp
4-
LoopInterchange.cpp)
4+
LoopInterchange.cpp LoopReversal.cpp)
55

66
if(MSVC_IDE)
77
file(GLOB_RECURSE TRANSFORM_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}

0 commit comments

Comments
 (0)