Google
 

Trailing-Edge - PDP-10 Archives - BB-4157F-BM_1983 - fortran/compiler/optmac.bli
There are 12 other files named optmac.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) DIGITAL EQUIPMENT CORPORATION 1972, 1983
! Author: *

GLOBAL BIND OPTMAV = 6^24 + 0^18 + 3;	! Version Date:	21-Jul-81

%(

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

***** Begin Version 5B *****

1	660	11427	ADD USRFNUSE BIT TO VARIABLE S.T. ENTRY, (DCE)
2	700	NONE	REMOVE EHSIZ DECLARATION (MOVED TO FIRST.BLI
			BY EDIT 674), (DCE)
3	725	27403	ADD HSTMNT FIELD TO HASH TABLE ENTRY, (DCE)

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

)%

!THIS FILE CONTAINS MACRO AND FIELD DEFINITIONS FOR THE
!OPTIMIZER. ALL OPTIMIZER MODULES ARE COMPILED WITH OPTMAC.BLI
!IMMEDIATELY FOLLOWING TABLES. THE CODE GENERATION MODULE CGDO
!IS ALSO COMPILED WITH THIS MODULE (SINCE CGDO USED THE MAKNAME MACRO).

!THIS MACRO DEFINES THE FIELDS IN THE 5 ADDITIONAL WORDS
!THE OPTIMIZER ALLOCATES FOR THE OPTIMIZATION OF EACH STATEMENT

MACRO
	PREDPTR=1,0,LEFT$,	!POINTER TO LIST OF IMMEDIATE PREDECESSORS
	SUCPTR=1,0,RIGHT$,	!POINTER TO LIST OF IMMEDIATE SUCCESSORS
	BUSY=1,1,LEFT$,		!LIST OF ALL STATEMENTS IN THE LOOP
				!IN MOORE FLOOD ORDER. THE NAME
				!IS DERIVED FROM THE DOCUMENTATION
				!#100-310-081-01 WHICH CALLS THIS LIST
				!THE BUSY LIST.
	LEVEL=1,1,RIGHT$,	!MOORE FLOOD LEVEL (USED IN BOTH PREDOMINATOR
				!AND POSTDOMINATOR ALGORITHMS
	POSTDOM=1,2,LEFT$,	!FIELD POINTS TO THE IMMEDIATE POSTDOMINATOR
				! OF THIS STATEMENT
	PREDOM=1,2,RIGHT$,	!FIELD POINTS TO THE IMMEDIATE
				!PREDOMINATOR OF THIS STATEMENT
	ACC=1,3,FULL$,		!WORD HOLDS BIT MASK FOR DEFINITION POINT
	CSDONE=1,3,0,1$,	!FLAG TO HELP ORDERING FOR BB COMMON SUBS
				!ALGORITHM
	EXTLST=1,4,LEFT$,	!POINTER TO LINKED LIST OF LOOP EXITS(EXCLUDING FULLFILLMENT
				!FOR A DO LOOP
	DOCHNGL=1,4,RIGHT$,	!LIST OF VARS CHANGEDIN THIS LOOP
	OPDEF=1,4,RIGHT$;	!DEFINITION POINT OF SINGLE DATAOPR STMNT
!MACROS THAT HELP DEFINE THE LINKED LIST STRUCTURE FOR
!THE BUILDING OF THE DIRECTED GRAPH
MACRO
	PREDES=LEFT$,		!PREDECESSOR
	PREDLNK = RIGHT$,	!LINK TO NEXT PREDECESSOR
	SUCC = LEFT$,		!SUCCESSOR
	SUCLNK=RIGHT$;		!LINK TO NEXT SUCCESSOR


!THE PICTURE DEPICTS THE FIELDS DESCRIBED IN THE ABOVE MACRO
!
!THIS MACRO IS USED TO ACCESS THE FIELDS OF THE GRAPH THROUGH
!THE STRUCTURE PHAZ2, THUS GIVING THE ADDITIONAL INDIRECT
!
MACRO
CESSOR = 0,0,LEFT$,		!POINTER TO SUCCESSOR OR PREDECESSOR
CESLNK = 0,0,RIGHT$;		!POINTER TO LINK PART OF GRAPH LIST
!
!	*********************************************
!	*                     *                     *
!	*       PREDPTR       *       SUCPTR        *
!	*                     *                     *
!	*********************************************
!	*                     *                     *
!	*  BUSY     	      *  LEVEL       	    * 
!	* 		      *			    *
!	*********************************************
!	*		      *			    *
!	*     POSTDOM         *       PREDOM        *
!	*		      *			    *
!	*********************************************
!	*					    *
!	*		     ACC		    *
!	*					    *
!	*********************************************
!	*					    *
!	*  EXTLST             *   DOCHNGL           *
!	*					    *
!	*********************************************

STRUCTURE PHAZ2[CS,WD,POS,SIZ]=
	CASE .CS OF SET
	%0%	(@.PHAZ2+.WD)<.POS,.SIZ>;
	%1%	((.(@.PHAZ2+2)<0,18>)+.WD)<.POS,.SIZ>
	TES;



!FIELDS OF AN EXPRESSION NODE USED TO HOLD THE DEFINITION POINT
!OF THE ARGUMENTS
MACRO
	DEFPT1 = 0,2,LEFT$,
	DEFPT2=0,0,LEFT$;		!
!FIELD OF SYMBOL TABLES ENTRY USED TO COMPUTE THE MERIT OF
!A VARIABLE BY THE REGISTER ALLOCATOR

MACRO
![660] ADD USRFNUSE BIT WHICH INDICATES VAR CANNOT LIVE IN REG
![660] DUE TO ITS USAGE AS PARAMETER TO FN INSIDE IF STATEMENT
%[660]%	MERIT = 0,2,18,16$,
%[660]%	USRARGUSE=0,2,34,1$,
	LIBARGUSE=0,2,35,1$;	!USED AS LIBRARY FUNCTION ARG

!MACRO DEFINING FIELDS IN THE COMMON SUB-EXPRESSION HASH TABLE
!ENTRY. THE ENTRY IS PICTURED IN THE COMSUB MODULE,
MACRO
		LKER =	0,4,RIGHT$,	!POINTER BACK TO FIRST EXPRESSION
		USECNT = 0,0,LEFT$,	!USECNT OF HASHED EXPR
		TEMPER=0,4,LEFT$,	!GLOBAL CASE:
					!	POINTER TO TEMP SYMBOL
					!LOCAL CASE
					!	POINTER TO CMNSUB EXPR
		EMPTY = 0,1,35,1$,	!BIT SET MEANS ENTRY NO IN USE
		BLKID = 0,1,18,17$,	!BLOCK NUMBER OR LOOP NUMBER
		HOP =	0,1,RIGHT$,	!HASH OPERATOR
		HA1 =	0,2,LEFT$,	!HASH ARGUMENT ONE
		HA2 =	0,2,RIGHT$,	!HASH ARGUMENT TWO
		HDEF1 = 0,3,LEFT$,	!DEFINITION POINT OF ARG ONE
		HDEF2 =	0,3,RIGHT$,	!DEFINITION POINT OF ARG 2
		STPT = 0,5,RIGHT$,	!MOTION PLACE
		!FLAG INDICATED THE THE FIRST EXPR HASHED NEEDS
		!A NEGATE NODE IN FRONT OF IT. (A-B==B-A)
		NEDSANEG=0,5,20,1$,
		!INDICATES THAT OTHER COMMON SUB-EXPRS ARE SUB-EXPRS OF
		!THIS EXPR
		CMNUNDER = 0,5,21,1$,
		STANALON= 0,5,22,1$,	!STAND ALONE COMNSUB
		CMNFLGS=0,5,LEFT$,	!FLAGS FIELD ALL TOGETHER
		MOVDCNS=0,5,23,1$,	!THE EXPRESSION MOVED
					!AS A CONSTANT COMPUTATION
		NBRCH = 0,5,19,1$,	!FIRST EXPR HASHED WAS NARY
		AR1ARY=0,5,24,1$,	!ARG 1 IS AN ARRAYREF
		A1ARY=AR1ARY$,

		AR2ARY=0,5,25,1$,	!ARG 2 IS AN ARRAYREF
%[725]%		A2ARY=AR2ARY$,
%[725]%		HSTMNT=0,6,LEFT$,	!PTR TO STATEMENT FROM WHICH
%[725]%					!THE FIRST EXPRESSION CAME
%[725]%		HSHSIZ=7$;		!SIZE OF HASH ENTRY

%EXPRESSION  USE COUNT  KEEP FOR DETERMINING SUBORDINATE/DOMINATE
EXPRESSIONS FOR COMMON SUB-EXPRESSIONS%
MACRO	EXPRUSE =0,2,18,16$;


!	FLAG .O IN SYMTAB AS CREATED WHEN .R REPLACED IN DOTORFIX

MACRO	ORFIXFLG  =  0,2,35,1$;


!	FLAG .O IN SYMTAB AS EXPR MOVED AS CONSTANT (MOVDCNS IN
!	  HASH TBL) FOR GLOBDEPD

MACRO	OMOVDCNS  =  0,2,34,1$;


!USED IN COMMON SUB - EXPRESSION ELIMINATION
BIND
	UNARY=0,	!UNARY SHAPED TREE (ONLY ONE ARG (EX:NEGNOT))
	STGHT=1,	!REGULAR BINARY SHAPED TREE
	!THE NEXT TWO ARE THE SAME AND ARE USED TO INDICATED A SKEWED
	!TREE (OR NARY TREE)
	SKEW=2,
	PSKEW=2,

	!FOR ARRAY REFERENCES AS COMMON SUBS

	!STRAIGHT NODE WITH ARRAYREF AS ARG 1
	STAR1=3,

	!STRAIGHT NODE WITH ARRAYREF AS ARG 2
	STAR2=4,

	!SKEWED NODE WITH ARRAYREF AS ARG1
	SKAR1=5,

	!SKEWED NODE WITH ARRAYREF AS ARG 2
	SKAR2=6,

	!FUNCTION REFERENCE WITH ARRAYREFERENCE AS SINGLE ARGUMENT
	FNARY=7;



%*****
	TAKES A NUMBER AND CREATES 4 SIXBIT DIGITS
	USED TO GENERATE TEMPORARY AND LABEL NAMES
*****%

MACRO MAKNAME(NUMB)=
	(.NUMB<9,3>+16)^18 + (.NUMB<6,3>+16)^12 + (.NUMB<3,3>+16)^6
	+ (.NUMB<0,3>+16)$;


!MACRO TO LOOK AT THE FIRST TWO CHARACTERS OF A SYMBOL NAME
!USED TO CHECK IF IT BEGINS WITH A ".O" (COMMON SUB SYMBOL).

MACRO IDDOTO=0,3,24,12$;

!MACRO DEFINING A FIELD OF A CONTINUE STATEMENT NODE USED BY THE OPTIMIZER

	MACRO OPTINFO=CW3R$;

!REFERENCES TO LOCAL LABELS ARE COUNTED IN THE GRAPHING PROCESS. 


MACRO
	LREFCNT=SN1STLAB$;

!LOOP EXITS ARE LINKED TOGETHER DURING THE GRAAPHING PROCESS. THIS
!LINKED LIST LOOKS LIKE:

!-------------------------------------!
!  ELBL            !    CLINK         !
!-------------------------------------!

!MACROS THAT DEFINE THESE FIELDS ARE:

MACRO
	ELBL=0,0,LEFT$;

!MACROES TO HELP GLOBAL ALLOCATION. THE SETUP IS DEFINED WITH THE
!REST OF THE CODES IN THE FRONT OF PH3G
MACRO
	ALCFLGS=32,4$,
	ALCFLG=ALCFLGS$,
	RESTOAR=8$;

!************************************************
!MACRO TESTS ALL PROPERTIES NECESSARY FOR A STRENGTH REDUCTION
!THESE PROPERTIES MAY BE CHANGED TO DO MORE SOPHISTICATED
!REDUCTIONS IN THE FUTURE.

MACRO REDUCOP(ANODE)=
	IF .ANODE[A1VALFLG] AND .ANODE[A2VALFLG] THEN
		IF .ANODE[VALTP1] EQL INTEG1 THEN
			IF .ANODE[OPR1] EQL MULOPF THEN
				1
		ELSE
	0$;
!***************************************************


!DEFINE FLAGS IN GLOBAL IOPTFLGS


EXTERNAL IOPTFLG;
!DEFINE CNSMOVFLG
!SET DURING ITERATION ON MOVCNST TO PREVENT CHKDOM FROM LOOKING
!FOR A MOTION PLACE. IT IS BY DEFINITION LENTRY
MACRO CNSMOVFLG=IOPTFLG<1,1>$;
!DEFINE IMPLDO
!SET DURING I/O OPTIMIZATIONS
MACRO IMPLDO=IOPTFLG<0,1>$;
!DEFINE NOINDVARFLG
!SET DURING GLOBAL ALLOCATION TO STOP BOGUS SUBSTITUTION
MACRO NOINDVARFLG=IOPTFLG<3,1>$;

!DEFINE G CALLS L FLAG FOR GLOBAL OPTIMIZER CALLING LOCAL ELIMINATOR
MACRO GCALLSLFLG=IOPTFLG<2,1>$;

!DEFINE FLAG SET WHEN DOING ARRAY REFERENCE COMMON SUB PROCESSING
MACRO ARREFCMNSBFLG=IOPTFLG<4,1>$;

!DEFINE FLAG TO PREVENT ARRAY REF BITS FROM BEING SET ON THE WRONG HASH
!ENTRY. THIS CAN HAPPEN IN THE CIRCUMSTANCE THAT AN ARRAYREF MATCH
!OCCURS AND CAUSES ANOTHER ENTRY TO ALSO BE MADE IN THE HAS TABLE
!(THRU NEXTUP)
MACRO NOHHASSLE=IOPTFLG<5,1>$;

!DEFINE FLAG TO STOP REDUCTION ATTEMPTS WHILE PROPAGATING .O VARIABLES
MACRO DOTOHFLG=IOPTFLG<6,1>$;

!DEFINE FLAG THAT GLOBALLY ALLOCATING DOUBLE PRECISION VARS
MACRO GOTEMDBL=IOPTFLG<7,1>$;

!DEFINE FLAG FOR GLOBAL ALLOCATOR THAT SAYS ALLOCATED VARS ARE
!ALREADY SAFELY TUCKED AWAY IN CORE AND THERE IS NOT NEED TO
!DO IT AGAIN
MACRO SAVEDFLG=IOPTFLG<8,1>$;

!DEFINE FLAG FOR GLOBAL ALLOCATOR THAT SAYS WE ARE SUBSTITUTING
!REGCONTENTS NODES IN THE FIRST BASIC BLOCK OF THE 
!SUNSTITUTION DOMAIN
MACRO FRSTBB=IOPTFLG<9,1>$;
!DEFINE FLAG USED BY GETPRELOAD ON A DOUBLE NESTED ALLOCATION TO
!INDICATE THAT WE ARE SUBSTITUTING REGCONTENTS NODES IN THE BASIS
!BLOCK IN FRONT OF THE LENTRY STATEMENT FOR THE OUTER LOOP
MACRO ASGN4LENTRY=IOPTFLG<10,1>$;


!	FLAG SECOND CALL TO GLOBELIM SO WARNINGS DON'T PRINT TWICE

MACRO	GLOBELIM2  =  IOPTFLG<11,1>$;



!TWO MACROS TO FUNGE UP EXPRESSION NODES DURING ARRAY REFERENCE COMMON
!SUB PROCESSING
MACRO FUDGA1=
BEGIN
	CNODE[ARG1PTR]_.PHI;
	CNODE[DEFPT1]_.PHI[STPT];
END$;

MACRO FUDGA2=
BEGIN
	CNODE[ARG2PTR]_.PHI;
	CNODE[DEFPT2]_.PHI[STPT];
END$;

!MACROS TO HELP TEST FOR "OPTIMIZER CREATED" PROPERTIES

MACRO OPTMP(NOD)=
	.NOD[OPRCLS] EQL DATAOPR AND .NOD[IDDOTO] EQL SIXBIT".O"$;


MACRO OPTCMN(NOD)=
BEGIN
	REGISTER BASE TMP;
	IF .NOD[OPRCLS] EQL STATEMENT THEN
	IF .NOD[SRCISN] EQL 0 AND.NOD[SRCID] EQL ASGNID THEN
	BEGIN
		TMP_.NOD[LHEXP];
		IF NOT .PAE[A2VALFLG] AND OPTMP(TMP) THEN
			1
		ELSE
			0
	END ELSE
		0
END$;

	!SIZE OF ENTRIES ON THE UNIQUE VALUE LIST AND THE
	!CHANGED IN THIS LOOP LIST

	BIND UNIQSIZ=2;
	BIND CHNGSIZ=1;

!MACRO FIELD OF UNIQUE VALUE LIST
MACRO OPTISNVAL=0,1,RIGHT$;


!MACROS TO GET AND RELEASE DYNAMIC GRAPH ELEMENTS
BIND GRAPHELMSIZ=1;

MACRO GETGRAPHELM=
(
	NAME<LEFT>_GRAPHELMSIZ;
	CORMAN()
)$;


MACRO RELSGRAPHELM(NOD)=
BEGIN
	REGISTER BASE GP:NGP;
	GP_.NOD[PREDPTR];
	WHILE .GP[CESLNK] NEQ 0 DO
	BEGIN
		NGP_.GP[CESLNK];
		SAVSPACE(GRAPHELMSIZ-1,.GP);
		GP_.NGP;
	END;

	GP_.NOD[SUCPTR];

	WHILE .GP[CESLNK] NEQ 0 DO
	BEGIN
		NGP_.GP[CESLNK];
		SAVSPACE(GRAPHELMSIZ-1,.GP);
		GP_.NGP;
	END;
END$;

!********************
!EXTERNAL DEFINITIONS FOR ERROR NUMBERS

EXTERNAL E78,E79,E63,E62,E37,E100,E105;