Trailing-Edge
-
PDP-10 Archives
-
BB-4157D-BM
-
sources/main.bli
There are 13 other files named main.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) 1973,1977 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: F. INFANTE /FI /HPW /DBT/SJW
MODULE MAIN(RESERVE(0,1,2,3),SREG=#17,VREG=#15,FREG=#16,DREGS=4,LOWSEG,GLOROUTINES)=
BEGIN
!
GLOBAL BIND MAINV = 5^24 + 0^18 + 29; !VERSION DATE: 1-OCT-76
%(
REVISION HISTORY
24 ----- ----- CHANGE THE GETSEGMENT CODE INTO A ROUTINE.
ADD ROUTNINE NXFILG WHICH WHEN CALLED FROM
PHAZ1, WILL GET FORTRA AND THEN CALL NXTFIL TO
OPEN THE NEXT INPUT FILE. IT THEN RETURNS TO
PHAZ1. THIS ALLOWS PHZA1 TO CONCATINATE
INPUT FILES IF THE USER DESIRES.
25 ----- ----- SAVE STACK POINTERS BEFORE CALL TO MRP1 SO
THAT IF A RETURN TO MRP1 IS NOT NECESSARY ONE
CAN RETURN DIRECTLY TO COMMAN
26 ----- ----- ADD CODE TO PRINT OUT END OF PROGRAM AND END
OF COMPILATION MESSAGES WHEN THE RETURN TO PHAZ1
IS SKIPPED.
27 ----- ----- OUTPUT ERROR CODE FOR GETSEG FAILURES
28 ----- ----- REMOVE FT1SEQ SWITCH SETTING - NOW FROM IOFLG
29 467 VER5 REMOVE 28: REQUIRE FT1SEG.REQ
)%
REQUIRE FT1SEG.REQ;
REQUIRE IOFLG.BLI;
FORWARD SIXBOUT, !OUTPUT A SIXBIT WORD VIA TTCALL
NXFILG,
GETSG;
REGISTER C=3,T1=1,T2=2;
EXTERNAL SAVE17;
EXTERNAL TTCHAR,ZMAKEX,AHEAD;
OWN SVV17,SVV16; !LOCATIONS TO SAVE THE STACK POINTERS INORDER TO
!SKIP THE RETURN TO MRP1 IF NOT NECESSARY
MACHOP TTCALL =#051, CALLI = #047, TDZA = #634,JFCL = #255;
!********************************************************************
!THESE TWO SETS OF BINDS GO TOGETHER AND ESTABLISH THE CORRESPONDENCE
!BETWEEN THE NAMES OF THE PHASES AND THE NAMES OF THE
!SEGMENTS FOR THE GETSEG UUO.
BIND PHAZNAME = PLIT(SIXBIT'FORTRA', !P0-0 COMMAND SCANNER
SIXBIT'FORTB', !P1-1 SYNTAX +LEXICAL+SEMANTICS
SIXBIT'FORTC', !P2S-3 PHAZ2 SKELETON
SIXBIT'FORTD', !P2-2 OPTIMIZER
SIXBIT'FORTE', !P3G-4 GLOBAL OPT REGISTER ALLOCATOR
SIXBIT'FORTF', !P3R-5 LOCAL REGISTER ALLOCATOR
SIXBIT'FORTG') !P3-6 CODE GENERATOR
;
BIND PNAMES = PLIT(PLIT ASCIZ'FORTRA', !P0-0 COMMAND SCANNER
PLIT ASCIZ'FORTB', !P1-1 SYNTAX +LEXICAL+SEMANTICS
PLIT ASCIZ'FORTC', !P2S-3 PHAZ2 SKELETON
PLIT ASCIZ'FORTD', !P2-2 OPTIMIZER
PLIT ASCIZ'FORTE', !P3G-4 GLOBAL OPT REGISTER ALLOCATOR
PLIT ASCIZ'FORTF', !P3R-5 LOCAL REGISTER ALLOCATOR
PLIT ASCIZ'FORTG') !P3-6 CODE GENERATOR
;
BIND P0=0,
P1=1,
P2S=2,
P2=3,
P3G=4,
P3R=5,
P3=6;
!*********************************************************************
MACRO SERRORS = FLGREG<1,1>$,
SSYNTAX = FLGREG<20,1>$,
SOPTIMIZ= FLGREG<0,1>$,
SAVREGS = BEGIN
REGSAV[15] _ .(#17)<0,36>;
#17<0,36> _ REGSAV<0,0>;
BLT(#17,REGSAV[14])
END$,
RESREGS = BEGIN
#17<0,36> _ (REGSAV<0,0>)^18;
BLT(#17,#17)
END$;
EXTERNAL NUMFATL,NUMWARN; !FATAL AND WARNING ERROR COUNTS
EXTERNAL REGSAV[16], !FOR SAVING REGISTERS FOR GETSEG
ENTRY,
ERROUT,
SEGINCORE, !HOLDS CURRENT IN CORE SEGMENT NUMBER
GETSBLOK[6]; !THE GETSEG DATA BLOCK
!
EXTERNAL JOBSA;
!
MACRO JBHSA =#400000$;
!
EXTERNAL MRP0, !PHAZE 0 MAIN ROUTINE
MRP1, !PHAZE 1 MAIN ROUTINE
MRP2S, !PHAZE 2S MAIN ROUTINE
MRP2, !PHAZE 2 MAIN ROUTINE
MRP3R, !PHAZE 3R MAIN ROUTINE
MRP3G, !PHAZE 3G MAIN ROUTINE
MRP3; !PHAZE 3 MAIN ROUTINE
!
MACRO REED =(TTCALL(4,VREG); .VREG)$;
!
!THE FOLLOWING ROUTINE CONTROLS THE COMPILATION PROCESS FROM ONE PHASE TO THE NEXT
!EACH PHASE, WHEN IT FINISHED ALL IT CAN DO TO THE PROGRAM,CALLS THE
!NEXT PHASE OF THE COMPILER BY RETURNING TO THE ROUTINE PHAZCONTROL
!WITH THE PHASE NUMBER OF ITSELF IN THE GLOBAL
!VARIABLE SEGINCORE. FOR EXAMPLE IF WE ARE IN PHASE 1 SYNTAX THEN TO
!CALL THE NEXT PHASE: SEGINCORE _ 1; PHAZCONTROL();
!IF THE GETSEG FOR THE NEXT PHASE IS COMPLETED THEN
!THE NEXT PHASE WILL BEGIN EXECUTING. THE CALLING ROUTINE SHOULD
!NOT CALL THE NEXT PHASE IF IT HAS ENCOUNTERED ERRORS IN THE PROGRAM
!WHILE PERFORMING ITS TASK. THUS, PHASE 1 SHOULD NOT
!CALL THE NEXT PHASE IF THERE ARE SYNTAX ERRORS OR IF ONLY SYNTAX
!CHECKING WAS REQUESTED BY THE USER.
ROUTINE PHAZCONTROL= !CONTROLS THE CALLING OF THE COMPILER SEGMENTS
BEGIN
EXTERNAL CTCSTART,CCLSW;
BIND JOBSYM = #116, JOBUSY = #117;
MACRO TPHAZ = T1$;
WHILE 1 DO
BEGIN
CASE .SEGINCORE OF SET
%IN PHASE 0% !GET PHASE 1 SYNTAX
IF FT1SEG EQL 0 THEN (JOBSYM<0,36> _ 0; JOBUSY<0,36> _ 0;TPHAZ _ P1)
ELSE TPHAZ _ P1;
%IN PHASE 1% BEGIN
IF FT1SEG EQL 0 THEN !MULTI-SEGMENT COMPILER
(JOBSYM<0,36> _ 0; JOBUSY<0,36> _ 0); !CLEARING BAD DDT INFORMATION
TPHAZ _ IF .SOPTIMIZ THEN P2 ELSE P2S;
END;
%IN PHASE 2S%
TPHAZ _ P3R;
%IN PHASE 2%
TPHAZ _ P3G;
%IN PHASE 3G%
TPHAZ _ P3;
%IN PHASE 3R%
TPHAZ _ P3;
%IN PHASE 3%
TPHAZ _ P1;
%IN PHASE 1 AND RETURNING TO PHASE 0%
TPHAZ _ P0;
%CALL FROM CTCSTART%
TPHAZ _ P0
TES;
%CHECK FOR RETURN TO MRP1 - RETURN TO COMMAN IF ITS NOT
NECESSARY %
IF .SEGINCORE EQL P3
THEN
BEGIN % WE SHOULD RETURN TO MRP1%
IF .FLGREG<ENDFILE>
THEN
BEGIN %SKIP THE RETURN%
EXTERNAL ENDUNIT;
SREG _ .SVV17;
FREG _ .SVV16;
IF FT1SEG EQL 0 THEN GETSG(P0);
SEGINCORE _ P0;
ENDUNIT(); !OUTPUT END OF PROG UNIT MESAGE
RETURN
END
ELSE
BEGIN %RETURN TO MRP1%
IF FT1SEG EQL 0 THEN GETSG(P1);
SEGINCORE _ P1;
RETURN
END
END;
!
! DO GETSEG IF MULTI-SEGMENT COMPILER
!
IF FT1SEG EQL 0 THEN GETSG( .TPHAZ );
!
JOBSA<0,18> _ CTCSTART<0,0>;
!FOR ^C .START EVENTUALITY
%CHECK FOR RETURN TO COMMAN%
IF .SEGINCORE EQL (P3+1) THEN (SEGINCORE _ 0; RETURN);
SEGINCORE _ .TPHAZ;
IF .TPHAZ EQL P1
THEN %SAVE STACK% ( SVV17 _ .SREG; SVV16 _ .FREG);
!
! START THE NEXT SEGMENT
!
IF FT1SEG EQL 0 THEN !MULTI SEGMENT START
(.JBHSA<0,18>)() !START THE NEXT PHASE
!START ADDRESS IN RH OF JOBHSA
ELSE !SINGLE SEGMENT START
CASE .TPHAZ OF SET !CALL MAIN ROUTINE
MRP0(); !PHAZE 0
MRP1(); !PHAZE 1
MRP2S(); !PHAZE 2S
(SAVE17_.SREG<0,36>+#1000001;MRP2()); !PHAZE 2
MRP3G(); !PHAZE 3G
MRP3R(); !PHAZE 3R
MRP3() !PHAZE 3
TES;
!
IF .SEGINCORE EQL P1 THEN SEGINCORE _ (P3+1) !DO THIS ONLY IF A RETURN TO THE COMMAND SCANNER IS NEEDED
ELSE
%QUIT IF ERRORS WERE DETECTED%
IF .NUMFATL NEQ 0 THEN SEGINCORE _ P3;
!
!PHASES 2,2S AND 3 ALL RETURN HERE AFTER COMPLETING THEIR COMPUTATIONS
!THEY DO NOT CALL PHAZCONTRO DIRECTLY BUT MERELY FALL BACK (POPJ 17,0)
!SINCE THEY WERE CALLED BY PHAZCONTROL ITSELF
!ONLY PHASE0 AND PHASE1 CALL TH