• Aucun résultat trouvé

IBM System/3S0 Operating System FORTRAN IV (G) Compiler

N/A
N/A
Protected

Academic year: 2022

Partager "IBM System/3S0 Operating System FORTRAN IV (G) Compiler "

Copied!
307
0
0

Texte intégral

(1)

File No. S360-25(OS) Order No. GY28-6638-1

IBM System/3S0 Operating System FORTRAN IV (G) Compiler

Program Logic Manual

Program Number 3S0S-FO-520

This publication describes the internal logic of the FORTRAN IV (G) compiler.

Program Logic Manuals are intended for use by IBM customer engineers involved in program maintenance, and by systems programmers involved in altering the program design. Program logic information is not necessary for program operation and use: therefore, distribution of this manual is limited to persons with program main- tenance or modification responsibilities.

The FORTRAN IV (G) compiler is a processing program of the IBM Systeml360 operating system. It translates one or more source modules written in the FORTRAN language into an object module that can be processed into an executable load module by the linkage editor.

Program Logic

(2)

order No. GY28-6638-1, page revised 1/15/71 by TNL GY28-6847

This publication provides customer engineers and other technical personnel with information describing the internal organization and operation of the FORTRAN IV (G) compiler. It is part of an inte~

grated library of IBU System/360 operating System Program Logic Manuals. Other publi- cations required for an understanding of the FORTRAN IV CG) compiler are:

IBM §yst~m~J~Q~2~~!~!ng-2Y~tem:

Principles of operation, Form A22-6821

Introduction to Control Program Loqic, Program Logic Manual, Form Y28-6605

Any reference to a Programmer's Guide in this publication applies to FORTRAN

IY-l§_!n~Jil_Programmer's Guide, Form C28-6817. The fORTRAN IV (G) Program- mer's Guide, Form C28-6639, (to which

references may exist in this publica- tion) has been replaced by the com- bined G and H Programmer's Guide.

Although not required, the following publications are rE~lated to this publica- tion and should be consulted:

IBM System/360 Operation system:

§.~g~nt ia!_~££~!!_J1~ihod~L-f!:Qg!.!.m Logic

M!~!!, Form Y28-6604

Second Edition (May 1968)

Concepts and Facilitie~, Form C28-6535 supervisor and Data Management Macro- Instructions, Form C28-6647

Linkage Editor, Proq.!:!!!L_y>gic_~!!!!!!!,

Form Y28=6'610

This publication sections:

consists of two section 1 is an introduction that describes the FORTRAN IV (G) compiler as a whole, including its relationship to the operating" system. The major components of the compiler and relationships among them are also described in this section.

Section 2 consists of a discussion of compiler operation. Each component of the compiler is described in sufficient detail to enable the reader to understand its operation, and to provide a frame of reference for the comments and coding supp- lied in the program listing. Common data such as tables, blocks, and work areas is discussed only to the extent required to understand the logic of each component.

Flowcharts are included at the end of this section.

Following Section 2, are appendixes that contain reference material.

If more detailed information is required, the reader should see the com- ments, remarks, and coding in the FORTRAN IV (G) program listing.

This i~ a major revision of', and makes obsolet.e, the previous edition, Form Y28-6638-0, and Technical Newsletters Y2B-6384, Y28-6386, Y28-6388, and Y28-6820. Changes to the text, and small illustrations, are indicated by a vertical line to the left of the change; changed or added illustrations are denoted by the symbol • to t.he left of the caption.

The specifications containe·d in this publication, as amended by TNL

I

Y28-6829, dated July 23, 1969, correspond to Release 18 and as further amended by TNL GY28-6841, dated January 15, 1911, correspond to Release 20 of the IBM Systeml360 Operating System.

changes are periodically made to the specifications herein; any such changes will be reported in subsequent revisions or Technical Newsletters.

Requests for coples of IBM publications should be made to your IBM representative or t.O the IBM branch office serving your locality.

Address comments concerning the contents of this publication to IBM corporation, Programming Publications, 1211 Avenue of the Americas, New York, N. Y. 10020.

" copyright International :Business Machines corporation 196B, 1910

(3)

Technical Newsletter

File Number S360-25 Re: Order No. GY28-6638-1

IBM System/360 Operating System FORTRAN IV (G) Compiler

Program Logic Manual

This Newsletter No. GY28-6826 Date November 15, 1968 Previous Newsletter Nos. None

This Technical Newsletter, a part of Release 17 of the IBM System/360 Operating System, provides replacement pages for IBM S stem/360 0 eratin System: FORTRAN IV (G) Compiler program-

LOt~C Manua , Form Y - T ese rep acement pages rema~n in ef ect for subsequent releases unless specifically altered. Pages to be replaced and/or added are listed below.

Pages Cover, preface

19-20 27-32 35-38.1 39-40 45-46 '53-54

67-68 (67.1 added) 69-70.1

71-72 77-78

145-146.1 153-154.1 157-158 177-178 185-186 191-192 221-224.1

225-226 (225.1 added) 229-230.1

253-254

Changes to the text, and small changes to illustrations, are

indicated by a vertical line to the left of the change; changed or added illustrations are denoted by the symbol • to the left of the caption.

Summary of Amendments

New information about innermost DO loops with a possible extended range has been added. The information includes descriptions of two new routines, XTEND LABEL and EXTND TARGET LABEL, and changes to existing routines and flowcharts involved in phase 1 processing.

There is also additional information about theONAMELIST table entries and the GET POLISH routine, and a description of the improvements made by the FORTRAN object.-time library in the pro- .cessing of BACKSPACE statements.

File this cover letter at the back of 1:he publication to provide a record of changes.

IBM Corporation, Programming Publications, 1271 Avenue of the Americas, New York, N.Y. 10020

PRINTED IN U. S. A.

(4)

Technical Newsletter

IBM System/360 Operating System FORTRAN IV (G) Compiler

Program Logic Manual

File Number Re: Order No.

This Newsletter No.

Date

Previous Newsletter Nos.

This Technical Newsletter, a part of Release 18 of the IBM

System/~60 Operating System, provides replacement pages for IBM System/360 Operating System: FORTRAN IV (G) Compiler

ProgramLo~ic Manual, Form Y28-6638-1. These replacement pages rema1n in effect for subsequent releases unless speci- fically altered. Pages to be replaced and/or added are listed below.

Cover, preface 7,8

13,14 17,18 35-36.1 43-44.1 45,46

Pages

49-52 55-58 75-76 113-114 167-1.70 175-176.1 209,210 255-257

Changes to the text, and small changes to illustrations, are indicated by a vertical line to the left of the change; changed or added illustrations are denoted by the symbol • to the left of the caption.

Summary of Amendments

A description of the compiler statistics messages and the phases and subroutines which generate them is added. Illus- trations of the formats of the messages are included.

File this cover letter at the back of the publication to provide a record of changes.

IBM Corporation, Programming Publications, 1271 Avenue of the Americas, New York, N.Y. 10020

PRINTED IN U. S. A.

8360-25 GY28-6638-1

GY28·6829 July 23, 1969 GY28-6826 GY28-6847

(5)

Technical Newsletter

File No. S360-25(OS) Re: Order No. GY2 8-6 638-1 This Newsletter No. GY 28 - 6847 Date: January 15, 1971 Previous Newsletter Nos.

IBM System/360 Operating System FORTRAN IV (G) Compiler

Program Logic Manual

e

International Business Machines Corporation

replacement pages for the publication S stem: FORTRAN IV (G) Com iler er No. GY28-6638- •

The specifications contained in this publication correspond to Release 20 of the IBM System/360 Operating System. Pages to be replaced are listed below:

Page(s) Cover-2

7,8

211-258

263-272

Summary of Amendment(s) Release notice updated

List of illustration~ updated

"Appendix F: Object-Time Library Subprograms" has been replaced in its entirety; new information has been added, obsolete information deleted, and existing information expanded and clarified (replacement"

pages are 211-258.10) Index updated

Changes to the text and small changes to illustrations are indicated by a vertical line to the left of the change;

changed or added illustrations are denoted by the symbol • to the left of the caption. File this cover letter at the back of the publication to provide a record of changes.

IBM Corporlll;"', Progra';'ming Publicalions, 1271 Av,nu, of Ih, Am'Nclls, New York, N.Y. 10020

GY28-6826 GY28-6829

PIIINTED IN U. S. A.

(6)

SECTION 1: INTRODUCTION TO THE COMPILER Purpose of the Compiler

9 9 Machine Configuration 9

Compiler and System/360 Operating

System • • • • • • • • • • • 9 Compiler Design • • • • • • 9 Limitations of the Compiler 9 Compiler Implementation '. • • • • • • • 10 POP Language • • • • • • • • • 10 Compiler Organization • • 10 Control Phase: Invocation (IEYFORT) 12 Phase 1: Parse (IEYPAR) • • • 12 Phase 2: Allocate (IEYALL) 12 Phase 3: Unify (IEYUNF) • • 12

Phase 4: Gen (IEYGEN) 12

Phase 5: Exit (IEYEXT) • • 13 Roll (IEYROL) • • • • • • • 13 Compiler Storage Configuration • • 15 Compiler Output • • • • • • 15 Object Module • • • • • • • • • 17 Components of the Object Module 17 object Module General Register

Usage • • • • • • • Source Module Listing object Module Listing

Storage Maps • • • • • • • • • Error Messages • • • •

Common Error Messages • • • • • Compiler Data Structures • • • • • •

Rolls ~nd Roll Controls ROLL ADR Table • • • • •

BASE, BOTTOM, and TOP Tables • • Special Rolls • • • •

Central Items, Groups, and Group Stats • • • • •

Other Variables Answer Box • ..

Multiple Precision Scan Control

Flags • • • • • Quotes • • •

Arithmetic

20 20 20

• • 21 21 21

• • 21 21 22 23

• • 24 24 26

• • 26 26 26 27

• 27 Messages • • • • • • 27 Compiler Arrangement and General

Register Usage • • • 28

29 Pointers • • • • • • •

Drivers • • • • • • • Operation Drivers Control Drivers

SECTION 2: COMPILER OPERATION Invocation Phase (IEYFORT) •

IEYFORT, Chart 00 IEYPRNT, Chart 00A4 PRNTHEAD, Chart 01A2 • IEYREAD, Chart 01A4 IEYPCH, Chart 02A3 • PRNTMSG, Chart 03A1 IEYMOR, Chart 01D1 • IEYNOCR

IEYRETN, Chart 03A2 OPTSCAN, Chart AA

DDNAMES, Chart AB

30 30

• • • • 31 33 33 33

• • • • 33

• • • • 34

• 34 34 34 34 34 35

• • 35 35

CONTENTS

HEADOPT, Chart AC • • • • • 35 TIMEDAT, Chart AD • • • • 35 Output from IEYFORT • • • • • 35 Phase 1 of the Compiler: Parse (IEYPAR) 36 Flow of Phase 1, Chart 04 • • • • 37 PRINT and READ SOURCE, Chart BA 37 STA INIT, Chart BB • • 38 LBL FIELD XLATE, Chart BC • 38

STA XLATE, Chart BD 38

STA FINAL, Chart BE • 39 ACTIVE END STA XLATE, Chart BF • 39 PROCESS POLISH, Chart BG • 39 Output from Phase 1 •• • • • • • • • • 39

Polish Notation • 39

Source Listing • • • • • • • 42 Phase 2 of the Compiler: Allocate

(IEYALL) • • • • • • • • • • • • • • 44 Flow of Phase 2, Chart 05 • • • • 45 ALPHA LBL AND L SPROGS, Chart CA • • 45 ALPHA SCALAR ARRAY AND SPROG,

Chart CA • • • • • • 45 PREP EQUIV AND PRINT ERRORS, Chart

CB • • • • • 45

BLOCK DATA PROG ALLOCATION, Chart CC • • • • • • • • 46 PREP DMY DIM AND PRINT ERRORS,

Chart CD • • • • • • • • • • • • 46 PROCESS DO LOOPS, Chart CE • • • 46 PROCESS LBL AND LOCAL SPROGS,

Chart CF • • • • • • • • • • • • 46 BUILD PROGRAM ESD, Chart CG • 46 ENTRY,NAME ALLOCATION, Chart CH • • 46 COMMON ALLOCATION AND OUTPUT,

Chart CI • • • • • • • • • 47 EQUIV ALLOCATION PRINT ERRORS,

Chart CK • • • • • • • • • • • 47 BASE AND BRANCH TABLE ALLOC, Chart

CL • • • • • • • • • • • •

SCALAR ALLOCATE, Chart CM ARRAY ALLOCATE, Chart CN • PASS 1 GLOBAL SPROG ALLOCATE,

• 47

• 47

• 47 Chart CO • • • • • • • • • • • • 48 SPROG ARG ALLOCATION, Chart CP • • • 48 PREP NAMELIST, Chart CQ • 48 LITERAL CONST ALLOCATION, Chart CR • 48 FORMAT ALLOCATION, Chart CS • 48 EQUIV MAP, Chart CT • • • • • • • • 48 GLOBAL SPROG ALLOCATE, Chart CU • • 48 BUILD NAMELIST TABLE, Chart CV • • • 48 BUILD ADDITIONAL BASES, Chart

cw • .

49 DEBUG ALLOCATE, Chart CX • • • 49 Output From Phase 2 • • • • • • • • • 49 Error Messages Produced by Allocate 49 Unclosed DO Loops • • • • • • 49 Storage Maps Produced by Allocate • 50 Subprogram List • • • • • • • • • • 51 Cards Produced by Allocate • • • • • 51 Phase 3 of the Compiler: Unify (IEYUNF) 51 Flow of Phase 3, Chart 07 • • • • • • 52 ARRAY REF ROLL ALLOTMENT, Chart DA • 52 CONVERT TO ADR CONST, Chart DB • • • 52 CONVERT TO INST FORMAT, Chart DC • • 52

(7)

DO NEST UNIFY, Chart DD IEYROL MorjlJle • • • • •

53 53 Phase 4 of the Compiler: Gen

(IEYGEN) • • • • • • • • • • • • 53 Flow of Phase 4, Chart 08

ENTRY CODE GEN, Chart EA • •

53 54 PROLOGUE GEN, Chart EB • 54

EPILOGUE GEN, Chart EC • GET POLISH, Chart ED • • LBL PROCESS, Chart EF STA GEN, Chart EG

• • • • 54

• • • • 54 STA GEN FINISH, Chart EH • •

Phase 5 of the Compiler: Exit (IEYEXTl • Flow of Phase 5, Chart 09 • • • •

PUNCH TEMP AND CONST ROLL, Chart FA PUNCH ADR CONST ROLL, Chart FB • • • PUNCH CODE ROLL, Chart FC

PUNCH BASE ROLL, Chart FD PUNCH BRANCH ROLL, Chart FE

54 54 55 55 55 55 56 56 56 56 56 PUNCH SPROG ARG ROLL, Chart FF •

PUNCH GLOBAL SPROG ROLL, Chart FG PUNCH USED LIBRARY ROLL, Chart FH PUNCH ADCON ROLL, Chart FI • •

• 57

• 57 ORDER AND PUNCH RLD ROLL, Chart FJ •

57 57 PUNCH END CARD, Chart FK 57

PUNCH NAMELIST MPY DATA, output From Phase 5

Chart FL • 57 57 APPENDIX A: THE POP LANGUAGE • • 127 POP Instructions. • • • • • • .127 Transmissive Instructions • • 127 Arithmetic and Logical Instructions .130 Decision Making Instructions. • .131 Jump Instructions • • • • • • • .133 Roll Control Instructions • • • • • • 133 Code Producing Instructions • • 134 Address Computation Instructions • • • 134 Indirect Addressing Instruction • • • 135 Labels. • • • • • • • • • • 135 Global Labels • • • • • • .135 Local Labels. • • • • • .136 Assembly and Operation. • .136

POP Interpreter .136

Assembler Language References to POP Subroutines • • • • • • • • • • • 137 Global Jump Instructions • • • • • • • 137 Local Jump Instructions • • • • • • • 138 APPENDIX B: ROLLS USED IN THE COMPILER .140

RollO: LIB Roll • • 140

Roll 1: SOURCE Roll. • .140 Roll 2: IND VAR Roll • • • • • .141 Roll 2: NONSTD SCRIPT Roll • • 141 Roll 3: NEST SCRIPT Roll • • 141 Roll 4: POLISH Roll. • • • • .141 Roll 4: LOOP SCRIPT Roll • • • • • • • 142 RollS: LITERAL CONST Roll • • 142 Roll 7: GLOBAL SPROG Roll. • .142 Roll 8: FX CONST Roll. • .143 Roll 9: FL CONST Roll • • 143 Roll 10: DP CONST Roll • • 143

~oll 11: COMPLEX CONST Roll • • 143 Roll 12: DP COMPLEX CONST Roll • • • • • 143 Roll 13: TEMP NAME Roll • • • • 143 Roll 13: STD SCRIPT Roll. • • .144 Roll 14: TEMP Roll. • • • • • .144 Roll 15: DO LOOPS OPEN Roll • • 144 Roll 15: LOOPS OPEN Roll. • • .144

Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll Roll

1&: ERROR MESSAGE Roll .144 16: TEMP AND CONST Roll. .144 17: ERROR CHAR Roll. • • • • .145 17: ADCON Roll • • • • .145 18: INIT Roll. • • • • • • • • 145 18: DATA SAVE Roll • • • • • .145 19: EQUIVALENCE TEMP (EQUIV TEMP)

.145 20: EQUIVALENCE HOLD (EQUIV HOLD) 20:

21:

22:

23:

23:

24:

25:

26:

26:

27:

28:

29 : 30:

30:

31:

32:

33:

34:

35:

36:

36:

37:

37:

38:

39:

39 : 40:

40 : 41:

42:

42:

43:

44:

44:

45:

46:

47:

47:

48:

48:

49:

50:

51:

52:

52:

53:

54:

55:

56:

56:

57:

58:

59:

60:

60:

62:

62:

REG Roll • • • •

BASE TABLE Roll • • • • • ARRAY Roll • • • • • DMY DIMENSION Roll

SPROG ARG Roll • • • • • ENTRY NAMES Roll • • • • GLOBAL DMY Roll • • • • • ERROR Roll • • • • ERROR LBL Roll

.145 .146 .146 .146 .147 .147 .147 .148

• • • 148 .148 .148 LOCAL DMY Ro11 • • • • •

LOCAL SPROG Roll • • • • EXPLICIT Roll • • • • • • • CALL LBL Roll • • •

.149

• • 149 .149 .149 .149 .150 .150 .150 .150 .151 .151 .151 .151 .152 .152 .152 .152 .153 .153 .153 .153 .153 .154 .154 .154 ERROR SYMBOL Roll • •

NAMELIST NAMES Roll • NAMELIST ITEMS Roll • ARRAY DIMENSION Roll BRANCH TABLE Roll • • TEMP DATA NAME Roll • TEMP POLISH Roll FX AC Roll • • • •

EQUIVALENCE Roll • • • • BYTE SCALAR Roll • • • • USED LIB FUNCTION Roll COMMON DATA Roll

HALF WORD SCALAR Roll COMMON NAME Roll • • • • TEMP PNTR Roll

IMPLICIT Roll • • • • EQUIVALENCE OFFSET Roll • FL AC Roll • • • • • LBL Roll • • • • • • • • SCALAR Roll • • • • HEX CONST Roll • • • • • DATA VAR Roll •

LITERAL TEMP (TEMP LITERAL)

• • • • • 155 COMMON DATA TEMP Roll • •

FULL WORD SCALAR Roll COMMON AREA Roll • • • • NAMELIST ALLOCATION Roll COMMON NAME TEMP Roll • • EQUIV ALLOCATION Roll • • RLD Roll • • • • • • • • COMMON ALLOCATION Roll LOOP CONTROL Roll • FORMAT Roll • • • SCRIPT Roll • • • LOOP DATA Roll

PROGRAM SCRIPT Roll • ARRAY PLEX Roll • • ARRAY REF Roll

.155 .155 .155 .155 .156 .156

• • • 156 .156 .156

• • • 157 .157 .157 .158 .158 .159 ADR CONST Roll • • • • • • • • 159 .159 .160 .160 .160 .160 AT Roll • • • • • • • • •

SUBCHK Roll • • • NAMELIST MPY DATA Roll GENERAL ALLOCATION Roll • CODE Roll • • • • • _ • •

(8)

Order No. GY28-6638-1, page revised 1/15/71 by TNL GY28-6847

Roll 60: NAMELIST MPY DATA Roll

Roll 62: GENERAL ALLOCATION Roll • • • .160

• .160 .160 Roll 62: CODE Roll • • • •

Roll 63: AFTER POLISH Roll • • • • • • • 161 Work and Exit Rolls • • •

WORK Roll EXIT Roll

.161

• .161 .161 APPENDIX C: POLISH NOTATION FORMATS • • 163 General Form. • • • • • .163 Labeled Statements. • • .163 Array References • • • • • • • • 163

ENTRY Statement .164

ASSIGN Statement. • • • 164 Assigned GO TO Statement • • • • • • • • 164 Logical IF Statement. • • • • • • • 164 RETURN Statement. • • • .164 Arithmetic and Logical Assignment

Statement • • • • • • • • • • • • • • • 164 Unconditional GO TO Statement .165 computed GO TO Statement • • • • • • • • 165 Arithmetic IF Statement • • • 165 DO Statement. • • • • • • .165 CONTINUE Statement. • • • • .166 PAUSE and STOP Statements • • 166 END Statement • • • • • • • • • • .166 BLOCK DATA Statement. • • • • • .166 DATA Statement and DATA in Explicit

Specification Statements • • • • • •

I/O List • • • • • .166

.167 Input Statements

FORMATTED READ • NAMELIST READ UNFORMATTED READ • READ Standard Unit • Output Statements

FORMATTED WRITE NAMELIST WRITE. , • • UNFORMATTED WRITE PRINT • • • • • • • PUNCH • • • • • • • Direct Access Statements •

READ, Direct Access

• • • 167

• .167 .168

• • • • • 168 .168 .168

• .168 .169

• .169 .169 .169

• • • • • • • 169 WRITE, Direct Access • • • • • • • .169

• • • 170 .170 .170 FIND • • • • • • • • • •

DEFINE FILE

END FILE Statement • REWIND Statement • • BACKSPACE Statement Statement Function • FUNCTION Statement •

• .170 .171

• • • • • • .171

• • • • • 171

• • • • • • • 171 Function (Statement or Subprogram)

Reference • • • • • • Subroutine Statement • CALL Statement • • • • Debug Facility Statements

AT • • • • TRACE ON •

TRACE OFF • • • • • DISPLAY • • • •

APPENDIX D: OBJECT CODE PRODUCED BY

• .171

• .171 .172 .172

• .172

• .172

• .172

• .173 THE COMPILER. • • • • • • • • .175 Branches. • • • • • • • • • • 175 Computed GO TO Statement. • .175 DO Statement. • • • • • • • • • 175

Statement Functions • • 176

Subroutine and Function Subprograms • • 176

Input/Output Operations • • • • • • • • 177 Formatted Read and Write Statements .177 Second List Item, Formatted • • • • • 177 Second List Array, Formatted • • • • • 178 Final List Entry, Formatted • • • • • 178 Unformatted Read and Write Statements 178 Second List Item, Unformatted • • • • 178 Second List Array, Unformatted • • • • 178 Final List Entry, Unformatted • • • • 178 Backspace, Rewind, and Write Tapemark 178 STOP and PAUSE Statements • • 179 NAMELIST READ and WRITE • • • • • • • 179 DEFINE FILE Statement • • 179

FIND Statement. • • .179

Direct Access READ and WRITE Statements • • • •

FORMAT Statements

FORMAT Beginning and Ending Parentheses

Slashes • • • • Internal Parentheses

• .179

• .180 .180

• .180

• .180 Repetition of Individual FORMAT

specifications • • • • • • • • • • • 180 I,F,E, and D FORMAT Codes • • 180 A FORMAT Code • • • • • • 180 Literal Data. • • • • • • • .180

X FORMAT Code • • • 181

T FORMAT Code • • • • • • • • • • .181 Scale Factor-P • • • • • • • • • • • 181 G FORMAT Code • • • • • .181 L FORMAT code • • • • • .181 Z FORMAT Code • • • • • .181 Debug Facility. • • • • • • • • • 181 DEBUG Statement • • • • • • • • .181 Beginning of Input/Output

r. .

.181

End of Input/Output • • • • • • 181 UNIT Option • • • • • • • 181 TRACE Option. • • • .182 SUBTRACE Option • • • • • • • 182 INIT Option • • • • • .182

SUBCHK Option • • 183

AT Statement. • • • • • • • • • 183

TRACE ON Statement. .183

TRACE OFF Statement • • 183

DISPLAY Statement • • 183

APPENDIX E: MISCELLANEOUS REFERENCE

DATA • • • • • • • • • • • • • • .185 Parse Label List. • • • • • • • • .185 Supplementary Parse Label List. • .185 Allocate Label List • • • • • • • • • • 193 Supplementary Allocate Label List • • • 193 Unify Label List • • • • • e .196 Supplementary Unify Label List. • .196 Gen Label List. • • • • • • • • .198 Supplementary Gen Label List. • • .198 Exit Label List • • • • • • • • • 208 Supplementary Exit Label List • • 208 APPENDIX F: OBJECT-TIME LIBRARY

SUBPROGRAMS • • • • Library Functions • • • • • Composition of the Library • System Generation Options Module summaries • • • • • Library Interrelationships

Initialization • • • • • • • • • Input/Output operations • • • •

• .212

• .212

• .212

• .212

• .213

• .214

• .215

• .216

(9)

Order No. GY28-6638-1, page revised 1/15/71 by TNL GY28-6847

Define File • ~ • • • • • • • • • • • 218 Sequential Read/Write Without Format .218 Initial Call • • • • • • • • • • • • 218 Second Call • • • • • • • 219 Additional List Item Calls .219 Final Call. • • • • .219 System Block Modification and

Reference • • • • • • • .219 Error Conditions. • • • • • • .220 Sequential READ/WRITE With Format • • 221 Processing the Format Specification 221 Direct Access READ/WRITE Without

Format • • • • • • • • • • • • • • • • 224 initialization Branch • • • • • • • 224 Successive Entries for List Items .225 Final Branch • • • • • • • • • • • • 225 Error Conditions • • • • • • • • • • 226 Direct Access READ/WRITE With Format .226

FIND. • • .226

READ And WRITE Using NAMELIST .226 Read. • • • • • • • • • .226 Write • • • • • • • • • • • • .227 Error Conditions. • • • • • • .227 Stop and Pause (Write-to-Operator) • • 227

stop. • • • • • .227

Pause • • • • • • • • • • • • 227 Backspace • • • • • • • 227 Rewind. • • • • • • • • • 228

End-File. • • • • .228

Error Handling .228

Compiler-Directed Errors: IHCIBERH • • 228 Program Interrupts • • ~ • • .229

Action for Interrupts 9, 11, 12,

13, and 15 • • • • • .. • • .229 Action for Interrupt 6 • • .229 Library-Detected Errors • • 230 Without Extended Error Handling • • 230 With Extended Error Handling • ' • • • 231 Abnormal Termination Processing .231 Codes 4 and 12 • • • ~ • • • • • • • 231 Codes 0 and 8 • • • ~ • • • • .231 Extended Error Handling Facility • • • 232 Option Table--IHCUOPT • • • • • • • 232 Altering the Option Table--IHCFOPT .232 Error Monitor--IHCERRM • • • .233 Extended Error Handling

Trackback--IHCETRCH • • 233 Conversion. • • • • • • • • • • • • 234 Mathematical and Service Routines • • • 234 Mathematical Routines . . . 234 Service Subroutines • ~ • • • • .234 IHCFDVCH (Entry Name DVCHK) • • 234 IHCFOVER (Entry Name OVERFL) • • • • 235 IHCFSLIT (Entry Names SLITE,

SLITET) • • • • • • • • • IHCFEXIT (Entry Name EXIT) IHCFDUMP (Entry Names DUMP and PDUMP) •

I HCDaUG Termination

GLOSSARY •

. . . . .

INDEX

• .235

• .235

• .235

• .236

• .239

• • 259 .263

(10)

Order No. GY28-6638-1. page revised 1/15/11 by TNL GY28-6847

FIGURES

Figure 1. Overall Operation of

the Compiler • • • • • • • • • • • • 11 Figure 2. Compiler Organization Chart • • • • • • • 0 Figure 3. Compiler storage Configuration • • • • • Figure 4. Compiler output Figure 5. Object Module Configuration • • • •

Figure 6. Example of Use of Save Area • • • • • • • • • •

Figure 1. Roll Containing K Bytes of Information • • • • Figure 8. Roll Containing L Bytes of Reserved Information and

14

• 15 16 11 18 23 K Bytes of New Information • • • • 24 Figure 9. Roll With a Group Size of Twelve • • • • • • • • • • • • • 25 Figure 10. Roll with Variable

Group Size • • • • • • • • • • Figure 11. First Group Stats

Table •

Figure 12. Second Group Stats

Table • • • •

Figure 13. Scan Control Variables

TABLES

Table 1. Internal configuration

25 26 26 27

of Operation Drivers • • • • • • • • 31 Table 2. Internal configuration of" control Drivers (Part 1 of 2). 32

~dble 3. Rolls Used by Parse • • • 36 fable 4. Rolls Used by Allocate 44

T~ble 5. Rolls Used by Unify 52 Table 6. Rolls Used by Gen • 53 Table 7. Rolls Used by Exit 55 Table 8. POP Instruction

Cross-Reference List • • • • • • • • 139

ILLUSTRATIONS

Figure 14. Quotes Used in the

C o m p i l e r . 27

Figure 15. Compiler Arrangement

with Registers 28

Figure 16. Calling Paths for

Library Routines 215

Figure 17. Control Flow for

Input/output Operations • 217 Figure 18. IHCUATBL: The Data

Set Assignment • . • 239 Figure 19. DSRN Default Value

Field of IHCUATBL Entry 240 Figure 20. Format of a Unit Block for a Sequential Access Data Set • 240 Figure 21. Format of a Unit Block for a Direct Access Data Set 242 Figure 22. General Form of the

Option Table (IHCUOPT) . 242.1 Figure 23. Preface of the Option Table (IHCUOPT). • • . • 242.2 Figure 24. Composition of an

Option Table Entry • . 242.2 Figure 25. Original Values of

Option Table Entries • 242.3

Table 9. Routines Affected by

Extended Error Handling Option 212 Table 10. Format Code Translations and Their Meanings • • . • • • • 222 Table 11. IHCFCVTH Subroutine

Directory . • . . . • • • . 234 Table 12. IHCDBUG Transfer Table. 236 Table 13. DCB Default Values • 240 Table 14. IHCFCOMH/IHCECOMH

Transfer and Subroutine Table • 242.3

(11)

Order No. GY28-6638-1, page revised 1/15/71 by TNL GY28-6847

CHARTS

Chart 00. IEYFORT (Part 1 of 4) 59 Chart 01. IEYFORT (Part 2 of 4) 60 Chart 02. IEYFORT (Part 3 of 4) 61 Chart 03. IEYFORT (Part 4 of 4) 62 Chart AA. OPTSCAN • • • • • • • 63 Chart AB. D D N A M E S . . . 64 Chart AC. HE:ADOPT... 65 Chart AD. TIMEDAT.. • • 66 Chart 04.1. PHASE 1 - PARSE (Part 1 of 2) • • • • • • • • • 67 Chart 04.2. PHASE 1 - PARSE (Part 2 of 2) • • • • • • • • • • • • 68 Chart BA. WRITE LISTING AND READ SOURCE • • • • • • • • • • • 68 Chart BB. INITIALIZE FOR

PROCESSING STATEMENT • • • • 69 Chart BC1. PROCESS LABEL FIELD

(Part 1 of 2) • • • • • • • • • • • 10 Chart BC2. PROCESS LABEL FIELD

(Part 2 of 2) • • • • • • • • • 10 Chart BD. PROCESS STATEMENT • • • • 71 Chart BE. COMPLETE STATEMENT AND

MOVE POLISH • • • • • • • • • 12 Chart BF. PROCESS END STATEMENT • • 13 Chart BG. PROCESS POLISH • • 74 Chart 05. PHASE 2 - ALLOCATE

(Part 1 of 2) • • • • • • • 15 chart 06. PHASE 2 - ALLOCATE

(Part 2 of 2) • • • • • • • 76 Chart CA. MOVE BLD NAMES TO DATA

VAR ROLL • • • • • • • • • • • • 77 Chart CB. PREPARE EQUIVALENCE DATA 78 chart CC. ALLOCATE BLOC~ DATA • • • 79 Chart CD. PREPROCESS DUMMY

DIMENSIONS • • • • • • • • • • 80 Chart CEo CHECK FOR UNCLOSED DO

LOOPS • • • • • • • • • • • 81 Chart CF. CONSTRUCT BRANCH TABLE

ROLL • • • • • • • • • • • • • • 82 Chart CG. ALLOCATE HEADING AND

PUNCH ESD CARDS • • • • • • • 83 Chart CH. CHECK ASSIGNMENT OF

FUNCTION VALUE • • • • • • • • • 84 chart CI. COMMON ALLOCATION • • • • 85 Chart CK. EQUIVALENCE DATA

ALLOCATION • • • • • • • • • • • chart CL. SAVE AREA, BASE AND BRANCH TABLE ALLOCATION

chart CM. ALLOCATE SCALARS Chart CN. ALLOCATE ARRAYS • Chart CO. ADD BASES FOR SUBPROGRAM ADDRESSES • • • •

86 87 88 89 90 chart CPo ALLOCATE SUBPROGRAM

ARGUMENT LI STS • • ., • • • • • • 91 Chart CQ. PREPARE NAMELIST TABLES • 92 chart CR. ALLOCATE LITERAL

CONSTANTS • .. • • .. • • • • • • Chart CS. ALLOCATE FORMATS Chart CT. MAP EQUIVALENCE • • • Chart CU. ALLOCATE SUBPROGRAM ADDRESSES ... • • " • • • • •

93

• 94 95 96

Chart CV. BUILD AND PUNCH

NAMELIST TABLES • • • • • • • 97 Chart CWo BUILD BASES • • • • • 98 Chart CX. DEBUG ALLOCATE • • 99 Chart 07. PHASE 3 - UNIFY. • .100 Chart DA. BUILD ARRAY REF ROLL • • 101 Chart DB. MAKE ADDRESS CONSTANTS .102 Chart DC. CONSTRUCT INSTRUCTIONS .103 Chart DD. PROCESS NESTED LOOPS .104 Chart 08. PHASE 4 - GEN • • • • • • 105 Chart EA. GENERATE ENTRY CODE • • • 106 Chart EB. PROLOGUE CODE GENERATION 107 Chart EC. EPILOGUE CODE GENERATION 108 Chart ED. MOVE POLISH NOTATION • • 109 Chart EF. PROCESS LABELS • • 110 Chart EG. GENERATE STMT CODE • • • 111 Chart EH. COMPLETE OBJECT CODE • • 112 Chart 09. PHASE 5 - IEYEXT • • 113 Chart FA. PUNCH CONSTANTS AND

TEMP STORAGE • • • • • • • • • • • • 114 Chart FB. PUNCH ADR CONST ROLL • • 115 Chart FC. PUNCH OBJECT CODE • • • • 116 Chart FD. PUNCH BASE TABLE • • 117 Chart FE. PUNCH BRANCH TABLE • • • 118 Chart FF. PUNCH SUBPROGRAM

ARGUMENT LISTS • • • • • • • • • • • 119 Chart FG. PUNCH SUBPROGRAM

ADDRESSES • • • • • • • • • • 120 Chart FH. COMPLETE ADDRESSES FROM LIBRARY • • • • • • • • • • • • • • 121 Chart Fl. PUNCH ADDRESS CONSTANTS .122 Chart FJ. PUNCH RLD CARDS • • • • • 123 Chart FR. PUNCH END CARDS • • • • • 124 Chart FL. PUNCH NAMELIST TABLE

POINTERS. • • • • • • • • • • 125 Chart GO. IHCFCOMH/IHCECOMH

(Part 1 of 4) • • • • • • • • • • • 243 Chart GO. IHCFCOMH/IHCECOMH

(Part 2 of 4) • • • • • • • • • • 243.1 Chart GO. IHCFCOMH/IHCECOMH

(Part 3 of 4) • • • • • • • • • • 243.2 Chart GO. IHCFCOMH/IHCECOMH

(Part 4 of 4) • • • • • • • • • • 243.3 Chart G1. IHCFIOSH/IHCEFIOS

(Part 1 of 2) • • • • • • • • • • • 244 Chart G1. IHCFIOSH/IHCEFIOS

(Part 2 of 2) • • • • • • • • • • 244.1 Chart G2. IHCDIOSE/IHCEDIOS

(Part 1 of 5) . . . 245 Chart G2. IHCDIOSE/IHCEDIOS

(Part 2 of 5) • • • • • • • • • • 245.1 Chart G2. IHCDIOSE/IHCEDIOS

(Part 3 of 5) • • • • • • • • • • 245.2 Chart G2. IHCDIOSE/IHCEDIOS

(Part 4 of 5) • • • • • • • • • • 245.3 Chart G2. IHCDIOSE/IHCEDIOS

(Part 5 of 5) • • • • • • • • • D .246 Chart G3. IHCNAMEL • • • • • • • • 247 Chart G4. IHCFINTH/IHCEFNTH

(Part 1 of 3) • • • • • • • • .248 Chart G4. IHCFINTH/IHCEFNTH

(Part 2 of 3) • • • • • • • • • • 248.1

(12)

Order No. GY28-6638-1, page revised 1/15/71 by TNL GY28-6847

Chart (Part 3 of 3) G4. IHCFINTH/IHCEFNTH

. . . . · · · · .

• 248.2 Chart G9. Chart G10. IHCFOPT (Part 3 of 3) IHCTRCH/IHCERTCH

· · ·

• 257 • 258

Chart Chart G5. G6. IHCADJST • IHCIBERH •

· · · ·

• 249 Chart Gll. IHCFDUMP •

· · · . . ·

• 258.1

· · · ·

• 250 Chart G12. IHCFEXIT

· · . . ·

• 258.2

Chart G7. IHCSTAE (Part 1 of 2) • 251 Chart G13. IHCFSLIT •

· · ·

• 258.3

Chart G7. IHCSTAE (Part 2 of 2) • 252 Chart G14. IHCFOVER •

· · · ·

• 258.4

Chart G8. IHCERRM (Part 1 of 2) • 253 Chart G15 • IHCFDVCH •

· · · ·

• 258.5

Chart G8. IHCERRM (Part 2 of 2) .254 Chart G16. IHCDBUG (Part 1 of 4) • 258.6 Chart G9. IHCFOPT (Part 1 of 3) .255 Chart G16. IHCDBUG (Part 2 of 4) .258.7 Chart G9. IHCFOPT (Part 2 of 3) .256 Chart G16. IHCDBUG (Part 3 of 4) • 258.8 Chart G16. IHCDBUG (Part 4 of 4) • 258.9

(13)
(14)

This section contains general informa- tion describing the purpose of the FORTRAN IV (G) compiler, the minimum machine confi- guration required, the relationship of the compiler to the operating system, compiler design and implementation, and compiler output. The various rolls, 1 variables, registers, pointers, and drivers used by the compiler are also discussed.

PURPOSE OF THE COMPILER

The IBM System/360 Operating System FORTRAN IV (G) compiler is designed to accept programs written in the FORTRAN IV language as defined in the publication IBM System/360: FORTRAN IV Language, Form C28-6515.

The compiler produces error messages for invalid statements, and, optionally, a listing of the source module, storage maps, and an object module acceptable to the System/360 Operating System linkage editor.

MACHINE CONFIGURATION

The minimum system configuration required for the use of the IBM System/360 Operating System with the FORTRAN IV (G) compiler is as follows:

• An IBM System/360 Model 40 computer with a storage capacity of 128K bytes and a standard and floating-point instruction set.

• A device for operator communication, such as an IBM 1052 Keyboard Printer.

• At least one direct-access device pro- vided for system residence.

COMPILER AND SYSTEM/360 OPERATING SYSTEM The FORTRAN IV (G) compiler is a proces- sing program of the IBM System/360 1Most of the tables used by the compiler are called rolls. (Further explanation of rolls is given in "Rolls and Roll Controls.")

operating System. As a processing program, the compiler communicates with the control program for input/output and other ser- vices. A general description of the con- trol program is given in the publication IBM System/360 operati~g system: Introduc- tion to Control Program Logic, Prog~~

Logic Manual.

A compilation, or a batch of compila- tions, is requested using the job statement

(JOB), the execute statement (EXEC), and data definition statements (DO). Alterna- tively, cataloged procedures may be used.

A discussion of FORTRAN IV compilation and the available cataloged procedures is given in the publication IBM~~.§.L.oper~ting

System: FORTRAN IV (G) Programmer's Guide.

The compiler receives control initially from the calling program (e. g., job sche-' duler or another program that CALLs, LINKs to, or ATTACHes the compiler). Once the compiler receives control, i t uses the QSAM access method for all of its input/output operations. After compilation is com- pleted, control is returned to the calling program.

COMPILER DESIGN

The compiler will operate within a total of 80K bytes of main storage. This figure includes space for the compiler code, data management access routines, and sufficient working space to meet other storage requirements stated throughout this publication.

Any additional storage available is used as additional roll storage.

LIMITAT~2-QF THE COMPILER

The System/360 Operating System FORTRAN IV (G) compiler and the object module it produces can be executed on all System/360 models from Model 40 and above, under control of the operating system control program. All input information must be written in either BCD or EBCDIC representa- tion. The compiler is designed to process all properly written programs so that the object code produced by the compiler is compatible with the existing mathematical library subroutines.

section 1: Introduction to the Compiler 9

(15)

If ten source read errors occur during the compilation, or if i t is not possible to use SYSPRINT~ the operation of the compiler is terminated. The operation of the compiler is also limited by the availa- bility of main storage space. The compila- tion is terminated if:

• The roll storage area is exceeded

• Any single roll exceeds 64K bytes, thereby making i t unaddressable

• The WORK or EXIT roll exceeds its allocated storage

Note: If any of these conditions occur during the first phase of the compilation, the statement currently being processed may be discarded; in this case, the compilation continues with the next statement.

The primary control and processing rou- tines (hereafter referred to as "POP rou- tines" or "compiler routines") of the com- piler are primarily written in machine- independent pseudo instructions called POP instructions.

Interpretation of the pseudo instruc- tions is accomplished by routines written in the System/360 Operating System assembl- er language. These routines (hereafter referred to as "POP subroutines") are an integral part of the compiler and perform the operations specified by the POP ins- tructions, e.g., saving of backup informa- tion, maintaining data indicators, and gen- eral housekeeping.

Control of the compiler operation is greatly affected by source language syntax rules during the first phase of the compil- er, Parse. During this phase, identifiers and explicit declarations encountered in parsing are placed in tables and a Polish

~ion fo"rm of the program is produced:- (For further information on Polish nota- tion, see Appendix C, "Polish Notation Formats.")

10

The compiler quite frequently uses the method of recursion in parsing, analysis, and optimization. All optimizing and code generating routines, which appear in later phases, operate directly on the tables and Polish notation produced by Parse.

The compiler is also designed so that reloading of the compiler is unnecessary in order to accomplish multiple compilations.

POP LANGUAGE

The FORTRAN IV (G) compiler is written in a combination of two languages: the System/360 Operating System assembler lan- guage, which is used where i t is most efficient, and the POP language.

The POP language is a mnemonic macro programming language whose instructions include functions that are frequently per- formed by a compiler. POP instructions are written for assembly by the System/360 Operating System assembler, with the POP instructions defined as macros. Each POP instruction is assembled as a pair of address constants which together indicate an instruction code and an operand. A statement or instruction written in the POP language is called a POP. The POP instruc- tions are described in Appendix A.

COMPILER ORGANIZATION

The system/360 Operating System FORTRAN IV (G) compiler is composed of a control phase, Invocation, and five processing phases (see Figure 1): Parse, Allocate, Unify, Gen, and Exit. The operating system names for these phases are, respectively, IEYFORT, IEYPAR, IEYALL, IEYUNF, IEYGEN, and IEYEXT. (The first level control and second level processing compiler routines used in each phase are shown in Figure 2.) In addition, Move is a pre-assembled work area, IEYROL.

(16)

IEYFORT

SYSIN--->r---;~~~~~----1--->r---~~~~~~1---1--->r--i~;~~;~i~~-l---> ~

I Module I I Program I I Phase I

l _____________ J l _____________ J l _____________ J

<9 . r---,

I r--->ISource Module I

I I I listing I

V IEYPAR

1

l _____________ J

r---,

I

I Parse ~---~

I (Phase 1) I I

l---T---J I r---,

I l--->ISource Module I

I I diagnostics I

I l _____________ J

V IEYALL

r--- -,

r---, r--->IStorage Maps I I Allocate I I l _____________ J

I (Phase 2) ~---~

l---T---J I

r---,

I l--->IESD and TXT

I ICards I

V IEYUNF l _____________ J

r---,

I Unify I

I (Phase 3) I l---T---J

I

V IEYGEN

r---,

I Gen I

I (Phase 4) I r---,

l---T---J r--->IObject Module I

I I I listing I

I I l _____________ J

V IEYEXT I r---, r---, I IObject Module I Exit ~---+--->ITXT cards I

I (Phase 5) I I l _____________ J

l---T---J I

I I

r---,

I I IESD, RLD, andl

V IEYFORT l--->IEND cards I

r---,

I Invocation I

I Phase I

l---I---

J

. * .

V

. * * .

l _____________ J

. * * .

. *

Multiple

*.

NO r---,

*.

Compilations • *---> I Control I

* •

*.* . . *.*

*

I Program l _____________ J I

*

YES

C9 V

Figure 1. Overall Operation of the Compiler

SYSPRINT

SYSPRINT

SYSPRINT

SYSPUNCH/SYSLIN

SYSPRINT

SYSPUNCH/SYSLIN

SYSPUNCH/SYSLIN

Section 1: Introduction to the Compiler 11

(17)

Control Phase: Invocation (IEYFORT)

The Invocation phase (IEYFORT) is loaded upon invocation of the compiler and remains in core storage throughout compilation. It is entered initially from the calling pro- gram, from each module at the end of its processing, and from Exit after compilation is complete.

At the initial entry, the Invocation phase initializes bits in IEYFORT1 from the options specified by the programmer for the compilation, opens data sets, and fetches the modules IEYPAR, I EYALL, IEYUNF, IEYGEN, and IEYEXT via a series of LOAD macro instructions. These modules remain in core storage for a series of main program and subprogram compilations unless it is deter- mined that additional space required for tables is not available. When this occurs, modules that precede the active one are deleted, and compilation is resumed. If more space is required, modules that follow the currently active one are deleted.

When a module completes processing, i t returns to IEYFORT, which ensures the pre- sence of the next module and transfers to it. During initialization for a subpro- gram, IEYFORT ensures that all modules are loaded.

The last entry is made from the Exit phase at the completion of a compilation.

When the entry is made from Exit, the Invocation phase checks for multiple compi- lations. If another compilation is required, the compiler is reinitialized and the main storage space allocated for the expansion of rolls is assigned to the next

compilation~ otherwise, control is returned to the calling program.

Parse accepts FORTRAN statements in card format from SYSIN and scans these to pro- duce error messages on the SYSPRINT data set, a source module listing (optional), and Polish notation for the program. The Polish notation is maintained on internal tables for use by subsequent phases. In addition, Parse produces the roll entries defining the symbols used in the source module.

Phase 2: Allocate CIEYALL)

Allocate, which operates immediately after Parse, uses the roll entries produced 12

by Parse to perform the storage allocation for the variables defined in the source module. The addressing information thus produced is then left in main storage to be used by the next phase.

The ESD cards for the object module itself, COMMON blocks and subprograms, and TXT cards for NAMELIST tables, literal constants and FORMAT statements are pro- duced by Allocate on the SYSPUNCH and/or SYSLIN data sets. Error messages for COMMON and EQUIVALENCE statements, unclosed DO loops and undefined labels are produced on SYSPRINT; on the MAP option, maps of data storage are also produced.

The Unify phase optimizes the usage of general registers within DO loops by operating on roll data which describes array references. The optimization applies to references which include subscripts of the form ax+b, where a and b are positive constants and x is an active induction variable (that is, x is a DO-controlled variable and the reference occurs within the DO loop controlling it), and where the array does not have any adjustable dimen- sions. The addressing portion of the object ~struction for each such array reference is constructed to minimize the number of registers used for the reference and the number of registers which must be changed as each induction variable changes.

Phase 4: Gen (IEYGEN)

Gen uses the Polish notation produced by Parse and the memory allocation information produced by Allocate. From this informa- tion, Gen produces the code, prologues, and epilogues required for the object module.

In order to produce the object code, Gen resolves labeled statement references (i.e., a branch target label) and subpro- gram entry references.

The final output from Gen is a complete form of the machine language code which is internally maintained for writing by the Exit phase.

(18)

Phase 5: Exit (IEYEXT)

Exit, which is the last processing phase of the compiler, produces the TXT cards for the remaining portion of the object module, the RLD cards (which contain the relocat- able information), and the END card. This output is placed optionally on the SYSLIN data set for linkage editor processing and/or SYSPUNCH if a card deck has been requested. Additionally, a listing of the generated code may be written on the SYS-

PRINT data set in a format similar to that produced by an assembly program.

Roll contains static rolls information always required for operations. These are described heading "Rolls and Roll Controls"

this section.

and roll compiler under the later in

Section 1: Introduction to the Compiler 13

(19)

Form Y28-6638-1

Page Revised 7/23/69 by TNL Y28-6829

r---·---·---,

I r---PRINT AND READ SOURCE

I I STA INIT

I r---START COMPILER I LBL FIELD XLATE

I PARSE----I I STA XLA TE

I I STA FINAL

I I REGISTER IBCOM

I I PROCESS POLISH

L---STA'rEMENT PROCESS---I ACTIVE END STA XLATE L---STA FINAL END

r---PREP EQUIV AND PRINT ERRORS BLOCK DATA PROG ALLOCATION PREP DMY DIN AND PRINT ERRORS PROCESS DO LOOPS

PROCESS LBL AND LOCAL SPROGS BUILD PROGRAM ESD

ENTRY NAME ALLOCATION

COMMON ALLOCATION AND OUTPUT BASE AND BRANCH TABLE ALLOC EQUIV ALLOCATION PRINT ERRORS FORMAT ALLOCATION

SCALAR ALLOCATE ARRAY ALLOCATE

1ALLOCATE---START ALLOCATE---I PASS 1 GLOBAL SPROG ALLOCATE SPROG ARG ALLOCATION

PREP NAMELIST

LITERAL CONST ALLOCATION EQUIV MAP

GLOBAL SPROG ALLOCATE BUILD NAMELIST TABLE ALPHA LBL AND L SPROG BUILD ADDITIONAL BASES

ALPHA SCALAR ARRAY AND SPROG LITERAL CONST ALLOCATION CALCULATE BASE AND DISP ---DEBUG ALLOCATE

r---ARRAY REF ROLL ALLOTMENT UNIFY---STAltT UNIFY---i DO NEST UNIFY

1 - - I CONVERT TO ADR CONST

I L---CONVERT TO INST FORMAT

1

1 I r----STAHT GEN

I I

I I

IGEN---,

r---MOVE ZEROS TO T AND C I ENTRY CODE GEN

I PROLOGUE GEN L---EPILOGUE GEN

I I r---GET POLISH

I L----GEN PROCESS---i LBL PROCESS

I I STA GEN

I L---STA GEN FINISH

I r---PUNCH TEMP AND CONST ROLL

I I PUNCH ADR CONST ROLL

I I PUNCH CODE ROLL

I I PUNCH BASE ROLL

I J PUNCH BRANCH ROLL

I I PUNCH SPROG ARG ROLL

I EXIT---EXIT PASS---I PUNCH GLOBAL SPROG ROLL

I I PUNCH USED LIBRARY ROLL

I I PUNCH ADCON ROLL

I I ORDER AND PUNCH RLD ROLL

I I PUNCH END CARD

I I PRINT HEADING

I I PRINT A LINE

I

I L-_________ • ___________________________________________________________________________ _ L---PRINT COMPILER STA~ISTICS -Figure 2. Compiler Organization Chart

14

(20)

Low Core

High

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

I Load I I I

IModule I IContent or I

I Name I Components I Function I

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

IEYFORT IEYFORT Invocation and IEYFORTl

IEYFORT2 IEYROL

IEYINT

control Option bits

Loads and deletes other modules Roll statistics (bases, tops, bottoms)

Group statistics (displacement group sizes) WORK roll EXIT roll

Roll address table POP Jump Table POP machine

language sub- routines

Roll Storage is Allocated from this

IEYPAR IEYPAR

I EYALL I EYALL IEYUNF IEYUNF IEYGEN IEYGEN

Parse phase Quotes and

messages Allocate phase Unify phase Generate phase CorelIEYEXT L _______ ~ __________ IEYEXT ~ __________________ Exit phase J

Figure 3. Compiler Storage Configuration

COMPILER STORAGE CONFIGURATION Figure

tions, but component they exist parts of tion 2.

3 illustrates the relative posi- not the relative sizes of the parts of the FORTRAN compiler as in main storage. The component each phase are described in Sec-

COMPILER OUTPUT

The source module(s) to be compiled appear as input to the compiler on the SYSIN data set. The SYSLIN, SYSPRINT, and SYSPUNCH data sets are used (depending on the options specified by the user) to contain the output of the compilation.

The output of the compiler is repre- sented in EBCDIC form and consists of any or all of the following:

Object Module (linkage editor input) Source Module listing

Object Module listing Storage maps

Error messages (always produced) Relocatable card images for punching The overall data flow and the data sets used for compilation are illustrated in Figure 4. The type of output is determined by compile time parameters.

Section 1: Introduction to the Compiler 15

(21)

r---, r---,

I Error and I

r----For all--->I Warning I SYSPRINT

I compilations I Messages I

I I (if any) I

I l ________________ J

I I I

I ~----LIST

I I I SYSIN I

r---,

I I SourcE~ I I

I Module I ~----DECK

l - - - - T - - - -J I

I ~

, I

V I

r---·--, ,

I FORTRAN, ,

'IV (G) ~->~

'Compiler' I

l ________ J ~----LOAD

, ,

,

I

,

~----MAP

, ,

, ,

, ,

r---,

I Object I

Option--->I Module I SYSPRINT I listing I

l ________________ J

r---,

IObject Module I

Option--->I (ESD, TXT, RLD I SYSPUNCH lEND) Card Images I

l ________________ J

r---,

IObject Module I

Option--->I (ESD, TXT, RLD, I SYSLIN lEND) Card Images I

l ________________ J

r---,

Option--->I Storage I SYSPRINT

I Map I

l ________________ J

r---,

, Source I

l----SOURCE Option--->I Module I SYSPRINT I Listing I

L ________________ J

Figure 4. Compiler Output

16

(22)

Form Y28-6638-1

Page Revised 7/23/69 by TNL Y28-6829 OBJECT MODULE

The configuration of the object module produced by the FORTRAN IV (G) compiler is shown in Figure 5.

Entry point--->

r---,

I Heading I

~---~

ISave area I

~---~

IBase table I

~---~

IBranch table I

~---~

ISubprogram argument I

Ilists I

~---~

ISubprogram addresses I .---~

IEQUIVALENCE variables I

~---~

IScalar variables I

~---~

I Arrays I

~---~

INAMELIST tables I

~---~

ILiteral constants I I (except those used I lin DATA and PAUSE I I statements) I .---~

IFORMAT statements I .---~

ITemporary storage I land constants I .---~ IProgram text I

L _____________________ J

• Figure 5. object Module Configuration

Components of the Object Module

The following paragraphs describe the components of the object module produced by the FORTRAN IV (G) compiler.

HEADING: The object module heading inclUdes all initializing instructions required prior to the execution of the body

of the object module. Among ot'he:r func- tions, these instructions set general register 13 (see "Object Module General Register Usage") and perform various opera- tions, depending on whether the program is a main program or a subprogram and on whether i t calls subprograms. (See "Code Produced for SUBROUTINE and FUNCTION Subprograms.")

SAVE AREA: The save area, at maximum 72 bytes-long, is reserved for information saved by called subprograms. Figure 6 shows an example of the use of this area in program Y, which is called by program X, and which calls program

z.

The first byte of the fifth word in the save area (Save Area of Y + 16) is set to all ones by program Z before i t returns to program Y. Before the return is made, all general registers are restored to their program Y values.

BAS~_TA~LE: The base table is a list of addresses from which the object module loads a general register prior to accessing data; the general register is then used as a base in the data referencing instruction.

Because an interval of 4096 bytes of storage can be referenced by means of the mach.ine instruction D field, consecutive values representing a single control sec- tion in this table differ from each other by at least 4096 bytes. Only one base table entry is constructed for an array which exceeds 4096 bytes in length; hence, there is a possibility that an interval of more than 4096 bytes exists between conse- cutive values for a single control section in the table.

The addresses compiled into this table are all relative, and are modified by the linkage editor prior to object module execution. Those entries constructed for references to COMMON are modified by the beginning address of the appropriate COMMON block; those entries constructed for references to variables and constants within the object module itself are modi- fied by the beginning address of the appro- priate object module.

Section 1: Introduction to the compiler 17

Références

Documents relatifs

Each component of the compiler creates a file that the next component uses as input (for example, the preprocessor creates an input file for the parser). Each component

Ordinarily if the u or v address field is blank the corresponding location counter is not altered. is equated to the values found in the location counters before

Names identify or reference data or procedures. A data name identifies a constant, variable, array, or array element. These data categories are defined and

The pointer contains all the information required to determine an absolute location in the roll storage area.. The t'wo types of drivers used by the compiler

The first reference to each unit number (i.e., data set reference number) by a direct access input/output operation within the FORTRAN load module causes

Note: Phase 12 generates intermediate text for nonsyntactical errors encountered in COMMON and EQUIVALENCE statements during relative address assignment. If the

The Pseudo-Code Phase converts the tri- ples to a form closely resembling machine instructions. in which registers are rep- resented symbolically., and storage

Diagram.. Phase ME Overall Logic Chart PA. Phase MG Overall Logic Chart PD. Phase MI Overall Logic Chart PH. Phase MK Overall Logic Chart PL. Phase ML Overall