Trailing-Edge
-
PDP-10 Archives
-
BB-D480F-SB_FORTRAN10_V10
-
optmac.bli
There are 12 other files named optmac.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: */DCE/CDM/TJK
GLOBAL BIND OPTMAV = #10^24 + 0^18 + #2371; ! Version Date: 14-Jun-84
%(
***** 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 V6 Development *****
1747 CDM 4-May-83
Add pretty pictures for STAR1, SKAR1, STAR2, SKAR2. (No code
changed.)
***** Begin Version 10 *****
2207 CDM 21-Jul-83
Add comments to Common/Equivalence code. Moved macros MERIT,
USRARGUSE, LIBARGUSE, ORFIXFLG, OMOVDCNS from OPTMAC to FIRST.
They overlap IDADDR for code /OPT. Moved IDDOTO which overlaps
IDSYMBOL. It is in poor taste to hide overlaps of fields in
another module!!
2371 TJK 14-Jun-84
Move defintions of DEFPT1 and DEFPT2 from OPTMAC to TABLES.
Also add definition of DEFPTSS, used to hold definition points
for substrings. These are all in TABLES to avoid hiding
overlapping fields.
***** End V10 Development *****
***** End Revision History *****
)%
!***********************************************************************
! This file contains macro and field definitions for the optimizer. All
! optimizer modules are compiled REQUIRE-ing OPTMAC.BLI immediately
! after TABLES. The code generation module CGDO is also compiled with
! this module (since cgdo uses the MAKNAME macro).
!***********************************************************************
!THIS MACRO DEFINES THE FIELDS IN THE 5 ADDITIONAL WORDS
!THE OPTIMIZER ALLOCATES FOR THE OPTIMIZATION OF EACH STATEMENT
! For each statement, the predecessor list is pointed to by
! PREDPTR and terminated by RGRAPH, and the successor list is
! pointed to by SUCPTR and terminated by FGRAPH. RGRAPH and
! FGRAPH are both one-word OWNs contained in GLOBAL, and both
! always contain zero.
! Each link in the predecessor and successor chains is one
! word long. The left half (CESSOR) contains a pointer to the
! predecessor or successor, and the right half (CESLNK)
! contains a pointer to the next link in the chain (to those
! familiar with LISP, these are equivalent to CONS cells).
! *********************************************
! * PREDPTR * SUCPTR *
! *********************************************
! * BUSY * LEVEL *
! *********************************************
! * POSTDOM * PREDOM *
! *********************************************
! * ACC *
! *********************************************
! * EXTLST * DOCHNGL *
! *********************************************
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
!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
!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
STRUCTURE PHAZ2[CS,WD,POS,SIZ]=
CASE .CS OF SET
%0% (@.PHAZ2+.WD)<.POS,.SIZ>;
%1% ((.(@.PHAZ2+2)<0,18>)+.WD)<.POS,.SIZ>
TES;
!***********************************************************************
! Macro defining fields in the common sub-expression hash table entry.
! (The entry is pictured in the comsub module)
!***********************************************************************
! ---------------------------------
! 0 | USECNT | CLINK |
! ---------------------------------
! 1 | BLKID | HOP |
! ---------------------------------
! 2 | HA1 | HA2 |
! ---------------------------------
! 3 | HDEF1 | HDEF2 |
! ---------------------------------
! 4 | TEMPER | LKER |
! ---------------------------------
! 5 | flags | STPT |
! ---------------------------------
! 6 | HSTMNT | |
! ---------------------------------
! Note: first bit of blkid is 1 if block deleted
MACRO
USECNT = 0,0,LEFT$, !USECNT OF HASHED EXPR
EMPTY = 0,1,35,1$, !BIT SET MEANS ENTRY NOT 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
TEMPER=0,4,LEFT$, !GLOBAL CASE:
! POINTER TO TEMP SYMBOL
!LOCAL CASE
! POINTER TO CMNSUB EXPR
LKER = 0,4,RIGHT$, !POINTER BACK TO FIRST EXPRESSION
STPT = 0,5,RIGHT$, !MOTION PLACE
NEDSANEG=0,5,20,1$, !FLAG INDICATED THE THE FIRST EXPR
! HASHED NEEDS A NEGATE NODE IN FRONT
! OF IT. (A-B==B-A)
CMNUNDER = 0,5,21,1$, !INDICATES THAT OTHER COMMON SUB-EXPRS
! ARE SUB-EXPRS OF THIS EXPR
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$;
!************************************************************************
!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
!***************************************************************
STAR1=3, !Straight node with arrayref as arg 1
! OP
! / \
! ARREF DATAOPR
STAR2=4, !Straight node with arrayref as arg 2
! OP
! / \
! DATAOPR ARRAYREF
SKAR1=5, !Skewed node with arrayref as arg 1
! OP
! / \
! OP DATAOPR
! / \
! ARREF
SKAR2=6, !Skewed node with arrayref as arg 2
! OP
! / \
! OP ARRAYREF
! / \
! DATAOPR
FNARY=7; !Function reference with array reference as single
! argument
%*****
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 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 GRAPHING PROCESS. THIS
!LINKED LIST LOOKS LIKE:
!-------------------------------------!
! ELBL ! CLINK !
!-------------------------------------!
!MACROS THAT DEFINE THESE FIELDS ARE:
MACRO
ELBL=0,0,LEFT$;
!MACROS 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;