Google
 

Trailing-Edge - PDP-10 Archives - BB-4157D-BM - sources/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) 1972,1977 BY DIGITAL EQUIPMENT CORPORATION
!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
	MERIT = 0,2,18,17$,
	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
		A2ARY=AR2ARY$;

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


%[V5]%!	FLAG .O IN SYMTAB AS CREATED WHEN .R REPLACED IN DOTORFIX

MACRO	ORFIXFLG  =  0,2,35,1$;		%[V5]%


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

MACRO	OMOVDCNS  =  0,2,34,1$;		%[V5]%

BIND EHSIZ=29;		!SIZE OF EXPRESSION (COMMON-SUB) FINDER

!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