Trailing-Edge
-
PDP-10 Archives
-
decuslib10-04
-
43,50325/try.bli
There are no other files named try.bli in the archive.
! File: TRY.BLI
!
! This work was supported by the Advanced Research
! Projects Agency of the Office of the Secretary of
! Defense (F44620-73-C-0074) and is monitored by the
! Air Force Office of Scientific Research.
MODULE TRY(TIMER=EXTERNAL(SIX12),GLOROUTINES)=
BEGIN
REQUIRE COMMON.BEG;
REQUIRE GTST.BEG;
REQUIRE GTX.BEG;
REQUIRE LDSF1.BEG;
REQUIRE FLOW.BEG;
REQUIRE TN.BEG;
BEGIN
REQUIRE TRY.BEG;
BIND REGTOOCROWD = 99; ! FROM ERROR.BEG
EXTERNAL ERRINFO,WARNEM;
EXTERNAL GETTN;
MACRO CONTINUE=EXITBLOCK$;
! 2. - FITTING
!
! THESE ROUTINES DETERMINE WHETHER IT IS POSSIBLE
! TO PLACE A PARTICULAR TN INTO A PARTICULAR
! LOCATION (REGISTER OR WHATEVER). THE TN'S ALREADY
! ASSIGNED TO A LOCATION ARE REPRESENTED BY A TN-REP
! LIST ASSOCIATED WITH THAT LOCATION. THE 'LIFE SPAN'
! INFO DETERMINED BY THE TL ROUTINES IS USED TO
! DETERMINE THE POSSIBILITY OF FITTING THE TN INTO
! THE LOCATION.
!
ROUTINE TRYFIT(TN,LST)=
BEGIN
MACRO SAVEQ=Q_.TR$,
OVERLAPFON=
(((.T[FONFU]-.TN[FONLU])*(.TN[FONFU]-.T[FONLU])) GEQ 0)$;
MAP GTVEC TN, TNREPR LST;
LOCAL GTVEC T;
REGISTER Q;
FORALLTN(T,.LST,
BEGIN
BIND ZQZQ=45;
IF .T[LONLU] LSS .TN[LONFU] THEN (SAVEQ;EXITBLOCK);
IF .T[LONFU] GTR .TN[LONLU] THEN
(LINK(TNREP(.TN),.Q);NOTEBOUND(TN,.LST);SUCCESS);
IF OVERLAPFON THEN
IF (.T[TNPERMIT] NEQ .TN) AND (.T NEQ .TN[TNPERMIT]) THEN FAIL;
IF .T[LONFU] LSS .TN[LONFU] THEN SAVEQ;
END)
END;
! 3. - OPENING
!
! THESE ROUTINES ALLOW 'OPENING' AND CLOSING
! LOCATIONS. NOTE THAT CLOSING IS ACCOMPLISHED
! BY MAKING IT APPEAR THAT THE LOCATION IS 'IN-USE'
! OVER AN INFINITE LIFE SPAN.
!
ROUTINE OPENLIST(L)=
BEGIN
MAP TNREPR L;
LOCAL GTVEC BF:BT;
BF_GETTN();
BT_GETTN();
BF[LONFU]_BF[LONLU]_BF[FONFU]_BT[FONFU]_GENESIS;
BT[LONLU]_BT[LONFU]_BF[FONLU]_BT[FONLU]_ETERNITY;
BF[REQD]_BT[REQD]_IGREQDB; ! THESE ARE DUMMY TNS
LINK(TNREP(.BF),.L[LLINK]);
LINK(TNREP(.BT),.L[LLINK])
END;
ROUTINE CLOSELIST(LST,WHEN)=
BEGIN
MAP TNREPR LST;
LOCAL GTVEC L;
LST_.LST[LLINK];
L_.LST[TNPTR];
IF .L[LONFU] GTR .WHEN THEN L[LONFU]_.WHEN;
! IF .L[FONFU] GTR .FON THEN L[FONFU]_.FON;
NOVALUE
END;
ROUTINE REOPEN(LST,ATLON,ATFON)=
BEGIN
MAP TNREPR LST;
LOCAL GTVEC L;
IF NOT ISOPEN(.LST[TNLINKWORD]) THEN
(OPENLIST(.LST); CLOSELIST(.LST,1));
LST_.LST[LLINK];
L_.LST[TNPTR];
L[LONLU]_IF .L[LONFU] LSS .ATLON THEN .ATLON-1 ELSE .L[LONFU];
! L[FONLU]_IF .L[FONFU] LSS .ATFON THEN .ATFON-1 ELSE .L[FONFU];
L_GETTN();
L[REQD]_IGREQDB; ! DUMMY TN
L[LONLU]_L[FONLU]_L[LONFU]_ETERNITY;
L[FONFU]_GENESIS;
LINK(TNREP(.L),.LST)
END;
!
! THE FOLLOWING SECTIONS, B-D, DEFINE THE PRIMITIVES
! FOR VARIOUS TYPES OF LOCATIONS WHICH MAY BE USED TO
! HOLD TEMP RESULTS.
!
!
!
!
!
! B. - REGISTERS
! ------------------------------------------------
ROUTINE ISREGLST(LST)=
BEGIN
LST<LEFTPART>_0;
IF .LST GEQ REGS[0]<0,0>
THEN IF .LST LEQ REGS[5]<0,0>
THEN RETURN 1;
0
END;
ROUTINE TRYSPREG(T,R)=
BEGIN
! ASSIGN T TO THE SPECIFIC REGISTER R.
IF NOT (ISOPEN(.REGS[.R])) THEN OPENREG(.R);
IF NOT TRYFIT(.T,REGS[.R]<0,0>) THEN
(MAP GTVEC T;
ERRINFO[0]_.R;
WARNEM(0,REGTOOCROWD);
T[BNDLSTHDR]_REGS[.R]<0,0>;
MARKTN(.T,BNDREG);
T[REGF]_.R)
END;
ROUTINE TRYOPREG(T)=
BEGIN
! TRY THE OPEN REGISTERS
DECR I FROM 5 TO 0 DO
IF ISOPEN(.REGS[.I]) THEN
IF NOT .RESERVED[.I,1] THEN
IF TRYFIT(.T,REGS[.I]<0,0>) THEN SUCCESS;
FAIL
END;
ROUTINE TRYCLREG(T)=
BEGIN
! TRY TO OPEN A REGISTER
INCR I FROM 0 TO 5 DO
IF NOT (ISOPEN(.REGS[.I])) THEN
IF NOT .RESERVED[.I,1] THEN
(OPENREG(.I); IF TRYFIT(.T,REGS[.I]<0,0>) THEN SUCCESS);
FAIL
END;
! C. - STATIC TEMPS
! ------------------------------------------------
ROUTINE TRYOPSTEMPS(T)=
BEGIN
! TRY THE OPEN STATIC TEMPS
INCR I FROM 0 TO .STEMPS[CURD] DO
IF TRYFIT(.T,STEMPS[LSELEM(.I)]<0,0>) THEN SUCCESS;
FAIL
END;
ROUTINE TRYCLSTEMPS(T)=
BEGIN
! OPEN A NEW STATIC TEMP
PUSHSTK(STEMPS);
OPENLIST(STEMPS[TOS]);
TRYFIT(.T,STEMPS[TOS]<0,0>) ! NOTE THIS WILL (SHOULD) ALWAYS WORK
END;
! D. - DYNAMIC TEMPS
! ------------------------------------------------
ROUTINE TRYSPDYTEMP(T,N)=
BEGIN
IF .N LSS 0 OR .N GTR .DTEMPS[CURD] THEN FAIL
ELSE TRYFIT(.T,DTEMPS[LSELEM(.N)]<0,0>)
END;
ROUTINE OPENDYTEMP(T,OLON,OFON)=
BEGIN
MAP GTVEC T;
IF (DTEMPS[CURD]_.DTEMPS[CURD]+1) GTR .DTEMPS[MAXD] THEN
(DTEMPS[MAXD]_.DTEMPS[CURD]; NULLLST(DTEMPS[TOS]));
REOPEN(DTEMPS[TOS],.OLON,.OFON);
TRYFIT(.T,DTEMPS[TOS]<0,0>);
MARKTN(T,BNDPUSH)
END;
ROUTINE CLOSEDYTEMPS(TOO)=
BEGIN
IF .TOO GEQ .DTEMPS[CURD] THEN RETURN;
DECR I FROM .DTEMPS[CURD] TO .TOO+1
DO CLOSELIST(DTEMPS[LSELEM(.I)],.LON);
DTEMPS[CURD]_.TOO
END;
ROUTINE TRYDYTEMPS(T)=
BEGIN
! TRY THE DYNAMIC TEMPS OPENED BY TLA
DECR I FROM .DTEMPS[MAXD] TO 0 DO
IF TRYFIT(.T,DTEMPS[LSELEM(.I)]<0,0>) THEN SUCCESS;
FAIL
END;
ROUTINE MUSTBETOP(TN,LST)=
!
! PREDICATE WHICH DETERMINES WHETHER, IF TEMP-NAME 'TN'
! WERE ALLOCATED TO DYTEMP-LIST 'LST', IT WOULD ALWAYS
! BE ADDRESSED AS '@SP' (RATHER THAN 'N(SP)', WITH N NON-ZERO).
!
BEGIN
MAP GTVEC TN;
LOCAL MARK,LSTHDR L,GTVEC T;
IF .LST EQL DTEMPS[LSELEM(.DTEMPS[MAXD])]<0,0> THEN RETURN 1;
L_0;
INCR I FROM 1 TO .DTEMPS[MAXD] DO
IF .LST EQL DTEMPS[LSELEM(.I-1)]<0,0>
THEN EXITLOOP L_DTEMPS[LSELEM(.I)]<0,0>;
IF .L EQL 0 THEN RETURN 0;
MARK_.TN[LONFU];
FORALLTN(T,.L,
(BEGIN DUMMYBLOCK;
IF .T[LONLU] LSS .TN[LONFU] THEN CONTINUE;
IF .T[LONFU] GTR .TN[LONLU] THEN RETURN 0;
IF .T[LONFU] GTR .MARK THEN RETURN 0;
IF .T[REQD] NEQ IGREQDB THEN RETURN 0;
IF (MARK_.T[LONLU]) GEQ .TN[LONLU] THEN RETURN 1
END))
END;
END
END ELUDOM