Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/13/cgob.mac
There are 2 other files named cgob.mac in the archive. Click here to see a list.
	SUBTTL	WRITTEN BY OLOF BJ@RNER SEP-73
;		UPDATED AT ACADIA UNIVERSITY FOR KA10
COMMENT ;

VERSION:	3A [10,174]

PURPOSE:	TO COMPILE AN ASSIGNMENT STATEMENT

CONTENTS:	THE SUBROUTINE CGAS WHICH IS CALLED EXTERNALLY
		THE FOLLOWING LOCAL SUBROUTINES:
		 CGASTX	FOR TEXT ASSIGNMENT
		 CGASFP	FOR ASSIGNMENT TO FORMAL PARAMETER
		 CGASRI	FOR ASSIGNMENT TO REMOTE IDENTIFIER
		 CGASAR	FOR ASSIGNMENT TO ARRAY ELEMENT
		 CGASEQ	WHICH COMPARES TWO ZID-NODES AND SKIPS IF THEY REPRESENT
			THE SAME IDENTIFIER
;

	SEARCH	SIMMAC,SIMMC2,SIMMCR
	CTITLE 	CGOB
	TWOSEG
	RELOC	400K
	SALL
	MACINIT
	CGINIT

	INTERN	CGAS

	EXTERN	YZHBXC,YCGACT,YLXIAC
	EXTERN	YO2ADI,YOPCOD,YTAC	;LOW SEGMENT VARIABLES
	EXTERN	O2GA,O2GR,O2GI,O2AD	;OUTPUT ROUTINES
	EXTERN	O2CF,O2DF,O2GF,O2GW,O2GWD,O2IV
	EXTERN	CGRD,CGG4,CGR4,CGMO,CGMO1,CGVA,CGAD,CADS,CGAA
	EXTERN	CGCA,CGCC,CGCO,CGG2,CGG3,CGIM,CGIM1,CGLO,CGLO1,CGR2,CGR3
	EXTERN	ORTXCH	;[174]
					;CODE GENERATION ROUTINES

	OPDEF	EXITAS		[GOTO	CGASEXIT]
	OPDEF	IFNOTSAME	[PUSHJ	XPDP,CGASEQ]

	DSW	CGSWAP,0,35,XL2	;THIS SWITCH IS ON IF RHS CAN BE COMPILED FIRST

CGASER:	ASCIZ/ILL ZNNCOD DURING ASSIGNMENT COMPILATION/
	SUBTTL	CGAS	ASSIGNMENT COMPILATION

COMMENT ;

METHOD:	1. INSPECT LHS(LEFT HAND SIDE NODE), IF IT IS TEXT ASSIGNMENT
	   EXECUTE CGASTX AND EXIT.
	2. IF RHS(RIGHT HAND SIDE NODE) IS A
	   MEMORY OPERAND OR ELSE IF THERE ARE NO SIDE-EFFECTS
	   IN RHS OR LHS GO TO STEP 4.
	3. COMPILE LHS BEFORE RHS AND EXIT.
	4. IF RHS IS OF KIND SIMPLE GO TO STEP 6.
	5. COMPILE RHS BEFORE LHS AND EXIT.
	6. LOOK FOR OPTIMIZABLE CASES AND COMPILE SPECIAL CODE IF
	   POSSIBLE ELSE GO TO STEP 5.

ENTRY CONDITIONS:
	X1 POINTS AT LHS
	X2 POINTS AT RHS.
	XCUR POINTS AT THEIR  PARENT

EXIT CONDITIONS:
	@YTAC CONTAINS VALUE OF RHS.
;

CGAS:
	PROC
	SAVE	<X6,X7,XP1,XP2,XL1,XL2,XV1,XV2,XCUR>
	LD	XP1,X1		;NOW XP1 -> LHS AND XP2 -> RHS

	;TAKE CARE OF TEXT ASSIGNMENT FIRST
	LF	X6,ZNNTYP(XP1)
	IF	;TEXT ASSIGNMENT
		CAIE	X6,QTEXT
		GOTO	FALSE
		LF	,ZNSGEN(XCUR)
		CAIN	%BECOM
		GOTO	TRUE
;[174]		WHENNOT	X2,ZCN
;[174]		GOTO	FALSE
;[174]		HRRZ	OFFSET(ZCNVAL)(X2)
;[174]		SKIPE
		L	X0,X2	;[174]
		EXEC	ORTXCH	;[174]
		GOTO	FALSE	;[174]
		ERROR2	51,TEXT STRING AFTER DENOTES
		GOTO	FALSE
	THEN	EXEC	CGASTX
		EXITAS
	FI

	;THEN CHECK IF RHS CAN BE COMPILED FIRST
	IFMEMO			;LHS MEMORY OPND?
	GOTO	CGASSW		;YES!
	IFOFF	ZNSSEF(XCUR)	;SIDE-EFFECTS IN RHS OR LHS?
	GOTO	CGASSW	;NO!
	WHEN	(XP2,ZCN)	; RHS CONSTANT
	GOTO	CGASSW

	;MUST COMPILE LHS FIRST!
	SETOFA	CGSWAP		;FLAG LHS FIRST
	COMPAD			;COMPUTE ADDRESS TO LHS
	L	XL1,@YTAC
	AOS	YTAC
	LF	XV1,ZNNCOD(XP1)
	IF	CAIN	XV1,QCODAR
		GOTO	TRUE
		CAIE	XV1,QCODCA
		GOTO	FALSE
		LF	,ZNNTYP(XP1)
		CAIE	QREF
		GOTO	FALSE
	THEN
		AOS	YTAC	; LHS IS TWO WORDS
	FI
	EXCH	XP1,XP2
	COMPVAL			;COMPUTE VALUE OF RHS
	EXCH	XP1,XP2
	L	XV2,@YTAC	;SAVE VALUE OF ACC THAT HOLDS RHS VALUE

	;NOW CHECK TYPE OF LHS. VALID TYPES ARE REMOTE IDENTIFIER,
	;ARRAY ELEMENT AND FORMAL PARAMETER AND THEY ARE TRIED IN THAT ORDER
	IF	;REMOTE IDENTIFIER
		CAIE	XV1,QCODRA
		GOTO	FALSE
	THEN	L	XV1,XL1		;LOAD BASE ADDRESS ACC
		EXEC	CGASRI
	ELSE
	IF	;ARRAY ELEMENT
		CAIE	XV1,QCODAR
		GOTO	FALSE
	THEN	L	XV1,XL1		;LOAD ARRAY ADDRESS ACC TO XV1
		ADDI	XL1,1
					;ACC WITH OFFSET ALREADY IN XL1
		EXEC	CGASAR
	ELSE
	IF	;FORMAL PARAMETER
		CAIE	XV1,QCODCA
		GOTO	FALSE
	THEN	L	XV1,XL1		;LOAD DYNAMIC ADDRESS ACC
		EXEC	CGASFP
	ASSERT<
	ELSE	;ILLEGAL RESULT DESCRIPTOR!
		RFAIL	CGASER
	>
	FI FI FI
	SOS	YTAC

CGASEXIT:		;COMMON TERMINATION POINT FOR CGAS
	RETURN

	;THIS CODE TAKES CARE OF THE CASE WHEN RHS CAN BE COMPILED FIRST

CGASSW:
		;NOW XP1 -> LHS AND XP2 -> RHS
	SETONA	CGSWAP		;FLAG RHS FIRST
	LF	,ZIDZHE(XP1)
	IF	JUMPN	FALSE
	THEN
			;ASSIGNMENT TO PROCEDURE ID.
		EXCH	XP1,XP2
		COMPVAL
		L	X2,[ST	2(XCB)]
		L	X1,XP1
		IFLONG
;***AUBEG
;GENERATE DMOVEM UUO, NOT STD MACRO EXPANSION FOR KA10
		OP	X2,(DMOVEM	(XCB))
;***AUEND
		L	X2
		ADD	YCGACT
	; CHECK IF ASSIGNMENT IN PROCEDURE BLOCK
		LF	X1,ZIDZQU(XP2)
		LF	X1,ZQUZB(X1)
		LF	X1,ZHEDLV(X1)
		L	X2,YZHBXC
		LF	X2,ZHEDLV(X2)
		IF	CAMN	X1,X2
			GOTO	FALSE
		THEN
			L	X2,	; SAVE STORE INSTR.
			L	X1	; DISPLAY BLOCK OFFSET
			OP	(L	XIAC,(XCB))
			GENABS
			ADD	X2,[Z	(XIAC-XCB)]
			L	X2	; RESTORE MODIFIED INSTR
		FI
		GENABS
		EXITAS
	FI
	IF	WHENNOT	XP1,ZNS
		GOTO	TRUE	;LHS TERMINAL
		WHENNOT	XP2,ZNS
		GOTO	TRUE	;RHS TERMINAL
		LF	,ZNSGEN(XP2)
		CAIN	%THIS
		GOTO	FALSE	; DO NOT TRY TO OPTIMIZE 
	THEN
		IF	IFON	ZNSSEF(XCUR)
			GOTO	FALSE	; NO OPTIMIZATION
		THEN
			GOTO	CGASOP
		FI
	FI
	EXCH	XP1,XP2		;XP1 -> RHS NOW

L1():!	;RETURN HERE FROM CGASOP WHEN WE COULDN'T OPTIMIZE
	COMPVAL			;COMPILE RHS
	STACK	YTAC
	L	XV2,@YTAC	;LOAD ACC WITH RESULT
	AOS	YTAC
	HLRZ	X1,XV2
	IFLONG
	AOS	YTAC
	EXCH	XP1,XP2		;XP1 -> LHS
	COMPAD			;COMPUTE ADDRESS TO LHS

	;TYPE OF LEFT HAND SIDE MAY NOW BE EITHER OF
	;LOCAL IDENTIFIER, REMOTE IDENTIFIER, ARRAY ELEMENT
	;OR FORMAL PARAMETER AND THEY ARE TRIED IN THAT ORDER.

	LF	X6,ZNNCOD(XP1)
	IF	;LOCAL IDENTIFIER
		CAIE	X6,QCODVA
		GOTO	FALSE
	THEN	LF	X1,ZNNZQU(XP1)
		UNSTK	YTAC
		GETAD
		OPZ	X2,(ST)
		HLRZ	X1,XV2
		IFLONG
;***AUBEG
;GENERATE DMOVEM UUO, NOT STD MACRO EXPANSION
		OPZ	X2,(DMOVEM)
;***AUEND
		ST	X2,YOPCOD
		GENOP
	ELSE
	L	XV1,@YTAC	;LOAD ACC WITH TARGET ADDRESS
				;(ARRAY, BASE OR DYNAMIC)
	IF	;REMOTE IDENTIFIER
		CAIE	X6,QCODRA
		GOTO	FALSE
	THEN	EXEC	CGASRI
	ELSE
	IF	;ARRAY ELEMENT
		CAIE	X6,QCODAR
		GOTO	FALSE
	THEN	L	XL1,XV1		;ACC WITH OFFSET
		ADDI	XL1,1
		EXEC	CGASAR
	ELSE
	IF	;FORMAL PARAMETER
		CAIE	X6,QCODCA
		GOTO	FALSE
	THEN	EXEC	CGASFP
	ASSERT<
	ELSE	;ERROR!
		RFAIL	CGASER
	>
	FI FI FI
	UNSTK	YTAC
	FI
	EXITAS

COMMENT /

THIS CODE TAKES CARE OF CERTAIN OPTIMIZABLE CASES:
1. LHS IS BOOLEAN:	B:=TRUE;  IS COMPILED AS	SETOB	@YTAC,B(XCB)
			B:=FALSE	"		SETZB	@YTAC,B(XCB)
2. LHS IS REAL:		A:=A;		"		L	@YTAC,A(XCB)
			A:=0;		"		SETZB	@YTAC,A(XCB)
			A:=A+<EXPR.>	"		FADRB	@YTAC,A(XCB)
			A:=A*<EXPR.>	"		FMPRB	@YTAC,A(XCB)
3. LHS IS INTEGER:	I:=I;		"		L	@YTAC,I(XCB)
			I:=0;		"		SETZB	@YTAC,I(XCB)
			I:=-1;		"		SETOB	@YTAC,I(XCB)
			I:=I+1;		"		AOS	@YTAC,I(XCB)
			I:=I-1;		"		SOS	@YTAC,I(XCB)
			I:=I+<EXPR.>	"		ADDB	@YTAC,I(XCB)
			I:=I*<EXPR.>	"		IMULB	@YTAC,I(XCB)
/

CGASOP:
	LF	XL1,ZNNTYP(XP1)
	EXCH	XP1,XP2		;XP1 -> RHS

	IF	CONST
		GOTO	FALSE
		CAIN	XL1,QTEXT
		GOTO	FALSE	; CONSTANT OPTIMIZATION NOT APPL. TO NOTEXT!
	THEN
		LF	X0,ZCNVAL(XP1)
		CAME	X0,[-1]
		JUMPN	X0,L1		;COMPILE AS USUAL IF NOT CONST. 0 OR -1
		OPZ	XL1,(SETOB)
		CAIN	X0,0
		OPZ	XL1,(SETZB)	;IF B:=FALSE
	
L3():!	;THIS CODE IS USED FOR ALL OPTIMIZABLE CASES
		EXCH	XP1,XP2		;XP1 -> LHS
		IF	WHENNOT	XP1,ZID
			GOTO	FALSE
		THEN
			LF	X1,ZIDZQU(XP1)
			GETAD			;ADDRESS TO SIMPLE VARIABLE
			ST	XL1,YOPCOD
			GENOP
		ELSE
			AOS	YTAC
			AOS	YTAC
			COMPAD
			HRRZ	X0,@YTAC
			LF	X1,ZNNCOD(XP1)
			CAIN	X1,QCODAR
			AOS	; THIS SAVES A L XTOP,XTOP+1 INSTRUCTION
				; IN ARRAY ACCESSES
			L	X1,YTAC
			DPB	[INDEXFIELD	XL1]
			EXEC	CGAA
			HLLZ	XL1
			ADD	YCGACT
			GENABS
		FI
		EXITAS
	FI
	;NOW SEE IF LHS IS INTEGER OR REAL

	CAIL	XL1,QINTEGER
	CAILE	XL1,QREAL
	GOTO	L1

	IF	IFNOTSAME
		GOTO	FALSE		;NO IT WAS NOT
	THEN
		OPZ	XL1,(L)
		GOTO	L3
	FI
	IFMEMOP
	GOTO	L1	;RHS MEMORY OPERAND

	;HERE IF RHS IS AN EXPRESSION
	LF	XV1,ZNSZNO(XP1)
	LI	XV2,2(XV1)

	;NOW	XP1 -> RHS
	;	XP2 -> LHS
	;	XV1 -> FIRST OPND
	;	XV2 -> LAST NODE
	;	XL1 CONTAINS TYPE OF LHS (INTEGER OR REAL)
	;NOW SEE IF FIRST NODE <=> LHS
	EXCH	XP1,XV1		;XP1 -> FIRST NODE XP2=>LHS
		IF
			CONST
			GOTO	FALSE
		THEN
			EXCH	XP1,XV1		;XP1 -> RHS
			GOTO	L1
		FI
		IF
		    IFNOTSAME
		    GOTO	FALSE
		THEN
			;SEE IF LAST NODE IS A CONSTANT = 1
		    EXCH	XP1,XV2		;XP1 -> LAST OPERAND
						;XV2 -> FIRST  -"-
		    IF
			CONST
			GOTO  FALSE
		    THEN
			LF	X6,ZCNVAL(XP1)
			IF
			    CAIE	X6,1
			    GOTO  FALSE
			    CAIE  XL1,QINTEGER
			    GOTO  FALSE
			THEN
				;SEE IF IT IS I:=I+1; OR I:=I-1;
			    EXCH  XP1,XV1	;XP1 -> RHS
						;XV1 -> LAST OPERAND
			    LF    X6,ZNSGEN(XP1)
			    IF
				CAIE	X6,%PLUS
				GOTO	FALSE
			    THEN
				OPZ	XL1,(AOS)
			    ELSE
				IF
				    CAIE  X6,%MINUS
				    GOTO  FALSE
				THEN
				    OPZ   XL1,(SOS)
				ELSE
				    GOTO  L1
				FI
			    FI
			    GOTO  L3	;FIND ADDRESS TO LHS
			FI
		    FI
		    EXCH  XV1,XV2	;XV1 -> FIRST OPERAND
		    EXCH  XP1,XV2	;XP1 -> RHS
		    GOTO  L4		;XV2 -> LAST OPERAND
		FI


		;NOW SEE IF LAST NODE <=> LHS
	EXCH	XP1,XV2				;XP1 -> LAST OPERAND
						;XV2 -> FIRST  -"-
						;XV1 -> RHS
		IF
			CONST
			GOTO	FALSE
		THEN
			EXCH	XP1,XV1		;XP1 -> RHS
			GOTO	L1
		FI
		IF
			IFNOTSAME
			GOTO	FALSE
		THEN
			;SEE IF IT IS X:=X+<EXP> OR X:=X*<EXP>
			; WHERE X COULD BE INTEGER OR REAL

			EXCH	XP1,XV1		;XP1 -> RHS
						;XV1 -> LAST OPERAND
L4():			LF	X6,ZNSGEN(XP1)
			IF
				CAIE	X6,%PLUS
				GOTO	FALSE
			THEN
				IF
					CAIE	XL1,QINTEGER
					GOTO	FALSE
				THEN
					OPZ	XL1,(ADDB)
				ELSE
					OPZ	XL1,(FADRB)
				FI
			ELSE
				IF
					CAIE	X6,%MULT
					GOTO	FALSE
				THEN
					IF
						CAIE	XL1,QINTEGER
						GOTO	FALSE
					THEN
						OPZ	XL1,(IMULB)
					ELSE
						OPZ	XL1,(FMPRB)
					FI
				ELSE
					GOTO	L1
				FI
			FI
			EXCH	XP1,XV2		;XP1 -> FIRST OR LAST OPERAND
						;XV2 -> RHS
			COMPVAL		;COMPILE EXPRESSION
			GOTO	L3	;FIND ADDRESS TO LHS
		FI
	EXCH	XP1,XV1			;XP1 -> RHS
					;XV1 -> LAST OPERAND
					;XV2 -> FIRST  -"-
	GOTO	L1	;COMPILE AS USUAL
	EPROC
	SUBTTL	CGASTX - TEXT ASSIGNMENT

COMMENT ;
PURPOSE:	TO COMPILE CODE FOR TEXT ASSIGNMENT.
		THE FOLLOWING CODE IS GENERATED:

			LI	XSAC+1,@YTAC
			EXEC	TXVA

		BEFORE THE EXECUTION OF THESE STATEMENTS @YTAC
		AND @YTAC+2 CONTAIN THE VALUES OF THE TEXT
		EXPRESSIONS IN THE LHS AND RHS RESPECTIVELY
		[10] CHECK IF LHS IS A TEXT PROCEDURE IDENTIFIER
		AND DO NOT USE COMPVAL IN THIS CASE TO COMPILE
		LHS TO @YTAC.
;

CGASTX:
	;[10]	CHECK IF LHS IS A PROCEDURE IDENTIFIER
	LF	,ZIDZHE(XP1)
	IF	JUMPN	FALSE
	THEN
			;ASSIGNMENT TO PROCEDURE ID.
			;FETCH THE TEXT FROM THE PROCEDURE BLOCK
		HRLM	XP1,@YTAC	;FIX THE ACCUMULATOR TABLE ENTRY
;***AUBEG
;GENERATE DMOVE UUO, NOT LD MACRO EXPANSION
		L	X2,[DMOVE	2(XCB)]
;***AUEND
		L	X1,XP1
		L	X2
		ADD	YCGACT
	; CHECK IF ASSIGNMENT IN PROCEDURE BLOCK
		LF	X1,ZIDZQU(XP1)
		LF	X1,ZQUZB(X1)
		LF	X1,ZHEDLV(X1)
		L	X2,YZHBXC
		LF	X2,ZHEDLV(X2)
		IF	CAMN	X1,X2
			GOTO	FALSE
		THEN
			L	X2,	; SAVE STORE INSTR.
			L	X1	; DISPLAY BLOCK OFFSET
			OP	(L	XIAC,(XCB))
			GENABS
			ADD	X2,[Z	(XIAC-XCB)]
			L	X2	; RESTORE MODIFIED INSTR
		FI
		GENABS
	ELSE
		COMPVAL			;COMPUTE VALUE OF LHS
	FI
		;[10] END OF CHECK FOR PROCEDURE ID.
	EXCH	XP1,XP2
	AOS	YTAC
	AOS	YTAC
	COMPVAL			;COMPUTE VALUE OF RHS
	SOS 	YTAC
	SOS	YTAC
	OP	(LI	XSAC+1,)
	HRR	@YTAC
	GENABS			;LI	XSAC+1,@YTAC
	GPUSHJ	TXVA		;EXEC	TXVA
	SETZM	YLXIAC
	RETURN
	SUBTTL	CGASRI - REMOTE IDENTIFIER

COMMENT /
PURPOSE:	TO COMPILE CODE FOR REMOTE ASSIGNMENT
ENTRY CONDITIONS:
		XP1 -> LHS
		XP2 -> RHS
		XV1 CONTAINS BASE ADDRESS
		XV2 CONTAINS VALUE OF RHS
GENERATED CODE:
		ST(D)	@XV2,ZQUIND(@XV1)
		ST(D)	@XV2,@XV1	;ONLY WHEN LHS IS COMPILED FIRST
/

CGASRI:
	OP	XL1,(ST)
	L	X1,XP2
	IFLONG
;***AUBEG
;GENERATE DMOVEM UUO, NOT STD MACRO EXPANSION
	OP	XL1,(DMOVEM)
;***AUEND
	LF	X1,ZNNZNO(XP1)	;FETCH ZQUIND
	STEP	X1,ZID
	LF	X1,ZIDZQU(X1)
	L	XL1
	HRR	OFFSET(ZQUIND)(X1)	;OFFSET TO RH
	DPB	XV1,[INDEXFIELD]
	DPB	XV2,[ACFIELD]
	GENABS
	IFONA	CGSWAP
	RETURN			;IF RHS COMPILED FIRST
	L	X1,YLINK
	SKIPN	(X1)
	RETURN	; IF NOT MULTIPLE ASSG
	L	XL1
	DPB	XV2,[ACFIELD]
	HRR	XV1
	GENABS
	RETURN
	SUBTTL	CGASAR - ARRAY ELEMENT ASSIGNMENT

COMMENT /
PURPOSE:	TO COMPILE CODE FOR ASSIGNMENT TO ARRAY ELEMENT
ENTRY CONDITIONS:
		XP1 -> LHS
		XP2 -> RHS
		XV1 CONTAINS ARRAY ADDRESS
		XL1  CONTAINS OFFSET TO BASE
		XV2 CONTAINS VALUE OF RHS
GENERATED CODE:
		ADD	@XL1,OFFSET(ZARBAD)(@XV1)
		ST(D)	@XV2,@XL1
		ST(D)	@XV2,@XV1	;ONLY IF LHS COMPILED FIRST
/

CGASAR:
	L	[ADD OFFSET(ZARBAD)]
	DPB	XV1,[INDEXFIELD]
	DPB	XL1,[ACFIELD]
	GENABS			;ADD-INSTR.
	OPZ	X2,(ST)
	L	X1,XP2
	IFLONG
;***AUBEG
;GENERATE DMOVEM UUO, NOT STD MACRO EXPANSION
	OPZ	X2,(DMOVEM)
;***AUEND
	L	X2
	DPB	XL1,[INDEXFIELD]
	DPB	XV2,[ACFIELD]
	GENABS			;STORE-INSTR.
	IFONA	CGSWAP
	RETURN			;IF RHS COMPILED FIRST
	L	X1,YLINK
	SKIPN	(X1)
	RETURN	; IF NOT MULTIPLE ASSG
	L	X2	; STD OR ST
	DPB	XV2,[ACFIELD]
	HRR	XV1
	GENABS			;LOAD-INSTRUCTION
	RETURN
	SUBTTL	CGASFP - FORMAL PARAMETER ASSIGNMENT

COMMENT /
PURPOSE:	TO COMPILE CODE FOR ASSIGNMENT TO FORMAL PARAMETER
ENTRY CONDITION:
		XP1 -> LHS
		XV1 CONTAINS DYNAMIC ADDRESS ACC
		XV2 CONTAINS ACC HOLDING RHS VALUE
GENERATED CODE:
		HLLZ	P(XVB)	;LOAD LEFT HALF OF FIRST FORMAL LOCATION
		EXEC	PHFS
		XWD	@XV2,@XV1
		L(D)	@XV1,@XV2	;ONLY WHEN LHS IS COMPILED FIRST
/

CGASFP:
	LF	XP2,ZIDZQU(XP1)
	L	X1,XP2
	GETAD
	LI	0
	DPB	[ACFIELD YO2ADI]
	OP	(HLLZ)
	ST	YOPCOD
	GENOP			;HLLZ INSTR.
	GPUSHJ	PHFS		;EXEC INSTR
	HRL	XV2
	HRR	XV1
	GENABS			;XWD INSTR
	IFONA	CGSWAP
	RETURN			;IF RHS COMPILED FIRST
	; CHECK IF IN MULTIPLE ASSIGNMENT
	L	X2,YLINK
	SKIPN	(X2)
	RETURN	; NOT MULTIPLE ASS
	OPZ	X2,(L)
	L	X1,XP2
	IFLONG
;***AUBEG
;GENERATE DMOVE UUO, NOT LD MACRO EXPANSION
	OPZ	X2,(DMOVE)
;***AUEND
	L	X2
	DPB	XV1,[ACFIELD]
	HRR	XV2
	GENABS
	RETURN
	SUBTTL	CGASEQ COMPARE EXPRESSION NODES

COMMENT ;
PURPOSE:	TO COMPARE THE EXPRESSIONS THAT ARE REPRESENTED
		BY TWO EXPRESSION NODES AND RETURN WITH SKIP IF THEY ARE EQUAL
ENTRY CONDITION:
		XP1 AND XP2 SHOULD POINT AT TWO EXPRESSION-NODES.
;

CGASEQ:	L	1(XP1)
	CAME	1(XP2)	;COMPARE SECOND WORDS
	RETURN	;NOT EQUAL
	IF	WHENNOT	XP1,ZNS
		GOTO	TRUE
		LF	,ZNSGEN(XP1)
		CAIE	%THIS
		GOTO	FALSE
	THEN	; TERMINAL NODES
		L	(XP1)
		XOR	(XP2)
		TLZN	577777	; COMPARE FIRST HALFWORDS
		AOS	(XPDP)
		RETURN
	ELSE	; NON-TERMINAL NODES
		STACK	XP1
		STACK	XP2
		LF	XP1,ZNSZNO(XP1)
		LF	XP2,ZNSZNO(XP2)
		LOOP
			EXEC	CGASEQ
			GOTO	NOTEQUAL
		AS
			IFON	ZNOLST(XP1)
			GOTO	FALSE	;THAT WAS LAST NODE
			STEP	XP1,ZNS
			STEP	XP2,ZNS
			GOTO	TRUE
		SA
		; EQUAL
		AOS	-2(XPDP)
	NOTEQUAL:UNSTK	XP2
		UNSTK	XP1
		RETURN
	FI

	LIT
	END