Google
 

Trailing-Edge - PDP-10 Archives - AP-D480B-SB_1978 - mova.bli
There are 12 other files named mova.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) 1974,1977 BY DIGITAL EQUIPMENT CORPORATION
MODULE MOVA(RESERVE(0,1,2,3), SREG=#17,VREG=#15, FREG=#16, DREGS=4)=
BEGIN

	!AUTHOR: NORMA ABEL/SJW

GLOBAL BIND MOVAV= 5^24 + 0^18 + 26;	!VERSION DATE: 22-SEP-76
	%(
	REVISION HISTORY

17	 ----- -----	CREATE MODULE
18	-----	-----	FIX HAULASS NOT TO MOVE COMMON SUBS CREATED IH
			THIS LOOP
19	-----	-----	FIX HAULASS NOT TO MOVE .R VARIABLE ASSIGNMENTS
20	-----	-----	FIX 19.
21	-----	-----	DONT TRY TO MOVE ASSIGNMENTS THAT ARE TRU
			BRANCHES OF LOGICAL IFS
22	-----	-----	IF THE ASSIGNMENT TO BE MOVED IS ONE
			THAT ASSIGNS A VARIABLE THAT IS PART OF THE
			LOOP CONTROL EXPR MAKE IT INTO A SEPARATE 
			ASSIGNMENT
23	-----	-----	CHECK THAT ANY ASSIGNMENT TO BE MOVED IS
			SURE TO BE EXECUTED. ALSO MAKE SURE THE
			VARIABLE IS NOT REFERENCED BEFORE THAT 
			ASSIGNMENT.
24	-----	-----	MISSING DOT . IN REDEFPT
25	-----	-----	HAULASS IS NOT MOVING STATEMENTS
			IF USE THAT PROCEEDS ASSIGNMENT IS THE
			ASIGNMENT ITSELF.
26	456	QA784	GIVE FINDTHESPOT 2ND PARAM = TOP IN HAULASS

	)%
	!MODULE CONTAINS ROUTINES ASSOCIATED
	!WITH MOTION OF SIMPLE ASSIGNMENT
	!STATEMENTS.

	SWITCHES	NOLIST;
	REQUIRE		FIRST.BLI;
	REQUIRE		TABLES.BLI;
	SWITCHES	LIST;
	REQUIRE		OPTMAC.BLI;

EXTERNAL TOP,UNIQVAL;
MAP PHAZ2 TOP;


GLOBAL ROUTINE UNLIST(LSTHEAD, ITM, ITMSIZ)=
BEGIN

	!IF ITM IS ON THE LINKED LIST HEADED BY LSTHEAD
	!DELETE IT (IF POSSIBLE)
	!RETURN 1 IF IT IS THE FIRST ITEM ON THE LIST
	!	DELETION MUST BE AT UPPER LEVEL
	!RETURN 0 IN ALL OTHER CASES
	!
	!THE LIST LOOKS LIKE
	!
	!--------------------------------------------------------!
	!	ITEM		!		CLINK		 !
	!--------------------------------------------------------!
	!
	EXTERNAL SAVSPACE;
	REGISTER BASE T;
	MAP BASE LSTHEAD:ITM;

	IF .LSTHEAD EQL 0 THEN RETURN 0;

	IF .LSTHEAD [LEFTP] EQL .ITM THEN RETURN 1;

	T_.LSTHEAD;
	LSTHEAD_.LSTHEAD[RIGHTP];
	WHILE .LSTHEAD NEQ 0 DO
	BEGIN
		IF .LSTHEAD[LEFTP] EQL .ITM THEN
		BEGIN
			T[RIGHTP]_.LSTHEAD [RIGHTP];
			SAVSPACE (.ITMSIZ-1,.LSTHEAD);
			RETURN 0;
		END;
		T_.LSTHEAD;
		LSTHEAD_.LSTHEAD[RIGHTP];
	END;

END;

!************************************

GLOBAL ROUTINE ONLIST(LSTHEAD,ITM)=
BEGIN

	!RETURN TRUE IF ITM IS THE LIST
	!HEADED BY LSTHEAD
	!THE LIST IS OF THE FORM
	!
	!LEFT HALF WORD - POINTER TO ITEM
	!RIGHT HALF WORD - LINK
	!
	!LIST IS TERMINATED BY A ZERO LINK

	MAP BASE LSTHEAD;

	WHILE .LSTHEAD NEQ 0 DO
	BEGIN

		IF .LSTHEAD[LEFTP] EQL .ITM THEN RETURN 1;
		LSTHEAD_.LSTHEAD[RIGHTP];
	END;
	0
END;

GLOBAL ROUTINE QUALIFY(WARG)=
BEGIN

	!TREEPTR POINTS TO AN EXPRESSION
	!WARG IS 1 OR 2 INDICATING
	!WHICH ARGUMENT TO LOOK AT
	!QUALIFY RETURNS TRUE IF
	!	THE ARGUMENT IN QUESTION IS
	!	1.  NOT ON DOCHNGL
	!	2.  GETS A UNIQUE ASSIGNMENT IN THE LOOP
	!	    (I.E. IS ON UNIQVAL)

	EXTERNAL TREEPTR,LENTRY;
	MAP PEXPRNODE TREEPTR;

	IF .WARG THEN
	BEGIN

		!LOOK AT ARG 1
		IF (.TREEPTR[DEFPT1] NEQ 0) AND (.TREEPTR[DEFPT1] NEQ .LENTRY)THEN
		RETURN(
		NOT ONLIST(.TOP[DOCHNGL],.TREEPTR[ARG1PTR])
		AND

		ONLIST(.UNIQVAL,.TREEPTR[ARG1PTR])
		);
	END ELSE
	BEGIN

		IF (.TREEPTR[DEFPT2] NEQ 0) AND (.TREEPTR[DEFPT2] NEQ .LENTRY) THEN
		RETURN (
		NOT ONLIST(.TOP[DOCHNGL], .TREEPTR[ARG2PTR])
		AND
		ONLIST(.UNIQVAL,.TREEPTR[ARG2PTR])
		)
	END;
	0
END;

GLOBAL ROUTINE REDEFPT(EXPR, SHAPE)=
BEGIN

	!RE-EXAMINE THE DEFINITION POINTS OF
	!THE EXPRESSION.  IF THE
	!PARENT IS AN ASSIGNMENT STATEMENT
	!AND THE LEFT HAND SIDE IS
	!	1.  NOT ON DEFCHNGL
	!	2.  ON UNIQVAL
	!THEN MAKE THE DEFPT LENTRY

	EXTERNAL TREEPTR, LENTRY;
	MAP BASE TREEPTR;
	REGISTER BASE DAD;
	MAP BASE EXPR;

	IF (DAD_.EXPR[PARENT]) EQL 0 THEN RETURN;

	!IS THE PARENT AN ASSIGNMENT TO A SCALAR
	IF .DAD[OPRCLS] EQL STATEMENT THEN

	IF .DAD[SRCID] EQL ASGNID THEN

	IF .DAD[A1VALFLG] THEN

	BEGIN

		TREEPTR_.EXPR;
		IF .SHAPE EQL SKEW THEN
		BEGIN

			TREEPTR_.EXPR[ARG1PTR];
			IF QUALIFY(2) THEN
				TREEPTR[DEFPT2]_.LENTRY;
			TREEPTR_.EXPR;
			IF QUALIFY(2) THEN
				TREEPTR[DEFPT2]_.LENTRY;
		END ELSE
		BEGIN

			!UNARY OR STGHT
			IF QUALIFY(1) THEN	EXPR[DEFPT1]_.LENTRY;
			IF QUALIFY(2) THEN	EXPR[DEFPT2]_.LENTRY;
		END;
	END;
END;

GLOBAL ROUTINE HAULASS=
BEGIN

	!MOVE SIMPLE ASSIGNMENT STATEMENTS
	!IF POSSIBLE CALLED AFTER MOVCNST SO ALL COMPUTATIONS
	!ARE A SINGLE .O VARIABLE

	EXTERNAL PHAZ2 CSTMNT:TOP;
	EXTERNAL UNIQVAL,LENTRY,FINDTHESPOT,LOKINDVAR,CONTVAR;
	EXTERNAL CONTVAR,MAKASGN,GETOPTEMP,LEND,INDVAR;

	 REGISTER BASE T:PB;

	LABEL HAULIT;


	CSTMNT_.TOP[BUSY];

	WHILE .CSTMNT NEQ 0 DO
	BEGIN

		HAULIT:

		!IS IT AS ASSIGNMENT OF A SCALAR
		!AND NOT A TRUE BRANCH OF A LOGICAL IF
		IF (.CSTMNT[OPERSP] EQL ASGNID)
		   AND (.CSTMNT[SRCLINK] NEQ 0 ) THEN
		IF .CSTMNT[A1VALFLG] AND .CSTMNT[A2VALFLG] THEN
		BEGIN
			!STOP!
			!DO NOT MOVE A .O ON THE RIGHT IF TOLENTRY
			!IS SET (SET IN GLOBMOV)

			PB_.CSTMNT[RHEXP];
			IF .PB[IDDOTO] EQL SIXBIT".O" THEN
				IF NOT .PB[IDATTRIBUT(TOLENTRY)] THEN
					LEAVE HAULIT;

			!DO NOT MOVE .R ASSIGNMENTS EITHER

			PB_.CSTMNT[LHEXP];
			IF .PB[IDDOTO] EQL SIXBIT".R" THEN
				LEAVE HAULIT;

			!OK MOV'EM OUT

			IF ONLIST(.UNIQVAL, .CSTMNT[LHEXP]) AND
			NOT ONLIST(.TOP[DOCHNGL],.CSTMNT[RHEXP])THEN
			BEGIN

				!ONE MORE SIDE TRIP.
				!IF THE ASSIGNED VARIABLE IS USED IN THE
				!DO LOOP CONROL COMPUTATION.
				!MAKE THE CONTROL COMPUTATION A SEPARATE
				!ASSIGNEMNT STATEMENT OUTSIDE THE LOOP

				IF CONTVAR(.TOP[DOLPCTL],.CSTMNT[LHEXP]) THEN
				BEGIN
					T_.TOP[DOLPCTL];
					TOP[DOLPCTL]_PB_GETOPTEMP(INTEGER);
					T_MAKASGN(.PB,.T);
					!FIND WHERE TO PUT IT AND PUT IT
!**[456] HAULASS @3766 SJW 22-SEP-76
![456] TELL FINDTHESPOT TO STOP AT TOP
%[456]%					PB _ FINDTHESPOT (.LENTRY,.TOP);
					T[SRCLINK]_.PB[SRCLINK];
					PB[SRCLINK]_.T;
				END;

				!ONE MORE CHECK:
				!FORGET IT ALL TO GETHER IF THE
				!ASSIGNMENT STATEMENT IS NOT SURE TO
				!BE EXECUTED.

				IF .CSTMNT[SRCOPT] NEQ 0 THEN
				BEGIN
					!USE OPTIMIZER INFO ONLY IF IT
					!IS THERE
					T_.TOP;
					DO
						T_.T[POSTDOM]
					UNTIL
						(.T EQL .CSTMNT)
					OR	(.T EQL .LEND)
					OR	(.T EQL 0);
					IF .T NEQ .CSTMNT THEN LEAVE HAULIT;
				END;

				!ALSO CHECK FOR A USE THAT PRECEEDS THIS
				!ASSIGNMENT. 

				!ELIMINATE THE RIGHT HAND SIDE OF THIS
				!STATEMENT .
				IF CONTVAR(.CSTMNT[RHEXP],.CSTMNT[LHEXP]) THEN
					LEAVE HAULIT;

				!WE WILL RISK CHECKING ONLY THE BUSY PATH.
				!THAT IS, THE SHORTEST PATH TO THE ASSIGNMENT.
				!WE MAY STILL BE WRONG IF THERE IS A REFERENVCE
				!ON A LONGER PATH
				T_.TOP[BUSY];
				!SAVE INDVAR, CUZ WE ARE GOING TO
				!MULTIPLEX THE TESTREPLACMENT
				!ROUTINES.
				PB_.INDVAR;
				INDVAR_.CSTMNT[LHEXP];
				WHILE .T NEQ .CSTMNT DO
				BEGIN
					IF LOKINDVAR(.T) NEQ 0 THEN
						LEAVE HAULIT;
					IF .T[SRCID] EQL IFLID THEN
						IF LOKINDVAR(.T[LIFSTATE]) NEQ 0 THEN
							LEAVE HAULIT;
					T_.T[BUSY];
				END;
				!RESTORE INDVAR
				INDVAR_.PB;


				!FIND WHERE TO PUT THE ASSIGNEMNT WE ARE REALLY MOVING
!**HAULASS @3822 SJW 22-SEP-76
![456] TELL FINDTHESPOT TO STOP AT TOP
%[456]%				T _ FINDTHESPOT (.LENTRY, .TOP);

				!FIND WHERE TO LINK IT OUT OF THE LOOP
				PB_.TOP;
				WHILE .PB[SRCLINK] NEQ .CSTMNT DO
				PB_.PB[SRCLINK];


				!LINK IT OUT
				PB[SRCLINK]_.CSTMNT[SRCLINK];	
				!LINK IT IN
				CSTMNT[SRCLINK]_.T[SRCLINK];
				T[SRCLINK]_.CSTMNT;
			END;
		END;
		CSTMNT_.CSTMNT[BUSY];
	END;
END;


END
ELUDOM