• Aucun résultat trouvé

T IEKJGR IEKJAN (lEKKNO)*

PHASE 10 INTERMEDIATE TEXT

Phase 10 creates intermediate text (in operator-operand pair format) for use as input to subsequent phases of the compiler.

There are six types of intermediate text produced by phase 10:

• Normal text -- the operator-operand pair representations of source state-ments other than DATA, NAMELIST, DEFINE FILE, FORMAT, and statement Functions

(SF).

• Data text -- the operator - operand pair representations of DATA statements and the initialization constants in explicit type statements.

• Namelist text -- the operator-operand pair representations of NAMELIST statements.

• Define file text -- the operator-operand pair representation of DEFINE FILE statements.

• Format text -- the internal representa-tions of FORMAT statements.

• SF skeleton text -- the operator-operand pair representations of state-ment functions using sequence numbers as operands of the intermediate text entries. The sequence numbers replace the dummy arguments of the statement functions. This type of text is, in effect, a "skeleton" macro.

Note: Intermediate text representations

~ for subblock allocation, divided into only two main types: special (DATA, NAME-LIST_ DEFINE FILE, FORMAT, and SF skeleton text), and normal (text other than special

text). The intermediate text representa-tions are comprised of individual text entries. Each intermediate main text type is allocated unique subblocks of main storage. The subblocks that constitute an intermediate text area are obtained by phase 10, as needed, via requests to the FSD (see "Storage Distribution" under "FOR-TRAN System Director").

Intermediate Text Chains

Each intermediate text area (i.e., the subblocks allocated to a particular type of text) is arranged as a chain that links together (1) the text entries that are developed and placed into that area, and

(2) in some cases, the intermediate text representation for individual statements.

The g2f~!_!~!_£hain is a linear chain of normal text entries~ that is, each normal text entry is pointed to by the pre-viously developed normal text entry.

The data text chain in bi-linear. This means

that:---1. The text entries that constitute the intermediate text representation of a DATA statement are linked by means of pointers. Each text entry for the statement is pointed to by the pre-viously developed text entry for the statement.

2. The intermediate text representations of individual DATA statements are linked by means of pointers, each representation being pointed to by the previously developed representation.

(A special chain address field within the first text entry developed for each DATA statement is reserved for this purpose.)

The name l i s t text chain operates in the same manner-aS-the-data-text chain.

The define file text chain is a linear chain of define file text entries, each define file text entry is pointed to by a previously developed define file text

entry. A zero chain signals the end of all define file text for a program~

The format text chain consists of link-ages between-the-individual intermediate text representations of FORMAT statements.

The pointer field of the second text~ entry in the intermediate representation of a FORMAT statement points to the intermediate text representation of the next FORMAT statement. (The individual text entries that make up the intermediate text repre-sentation of

a

FORMAT statement are not chained. )

The SF skeleton text chain is linear only in that each text entry developed for an operator-operand pair within

a

particu-lar statement function is pointed to by the previous text entry developed for that same statement function. The intermediat.e text representations for separate statement functions are not chained together. Howev-er, a skeletori can readily be obtained by means of the pointer contained in the dic-tionary entry for the name of the statement function.

Those statements that undergo conversion from source representation to intermediate text representation are divided into

operator-operand pairs, or text entries.

Figure 43 illustrates the format of an intermediate text entry constructed by phase 10. L __________ L~ _____________________________ J

Figure 43. Intermediate Text Entry Format

~£i~£~!Y~_£2de_E!elg: The adjective code field corresponds to the operator of the operator-operand pair. Operators are not entered into text entries in source form; adjective codes (operators that define the nature of source statements) also have nu-meric values.

Chain Field: The chain field is used to maintain-linkage between intermediate text entries. It contains a pointer to the next source format packed into successive text entries.

Table 21. Adjective Codes (Part 1 of 3)

r---T---T---,

I

I Mnemonic I I

tCode (inl (where

I I

Idecimal) I applicable) I Meaning I

~---+---~---~

Table 27. Adjective Codes (Part 2 of 3)

L ________ ~ ___________ ~ ____________________ J

Table 27. Adjective Codes (Part 3 of 3)

r---T---T---,

~ I Mnemonic I

I

'Code (inl (where , ,

Idecimal) ,applicable)

I

Meaning

I

~---+---+---~

I

assignment statement

I I

242 NDOIF End of DO IIF'

Examples of Phase 10 Intermediate Te.xt An example of each type of phase 10 text (normal, data, namelist, define file for-mat, and SF skeleton> is presented below.

For each type, a source language statement is first given. This is followed by the phase 10 text representation of that statement.

The phase 10 normal text representation of the arithmetic-statement

100 A B + C

*

D / E

is illustrated in Figure 44.

r---T---r---T---T----T---,

I

Ad j ecti ve

I I I I I I

I

Code

I

Chain

I

Mode

I

Type

I

0

I

Pointer

I

~---+---+---+---+----+---~

I

Statement

I I 1 I 1 I

1 number 1 I Statement I 1 1 I

I

definition

I 1

number

I

0

I I

~ 100

I

c:r---~~i~~~~~i~----t---t---~~~l---t---;~~1~~~-t----t~-~---1 c:r---:---t---t---~~~l---t---;~~1~~~-t----t~-~---1 L:t---:---t---t---;~~l---t---;~~1~~~-t----t~-~---1

~~---+---+---+---+----+---~

~

* I I

Real

1

Scalar1l

I 1---

D

I

L:t---~---t---t---;~~l---t---;~~1~~~-t----t~-;---1 L:t---t-;~-~~~~-~~~~~l--t---t---t----t---1

1 End mark 2 1 text entry 1 0 1 0 I I ISN3 I

~---±---±---+---+----+---~

~ 1 I I I I 1 I I

I 1 byte 1 3 bytes I 2 bytes 1 2 bytes Ibytel 3 bytes I

~---i---i---i

___________ i ____

L ________________ ~

I 1 Nonsubscripted variable. 1

I 20perator of the special text entry that signals the end of the text representation I

I of a source statement. I

I

3Compiler generated sequence nuruber used to identify each source statement.

I

L ___________ ~ ___________________________________________________________________________ J

Figure 44. Phase 10 Normal Text

Appendix B: Intermediate Text 145

The phase 10 data text representation of the DATA

statement---DATA A,B/2.1,3HABC/,C,D/1.,1./

is illustrated in Figure 45.

r---T---T---T---T----T---,

I

Adjective

I I I I I I

I

Code

I

Chain

I

Mode

I

Type

I

0

I

Pointer

I

~---+---+---+---+----+---~-~

I I I ' I I

To text for ,

, , I I ' , - ..

next DATA

h

I

DATA

I I

0

I

ISN ,

I

statement

I

I

~---+---+---+---+----+---~ I

c:F=----~---t---t---;~~~---t---~~~~~~--t----t~~---1 +

~·---~---t---t---~~~l---t---~~~~~~~~t----t==::;~1---1

~---~--- ---- t---t---~i~~~~l----t---~~~~~~~~t----t==::3~~;~---1

~.---~--- ---- t---t---~~~l---t---~~~l~~--t----t~-;~---1

~---~---t---t---~~~l---t---~~~1~~--t----t~~~---1

~---~---t---t---~~~l---t---~~~~~~~~t----t==::1~---1

~', t ---o---t---~~~l---t---~~~~~~~~t----t~l~---1

~--.---+---+---+---+----+---~

I I , , , 1 I ,

I

L __ . _______________ 1 byte ~

I

_________________ 3 bytes ~ , _________________ 2 bytes ~

I

___________ 2 bytes ,byte, ~ ____ ~ ________________ 3 bytes J , Figure 45. Phase 10 Data Text

The phase 10 namelist text representa-tion of the NAMELIST statement

N~-MELIST /NAME1/A,H,C/NAME2/D,E,F/NAME3/G where A and F are arr~ys is illustrated in Figure 46.

r---T---T---T---T----T---,

1 Adjective 1 1 1 1 1 1

1 Code 1 Chain 1 Mode 1 Type 1 0 1 Pointer 1

r---f---+---+---f----+---~

1 NAMELIST 1 1 NAf.'JELIST 1 0

1 1---

NAME 1 1

~t---+---+---+---+----+---~

L.,f / 1 1 0 1 0

l i T O

text for 1

1 1 1 1 1 1----. next NAMELIST

h

1 1 1 1 1 1 block 1

L:t---~~;;---t---t---~~~l---t---~~~~~---t----t==::~---1 I

q

LIS1'

t t---~~~1---t---;~~i~~--t----t==::~---1

L:t-

LIST

t---o---t---;~~l---t---;~~l~~--t----t==::~---1

c:t - t t---t---t----t---~ I L:t---;~~:~~~:---t---t----~~~:~~~:---t---~---t----t~~~~~~~-f;~----iJ

1 1 1 1

1 1----..

next NAMELIST 1

1 1 1 1 1 1 block

L:t---~~;;---t---t---~~~l---t---;~:1~~--t----t==::~---1

c:t---~~~~,---t---t---~~~l---t---~~~1~~--t----t=:;;---1

~~---+---+---+---+----+---~

I-.j LIST 1 0 1 Real 1 Array

1 1---

F 1

q

NAlvlbLIST

t t--·--~~~~~~~;---t---o---t----t~~~~;3---1

~~---f---+--.---

__ + ___________

+----+---~

Lt.i / 1 1 0 1 0 1 1 '10 text for

1 1 1 1 1 I---next NAMELIST 1

1 1 1 1 1 1 statement

h

Q---~~~~,---t---o---t---~~~l---t---~~~1~~--t----t==::~---1 :

t---t---t---~~t---t-~--t---1 ~ 1 L _________________ 1 byte ~ 1 ______________ 3 bytes ~ 1 _________________ 2 bytes ~ 1 ___________ 2 bytes Ibytel ~ ____ ~ ___________________ 3 bytes J 1 Figure 46. Phase 10 Namelist Text

Appendix B: Intermediate Text 147

The phase 10 define file text represen-tation of the DEFINE FILE statement

where a1 is the input/output unit number, m1 is the number of records, r1 is the maximum record length, f1 is the format code, and V1 is the associated variable, is illustrated in Figure 47.

r---T---T---T---T----T---,

I

Adjective

I I I I I I

I

Code

I

Chain

I

~ode

I

Type

I

0

I

Pointer

I

~---+---+---+---+----+---~

I

I/O unit number

I I

Integer

I

Constant

I I ...

a1

I

r-F==---f---+---+---+----+---~

L+j ,

I I

Integer

I

Constant

I I ...

m1

I

~---+---+---+---+----+---~

L-i , I I

Integer

I

Constant

I I ...

r 1

I

q==Eormdt code (f1)

t

pointer to next

t----~~~~~~~---t--~~~l~~---t----t---~--~~---1

I I

define file text

I I I I I

I I

entry

I I I I I

~---f---+---+---+----+---~

I I I I I

1

I I

I

l _________________ 1 byte ~

I

_________________ 3 bytes ~

I

_________________ 2 bytes ~

I

___________ 2 bytes ~

I

byte ____ ~

I

________________ 3 bytes J

I

Figure 47. Phase 10 Define File Text The phase 10 format text representation of the FORMAT statement

5 FORMAT (2HOA,A6//5X,3 (14, E12. 5, 3F12. 3,' ABC' » is illustrated in Figure 48.

r---T---T---T---T----T---,

I

Pointer

I I I I I I

I

Code

I

Chain

I

Mode

I

TYfe

I

0

I

Pointer

I

~---+---+---+---+----+---~

I

Statement

I I I I I I

I

number

I I

Statement

I I I I

I

definition

I I

number

I

0

I I

5

I

c::---t---t---t---t----t-;~-~~;~-f~~----1

I I I I I I

next FORMAT

n

I

FORMAT

I I

0

I

0

I I

st,atement

I

---f---+---+---+----+---~ I

I I I I I

1

I I I

I

1 byte

I

3 bytes

I

2 bytes

I

2 bytes

I

byte

I

3 bytes

I t

~---+---+---+---+----+---~

I I I I I . I I

I I I I I • I I

I I I I I . I I

~---+---+---+---+----+---~

(2HO 2

I

A,A6 2

I

//5X 2 1 , 3 (I 2

I I

4,E1 2

I

~--.---+---+---+---+----+---~

I

2.5, 2

I

3F122

I

. 3 , ' 2

I

ABC' 2

I I

) ) t1

I

~---~---~---~---~---~----~---~

11Group mark. I

120ne character per byte. I

l ___________________________________ ~ ____________________________________________________ J

Figure 48. Phase 10 Format Text

The phase 10 SF skeleton text represen-tation of the statement function

ASF (A,B,C)

=

A+D*B*E/C is illustrated in Figure 49.

r---T---T---T---T----T---,

I

Adjective

I I I I I I

I

Code

I

Chain , Mode

I

Type

I

0

I

Pointer

I

~---+---+---+---f----+---~

I ( I , 0 I 0 , , 1 I

Q

+

t ---'--t---~~~l---t---~~~l~~--t----t=::~---1

~r---+---+---+---+----f---~

L+j

* I I

0 , 0

I '

2

I

Q---:---1---'--t---~~~1---t---~~~1~~--t----t==::;---1

~r

+

---+---f---f----+---~

4i / '

, 0

I

0

I '

3

I

~r

+

---+---+---+----+---~

~ , , 0

I

0

I I I

~~r---E-·'n-d--~-a-~-~---~t---o---t---o---t---o---t----t----o---1

~---f---+---+---+----+---~

, , I I I

1 ,

I

I 1 byte I 3 bytes , 2 bytes I 2 bytes ,by tel 3 bytes I

L _________________ ~ _________________ ~ _________________ ~ ___________ ~ ____ ~ ________________ J

Figure 49. Phase 10 SF Skeleton Text

PHASE 15/PHASE 20 INTERMEDIATE TEXT MODIFICATIONS

During phase 15 and phase 20 text processing, the intermediate text entries are modified to a format more suitable for optimization and object-code generation.

The intermediate text modifications made by each phase are discussed separately in the following paragraphs.

PHASE 15 INTERMEDIATE TEXT MODIFICATIONS

Documents relatifs