Google
 

Trailing-Edge - PDP-10 Archives - BB-4157D-BM - sources/vltppr.bli
There are 12 other files named vltppr.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) 1972,1977 BY DIGITAL EQUIPMENT CORPORATION
!AUTHOR: S. MURPHY/HPW
MODULE	VLTPPR(SREG=#17,VREG=#15,FREG=#16,DREGS=4,RESERVE(0,1,2,3),GLOROUTINES) =
BEGIN

GLOBAL BIND VLTPV = 2^24 + 1^18 + 44;	!VERSION DATE: 19-MAR-74

%(
REVISION HISTORY

41	-----	-----	FIX ASSIGNMENT OF LITERALS TO CONSTANTS
42	----	----	CHANGE ERROR MESSAGE CALLS TO FATLERR/WARNERR
43	-----	-----	FIX EDIT 41
44	-----	-----	ONCE AGAIN FIX ASSIGNMENT OF LITERALS

)%

	EXTERNAL
		WARNERR,FATLERR,MAKEPR,MAKPR1,TBLSEARCH;

	EXTERNAL E60,E61,E98;


	FORWARD
		EXPRTYPER(1), TPCDMY(1),ASGNTYPER(1), CNVNODE(3);

EXTERNAL	C1H,C1L,C2H,C2L,COPRIX,CNSTCMB,KTYPCB;

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








%(****TABLE OF VALUE-TYPES FOR OPERATIONS ON ARGS OF GIVEN VALUE-TYPES.
	AN ENTRY CONTAINING "VLTPERRFLG" INDICATES ILLEGAL MIXED MODE***)%
%(*****THE INDEX OF AN ENTRY IN THIS TABLE IS DETERMINED BY THE FIRST 3 BITS
	OF THE VALTYPES OF THE 2 ARGS*****)%

	BIND VLTPERRFLG=-1;

BIND VLTPTABLE = PLIT (
	OCTAL^(-2),		!FOR ARG1 OCTAL(OR LOGICAL),	ARG2 OCTAL
	OCTAL^(-2),		!			ARG2 CONTROL
	OCTAL^(-2),		!			ARG2 DOUBLE-OCTAL
	OCTAL^(-2),		!			ARG2 LITERAL
	INTEGER^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	OCTAL^(-2),		!FOR ARG1 CONTROL,	ARG2 OCTAL
	LOGICAL^(-2),		!			ARG2 CONTROL
	OCTAL^(-2),		!			ARG2 DOUBLE-OCTAL
	OCTAL^(-2),		!			ARG2 LITERAL
	INTEGER^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	OCTAL^(-2),		!FOR ARG1 DOUBLE-OCTAL,	ARG2 OCTAL(OR LOGICAL)
	OCTAL^(-2),		!			ARG2 CONTROL
	OCTAL^(-2),		!			ARG2 DOUBLE-OCTAL
	OCTAL^(-2),		!			ARG2 LITERAL
	INTEGER^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	OCTAL^(-2),		!FOR ARG1 LITERAL	ARG2 OCTAL
	OCTAL^(-2),		!			ARG2 CONTROL
	OCTAL^(-2),		!			ARG2 DOUBLE OCTAL
	OCTAL^(-2),		!			ARG2 LITERAL
	INTEGER^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	INTEGER^(-2),		!FOR ARG1 INTEGER, 	ARG2 OCTAL
	INTEGER^(-2),		!			ARG2 CONTROL
	INTEGER^(-2),		!			ARG2 DOUBLE-OCTAL
	INTEGER^(-2),		!			ARG2 LITERAL
	INTEGER^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	REAL^(-2),		!ARG1 REAL,		ARG2 OCTAL
	REAL^(-2),		!			ARG2 CONTROL
	REAL^(-2),		!			ARG2 DOUBLE-OCTAL
	REAL^(-2),		!			ARG2 LITERAL
	REAL^(-2),		!			ARG2 INTEGER
	REAL^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2),		!			ARG2 COMPLEX
	DOUBLPREC^(-2),		!FOR ARG1 DOUBLE-PREC,	ARG2 OCTAL
	DOUBLPREC^(-2),		!			ARG2 CONTROL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-OCTAL
	DOUBLPREC^(-2),		!			ARG2 LITERAL
	DOUBLPREC^(-2),		!			ARG2 INTEGER
	DOUBLPREC^(-2),		!			ARG2 REAL
	DOUBLPREC^(-2),		!			ARG2 DOUBLE-PREC
	VLTPERRFLG,		!			ARG2 COMPLEX
	COMPLEX^(-2),		!FOR ARG1 COMPLEX,	ARG2 OCTAL
	COMPLEX^(-2),		!			ARG2 CONTROL
	COMPLEX^(-2),		!			ARG2 DOUBLE-OCTAL
	COMPLEX^(-2),		!			ARG2 LITERAL
	COMPLEX^(-2),		!			ARG2 INTEGER
	COMPLEX^(-2),		!			ARG2 REAL
	VLTPERRFLG,		!			ARG2 DOUBLE-PREC
	COMPLEX^(-2)  );	!			ARG2 COMPLEX


GLOBAL ROUTINE EXPRTYPER(CNODE) =
%(***************************************************************************
	THIS ROUTINE DETERMINES THE VALUE-TYPE OF AN EXPRESSION
	NODE OF OPRCLS BOOLEAN,RELATIONAL, OR ARITHMETIC,
	AND STORES THAT TYPE IN THE "VALTYPE" FIELD OF THE NODE.
	IF ONE OF THE ARGUMENTS OF THIS NODE MUST HAVE ITS TYPE CONVERTED
	A TYPE CONVERSION NODE IS INSERTED ABOVE IT.
	IF ONE OF THE ARGUMENTS DIFFERS IN "VLTP1" FIELD FROM THE
	PARENT ("VLTP1" IS A SUBFIELD OF THE VALTYPE
	FIELD THAT DIFFERENTIATES ONLY BETWEEN INTEGER,REAL,DOUBLE PRECISION
	AND COMPLEX), THEN EVEN IF THAT ARG NEED NOT BE CONVERTED,
	A TYPE-CONVERSION NODE IS INSERTED WHICH HAS A FLAG INDICATING
	THAT NO ACTUAL CONVERSION IS NECESSARY (THIS IS NECESSARY
	FOR REGISTER ALLOCATION).
	CALLED WITH THE ARG CNODE POINTING TO THE NODE WHOSE VALTYPE
	IS TO BE DETERMINED.
	IT IS ASSUMED THAT BOTH ARGS UNDER CNODE HAVE ALREADY HAD
	THEIR VALTYPE FIELDS FILLED IN.
	RETURNS -1 IF ILLEGAL MIXED MODE IS DETECTED.
***************************************************************************)%

BEGIN
	MAP PEXPRNODE CNODE;
	OWN PEXPRNODE ARG1NODE:ARG2NODE;
	OWN VLTP1,VLTP2,VLTPN;

	%(****IF EITHER ARG UNDER AN ARITH OR RELATIONAL NODE HAS A
		DIFFERENT VALTYPE FROM THAT OF THE COMPUTATION OF THE
		RESULT - THEN INSERT A TYPE CONVERSION NODE ABOVE THAT
		ARG.
	*******)%
	MACRO CNVARGS=
	BEGIN
		IF .VLTP1 NEQ .VLTPN
		THEN CNODE[ARG1PTR]_CNVNODE(.ARG1NODE,.VLTPN^2,.CNODE);
		IF .VLTP2 NEQ .VLTPN
		THEN CNODE[ARG2PTR]_CNVNODE(.ARG2NODE,.VLTPN^2,.CNODE);
	END$;

	ARG1NODE_.CNODE[ARG1PTR];
	ARG2NODE_.CNODE[ARG2PTR];


	%(****FOR ARITHMETIC NODES -
		RESOLVE THE VALTYPES OF THE 2 ARGS AND SET THE VALTYPE
		OF THE PARENT TO THAT OF THE 2 ARGS
	*******)%
	IF .CNODE[OPRCLS] EQL ARITHMETIC
	THEN
	BEGIN
		%(***GET FIRST 3 BITS OF VALTYPE OF ARG1 AND ARG2***)%
		%(*****(NEED NOT DIFFERENTIATE INTEGER/BYTE/INDEX  NOR
			OCTAL/LOGICAL
		*********)%
		VLTP1_.ARG1NODE[VALTP2];
		VLTP2_.ARG2NODE[VALTP2];

		%(****GET VALTYPE OF PARENT********)%
		VLTPN_.VLTPTABLE[.VLTP1^3 + .VLTP2];

		%(***CHECK FOR ILLEGAL MIXED MODE - IF ENTRY IN VALTYPE
			TABLE WAS FLAG FOR ILLEGAL*****)%
		IF .VLTPN EQL VLTPERRFLG
		THEN
		BEGIN
			ENTRY[0]_.ISN;	!STMNT NUMBER
			RETURN FATLERR(.ISN,E60<0,0>);
		END;

		CNODE[VALTYPE]_.VLTPN^2;

		%(***IF ARG1 HAS A DIFFERENT VALTYPE FROM THE PARENT, INSERT A TYPE-CONVERSION
			NODE ABOVE IT*****)%
		IF .VLTP1 NEQ .VLTPN
		THEN CNODE[ARG1PTR]_CNVNODE(.ARG1NODE,.VLTPN^2,.CNODE);


		%(***IF HAVE EXPONENTIATION TO AN INTEGER POWER, DO NOT CONVERT THE
			EXPONENT. OTHERWISE, IF ARG2 HAS A DIFFERENT VALTYPE FROM
			THE PARENT, INSERT A TYPE-CONVERSION NODE ABOVE IT.***)%
		IF NOT (.CNODE[OPR1] EQL EXPONOPF AND .ARG2NODE[VA