Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris
From: chris@umcp-cs.UUCP (Chris Torek)
Newsgroups: net.lang.c
Subject: Re: register variables allocation in Pyramids
Message-ID: <760@umcp-cs.UUCP>
Date: Fri, 5-Jul-85 19:14:49 EDT
Article-I.D.: umcp-cs.760
Posted: Fri Jul  5 19:14:49 1985
Date-Received: Sun, 7-Jul-85 04:43:08 EDT
References: <409@umcp-cs.UUCP> <1271@opus.UUCP> <2496@topaz.ARPA>
Organization: U of Maryland, Computer Science Dept., College Park, MD
Lines: 29

Close, but the temporary registers become the called procedure's
parameter registers, not vice versa.  I.e., after

_main:
	tr0 = 4		# put 4 in temp reg 0
	tr1 = 32
	call _foo

(I'm not going to use real Pyramid assembly) in foo, pr0 is 4 and
pr1 is 32.  foo's pr0 has the same address as main's tr0, of course,
so after foo does

	pr0 = 0
	ret

main has tr0 = 0.  This is how "return(expr);" works (if expr fits
in registers).  (There is also a bug in the compiler that is related
to this.)

Incidentally, although there are 16 of each type of register (global,
parameter, local, and temporary/transfer [transfer is my personal
name for 'em just before a call]), only 12 of each can be used,
since the others are "special".  (Or at least the compiler only
uses 12.  I don't know what the extra pr's, lr's, and tr's do; but
the gr's are stack & frame & so forth, I think.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland