Google
 

Trailing-Edge - PDP-10 Archives - BB-D480C-SB_1981 - p3r.bli
There are 12 other files named p3r.bli in the archive. Click here to see a list.
!THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
!  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

!COPYRIGHT (C) 1972,1981 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: S MURPHY/EGM

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 = 6^24 + 0^18 + 50;		! Version Date: 20-Jul-81

%(

***** 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.

***** 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 LSTLNK,FRSTLNK;
	EXTERNAL DOWDP;		!USED IN SUBSTITUTING REGCONTENTS NODES FOR REFS
				! TO A DO INDEX
	EXTERNAL ALLOCATE;

	EXTERNAL SEGINCORE,PHAZCONTROL;
	EXTERNAL ALCTEMP,ALCTMPS,ALCCON;
	EXTERNAL RELINIT,HISEGBLK,FORMPTR,DMPFORMAT;
	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

	%(***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];

	LSTLNK_0;	!THIS GLOBAL IS USED BY THE ROUTINE THAT 
			! GENERATES TEMPORARIES; IT POINTS TO THE LAST TEMPORARY
			! ON THE LINKED LIST OF TEMPS AND IS 0 IF THERE ARE NONE
	FRSTLNK_0;	!THIS GLOBAL POINTS TO THE FIRST TEMPORARY ON THE LINKED LIST
			! OF TEMPORARIES AND IS 0 IF THERE ARE NONE
	FNTMP_0;			!INIT FOR STATEMENT-FN ARG NAMES


	%(***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

	ALCTEMP();


	%(***NOW PERFORM STORAGE ALLOCATION FOR ALL TEMPORARIES AND CONSTANTS***)%
	IF .FLGREG<OBJECT>
	THEN
	ALCTMPS();

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

	IF .FLGREG<OBJECT>
	THEN
	BEGIN

		ALCCON();
		HISEGBLK();	!OUTPUT THE HISEG BLOCK IN REL FILE
				!TO TELL LOADER SIZE OF LOWSEG

		IF .FORMPTR NEQ 0 THEN DMPFORMAT();	!DUMP OUT THE FORMAT STRING DEFINITIONS  (IF ANY)
	END;


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