Google
 

Trailing-Edge - PDP-10 Archives - BB-D480F-SB_FORTRAN10_V10 - p3r.bli
There are 12 other files named p3r.bli in the archive. Click here to see a list.
!COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1972, 1985
!ALL RIGHTS RESERVED.
!
!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
!ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
!INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
!COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
!OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
!TRANSFERRED.
!
!THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
!AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
!CORPORATION.
!
!DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
!SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

!AUTHOR: S MURPHY/EGM/TFV/AHM

MODULE P3R(SREG=#17,VREG=#15,FREG=#16,DREGS=4,RESERVE(0,1,2,3),START) =
BEGIN

SWITCHES NOLIST;
REQUIRE FIRST.BLI;
REQUIRE TABLES.BLI;
SWITCHES LIST;

GLOBAL BIND P3RV = #10^24 + 0^18 + #2355;	! Version Date: 3-May-84

%(

***** Begin Revision History *****

49	-----	-----	CALL "DATPROC" EVEN IF NO REL FILE IS TO BE PRODUCED
			FOR PURPOSES OF ERROR DETECTION

***** Begin version 6 *****

50	1047	EGM	22-Jan-81	Q10-05325
	Add support for TOPS-10 execute only.

***** Begin Version 7 *****

51	1245	TFV	3-Aug-81	------
	Add code to MRP3R to generate HISEG character descriptors for
	character constants, scalars, and arrays

52	1406	TFV	27-Oct-81	------
	Call HSDDESC to output .Dnnnn variable compile-time-constant
	character descriptors to the HISEG.

53	1454	RVM	7-Jan-82
	Format allocation changed to work with the optimizer.  Change
	it here too.


***** Begin Version 10 *****

2210	AHM	27-Jul-83
	Rename DUMPFORMAT to DMPFORMAT to reserve DUMP?? for SIX12.

2334	AHM	5-Apr-84
	Under /EXTEND, allocate the object program's entry vector in
	the .DATA. psect before the call to HISEGBLK in MRP3R.

2355	AHM	3-May-84
	Use the symbol ENTAUXSIZE to allocate additional words after
	the /EXTEND entry vector.  The only auxiliary word for now is
	an EFIW for the reenter address.

***** End V10 Development *****

***** End Revision History *****

)%

%[1047]% PORTAL ROUTINE MRP3R =
BEGIN
%(***OVERLAY TO GO THRU THE WHOLE PROGRAM TWICE. ON THE FIRST PASS, PERFORM
	COMPLEXITY ANALYSIS, ON THE 2ND PASS, PERFORM REGISTER ALLOCATION
****)%
	EXTERNAL GBSYREGS,GBSYCT;	!GLOBALS INDICATING WHICH REGS ARE
	EXTERNAL RETNCT;	!CT OF "RETURN" STMNTS IN PROGRAM - MADE
				! IN COMPLEXITY
	EXTERNAL ASVCT;		!CT OF ASSIGNMENT STMNTS THAT DIRECTLY PRECEDE RETURN STMNTS
				! AND ASSIGN THE VAL OF THE (MADE IN COMPLEXITY)
					! AVAILABLE AFTER THE GLOBAL ALLOCATOR HAS
					! TAKEN THOSE THAT IT WILL USE
	EXTERNAL CSTMNT;
	EXTERNAL DATPROC;
	MAP BASE CSTMNT;



	EXTERNAL DOWDP;		!USED IN SUBSTITUTING REGCONTENTS NODES FOR REFS
				! TO A DO INDEX
	EXTERNAL ALLOCATE;

	EXTERNAL SEGINCORE,PHAZCONTROL;
%1245%	EXTERNAL ALCAVARS,ALCQVARS,ALCCON;
%1454%	EXTERNAL RELINIT,HISEGBLK,FORMPTR;
%2210%	EXTERNAL DMPFORMAT;		! Allocates and writes FORMATs
	EXTERNAL FNTMP;			!FOR STATEMENT FN ARG NAMES

	EXTERNAL INITREGCANDIDATES;	!ROUTINE TO INIT TABLE FOR 1ST PASS OF
					! BASIC BLOCK REG ALLOCATOR
	EXTERNAL CMPBLO;		!ROUTINE TO PERFORM 1ST PASS OF BASIC BLOCK REG
					! ALLOCATOR FOR A GIVEN BASIC BLOCK. CALLED WITH
					! "CSTMNT" POINTING TO THE 1ST STMNT OF
					! THE BLOCK, RETURNS WITH "CSTMNT" POINTING TO THE
					! 1ST STMNT OF THE NEXT BLOCK
	EXTERNAL INIRGSTATE;		!ROUTINE TO INIT TABLE FOR 2ND PASS OF
					! BASIC BLOCK ALLOCATOR
	EXTERNAL ALCBLO;		!ROUTINE TO PERFORM 2ND PASS OF BASIC BLOCK
					! ALLOCATOR FOR A GIVEN BLOCK. CALLED WITH "CSTMNT"
					! POINTING TO THE 1ST STMNT OF THE BLOCK. RETURNS
					! WITH CSTMNT POINTING TO THE 1ST STMNT OF THE NEXT BLOCK
	EXTERNAL NOBBREGSLOAD;	!FLAG WHICH IS SET WHILE PROCESSING NODES FOR
				! WHICH THE CODE WILL NOT ALWAYS BE EXECUTED WHEN
				! THE BLOCK CONTAINING THE NODE IS EXECUTED

				! (IE OF THE FN RETURN REG). THIS NODE WILL BE SUBSTITUTED
				! ON THE LHS OF ALL STMNT FNS

%1245%	EXTERNAL CHDECL;	! Flag for character declaration seen
%1245%	EXTERNAL HILOC;		! Current high seg break
%1245%	EXTERNAL LOWLOC;	! Current low seg break
%2334%	EXTERNAL ENTADDR;	! Object address of entry vector
%1245%	EXTERNAL HSLITD;	! Routine to generate high seg descriptors for
				! character constants
%1245%	EXTERNAL HSCHD;		! Routine to generate high seg descriptors for
				! character scalars and arrays
%1406%	EXTERNAL HSDDESC;	! Routine to generate high seg descriptors for
				! .Dnnnn compile-time-constant character
				! descriptors
%1245%	EXTERNAL HDRFLG;	! Flag for heading has been output
%1245%	EXTERNAL TCNT;		! Count of temporaries on a line

	%(***INIT REL FILE (IF ONE IS TO BE GENERATED)***)%
	IF .FLGREG<OBJECT> THEN RELINIT();


	%(***PERFORM STORAGE ALLOCATION FOR ALL VARIABLES AND ARRAYS***)%
	ALLOCATE();


	GBSYREGS_#177760000000;			!12 REGS (2-15) ARE AVAILABLE
	GBSYCT_12;

	CSTMNT_.SORCPTR<LEFT>;			!PTR TO 1ST STMNT OF PROGRAM

	%(***SKIP 1ST STMNT OF PROGRAM - WHICH IS A DUMMY CONTINUE***)%
	IF .CSTMNT NEQ 0
	THEN
	CSTMNT_.CSTMNT[SRCLINK];



	%(***INIT GLOBAL USED BY THE ROUTINE THAT SUBSTITUTES REGCONTENTS NODES
		FOR REFS TO A DO INDEX THAT LIVES IN A REGISTER***)%
	DOWDP_0;

	%(***INIT FLAG FOR "THIS PROGRAM INCLUDES ARITH EXPRS
		THAT MUST BE EVALUATED BYMEANS OF LIBRARY ROUTINES***)%
	LIBARITHFLG_FALSE;


	%(***INIT COUNTS THAT ARE KEPT OF THE NUMBER OF RETURN STMNTS IN THE PROGRAM AND OF
		THE NUMBER OF PLACES THAT THE FN VAL IS ASSIGNED DIRECTLY BEFORE A "RETURN"**)%
	RETNCT_0;
	ASVCT_0;


	%(***PERFORM 1ST PASS OF BASIC BLOCK REG ALLOCATOR (AND "COMPLEXITY" PASS OF
		LOCAL REG ALLOCATOR) ***)%
	INITREGCANDIDATES();	!INIT TABLE USED BY 1ST PASS OF BB ALLOCATOR
	WHILE .CSTMNT NEQ 0	!UNTIL REACH END OF PROGRAM
	DO
	CMPBLO();		!WALK THRU EACH BASIC BLOCK


	%(***PERFORM 2ND PASS OF BASIC BLOCK REG ALLOCATOR***)%
	CSTMNT_.SORCPTR<LEFT>;	!PTR TO 1ST STMNT OF PROGRAM
	IF .CSTMNT NEQ 0	!SKIP THE DUMMY CONTINUE AT START OF PROGRAM
	THEN CSTMNT_.CSTMNT[SRCLINK];

	NOBBREGSLOAD_FALSE;	!INITIALIZE FLAG THAT WILL BE SET TO TRUE WHILE
				! PROCESSING NODES WHICH WILL NOT ALWAYS BE EVALUATED
				! WHEN THE BLOCK CONTAINING THEM IS EVALUATED (EG NODES
				! UNDER THE STMNT UNDER A LOGICAL IF, UNDER A CONTROL BOOLEAN,..)
	INIRGSTATE();	!INIT THE TABLE THAT REPRESENTS THE CONTENTS OF THE REGISTERS

	WHILE .CSTMNT NEQ 0	!WALK THRU ALL  BLOCKS UNTIL REACH THE END OF PROGRAM
	DO
	ALCBLO();	!PERFORM 2ND BASIC-BLOCK ALLOCATOR PASS FOR THIS BLOCK

	!ALLOCATE SYMBOL TABLE ENTRIES FOR THE TEMPS
	!NECESSARY FOR SAVE-RESTORE. THIS DEPENDS ON
	!CLOBBREGS SO CANNOT BE DONE TIL NOW

%1245%	HDRFLG _ 0;	! Heading not output yet
%1245%	TCNT = 0;
%1245%	ALCAVARS();


	%(***NOW PERFORM STORAGE ALLOCATION FOR ALL TEMPORARIES AND CONSTANTS***)%
%1245%	ALCQVARS();

	%(***OUTPUT LOADER BLOCKS FOR DATA STATEMENTS. MUST
		DO THIS HERE BEFORE CONSTANTS ARE ROUNDED BACK TO SINGLE
		PREC OR TO KA10 FORMAT***)%
	DATPROC();

%1245%	ALCCON();

	! Dump the format statements into the .REL file if there are some

%1454%	IF .FORMPTR NEQ 0
%2210%	THEN DMPFORMAT();

%2334%	IF EXTENDED AND .FLGREG<OBJECT> AND .FLGREG<PROGTYP> EQL MAPROG
%2334%	THEN
%2334%	BEGIN	! EXTENDED MAIN PROGRAM
%2334%		ENTADDR = .LOWLOC;	! Save address of entry vector
%2355%		LOWLOC = .LOWLOC+ENTVECSIZE+ENTAUXSIZE;	! Allocate space for it
%2334%	END;	! EXTENDED MAIN PROGRAM

	HISEGBLK();	! Output the hiseg block in .REL file
			! to tell loader size of lowseg

%1245%	! Output high seg descriptors for character constants

%1245%	HDRFLG _ 0;	! Heading not output yet
%1245%	HSLITD();

%1245%	! Output high seg descriptors for character scalars and arrays
%1245%	! If we had character declarations in FORTB

%1245%	IF .CHDECL EQL -1 THEN HSCHD();

%1406%	! Output high seg descriptors for .Dnnnn compile-time-constant
%1406%	! character descriptors

%1406%	HSDDESC();

END;	! of MRP3R

MACHOP POPJ=#263;
MRP3R();
POPJ(#17,0)
END ELUDOM