     Next: Loop fusion Up: Simple functions Previous: The loop unrolling and

## Loop distribution

The loop distribution transformation cuts the body of a do-loop statement in two parts. The first statement of the second part specifies the cut position. For example, the following describes a loop distribution according to the statement I3: Example 62:

```  DO I=1,N,4
PRINT *,I
PRINT *,I+1
PRINT *,I+2
PRINT *,I+3
END DO
``` ```  DO I=1,N
PRINT *,I
PRINT *,I+1
END DO
DO I=1,N
PRINT *,I+2
PRINT *,I+3
END DO
``` Fits:Distribute:Check(LOOP,DIAGMESG,STAT)

This functions check if the loop distribution transformation can be applied to LOOP.
• LOOP (input AST) must be a do-loop statement.
• DIAGMESG (output STRING) is the diagnostic string
• STAT (input AST) must be a statement in the body of LOOP.
• The function returns an error code (return INT):
• 1 if all is correct
• 0 if LOOP is not a do-loop statement
• -1 if STAT is not a statement in the body of LOOP
• -2 if LOOP contains statements not handled by the transformation. Fits:Distribute:Advice(LOOP,DIAGMESG,STAT)

This function emits a diagnostic about the interest of the loop distribution transformation
• LOOP (input AST) must be a do-loop statement.
• DIAGMESG (output STRING) is a diagnostic string for the user
• STAT (input AST) must be a statement in a do-loop body.
• The function returns a diagnostic code (return INT) :
• 1 if the transformation is recommended
• 0 if the transformation may be interesting
• -1 if the transformation in not recommended Fits:Distribute:Safe(LOOP,DIAGMESG,STAT)

This function emits a diagnostic about the code produced by the loop distribution transformation
• LOOP (input AST) must be a do-loop statement.
• DIAGMESG (output STRING) is the diagnostic string
• STAT (input AST) must be a statement in a do-loop body.
• The function returns a diagnostic code (return INT) :
• 1 if the transformation is safe
• 0 if the transformation may be safe. More information are given by the text in DIAGMESG.
• -1 if the transformation is not safe Fits:Distribute:Apply(LOOP,VERBOSE,STAT)

This function applies the loop distribution transformation.
• LOOP (input AST) must be a do-loop statement.
• VERBOSE (input INT) is the comment level
• STAT (input AST) must be a statement in the body of LOOP
• The function returns the first do-loop statement created by the transformation (return AST).     Next: Loop fusion Up: Simple functions Previous: The loop unrolling and
Yann Mevel
1999-04-30