Browse Prior Art Database

Translation of Proposed ANS FORTRAN DO Loops

IP.com Disclosure Number: IPCOM000078698D
Original Publication Date: 1973-Feb-01
Included in the Prior Art Database: 2005-Feb-26
Document File: 4 page(s) / 49K

Publishing Venue

IBM

Related People

Gilbert, KM: AUTHOR

Abstract

Described is the following: 1) An efficient means of semantically interpreting the proposed ANS FORTRAN DO-loop extensions; and 2) An efficient set of machine instructions to be generated by any FORTRAN compiler. For the following DO-loop 5 DO 10 v = m1, m2, m3 10 S... The proposed extensions are: 1. backward loops - m3 < 0: 2. the loop is not executed if a. m3 > 0 and m1 > m2 b. m3 < 0 and m1 < m2; 3. the control variable v may be real or double precision 4. the parameters m1, m2 and m3 may be any arithmetic expression;, 5. the parameters may be changed within the loop without affecting the loops execution; 6. the target statement S may be any fall through statement; 7. transfer may be made into any active range of a DO-loop; and 8. optional comma before the control variable (syntactic only).

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 50% of the total text.

Page 1 of 4

Translation of Proposed ANS FORTRAN DO Loops

Described is the following:
1) An efficient means of semantically interpreting the

proposed ANS FORTRAN DO-loop extensions; and
2) An efficient set of machine instructions to be generated

by any FORTRAN compiler.

For the following DO-loop

5 DO 10 v = m1, m2, m3

10 S...

The proposed extensions are:
1. backward loops - m3 < 0:
2. the loop is not executed if
a. m3 > 0 and m1 > m2
b. m3 < 0 and m1 < m2;
3. the control variable v may be real or double precision
4. the parameters m1, m2 and m3 may be any arithmetic expression;,
5. the parameters may be changed within the loop without affecting the loops execution;
6. the target statement S may be any fall through statement;
7. transfer may be made into any active range of a DO-loop; and
8. optional comma before the control variable (syntactic only).

Any DO-loop may be classified into one of these three (3) categories: 1. m3 is a positive constant; 2. m3 is a negative constant; and 3. m3 is any valid expression (including a single variable).

Each case will, in turn, be described semantically by a flow diagram. Also a set of pseudomachine instructions will be given for each case.

Each of the text items (pseudomachine instructions) used are in the form of an operation followed by one or more operands; moreover, each text item is uniquely identified by a number, so that its result may be used by a subsequent text item. For example, the following FORTRAN statement 15 I = J + K would be represented by the intermediate language as Text Item # Operation Operands 1) Label 15 definition of label 15 2) + J K add J and K store the 3) = 2) I result of text item 2) into I Case 1 (2) - m3 is a positive (negative) constant The program text for case 1 and 2: (Note: case 2 transfer conditions are in parenthesis, case 1 conditions are not) program text description 1) LABEL 5 define user label 5 2) = m1 v store value of m1 into v 3) = m2 tf store value of m2 into temporary tf 4) c v tf compare value of v to value of tf 5) B 4) alpha branch to generated label alpha if text item (4) set a > (<) condition 6) LABEL beta define generated label beta. 7) <body of DO > ... 8) LABEL 10 define user label 10 9) <target S> 10) + v m3 add v and m3 11) = 10) v store result of text item 10) into v 12) C v tf Compare value of v to value of tf 13) B(>) 12) beta branch to generated label beta if test item 12) set a <= (>=) condition 14) LABEL alpha define generated label alpha.

1

Page 2 of 4

The control flow (Fig. 1b) for case 1 and 2 has one test before the loop is entered and then one at the bottom of the loop. By duplicating the test at the bottom and not just tracking back to the test at the beginning, as in Fig. 2, the control flow graph is then simplified in terms of the amount of optimization that may be performed.

Optimizing the loop incrementation and tracking is precluded by the structure in Fig. 2, whereas (register availability permitting) the structure of Fig. 1b is ...