Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!gatech!lll-lcc!pyramid!csg From: csg@pyramid.UUCP Newsgroups: comp.arch Subject: Re: Aliasing, etc. in C Message-ID: <1531@pyramid.UUCP> Date: Tue, 3-Feb-87 03:59:00 EST Article-I.D.: pyramid.1531 Posted: Tue Feb 3 03:59:00 1987 Date-Received: Wed, 4-Feb-87 02:27:35 EST References: <7803@decwrl.DEC.COM> <5230@mimsy.UUCP> <12570@sun.uucp> Reply-To: csg@pyramid.UUCP (Carl S. Gutekunst) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 26 >>Nor is Pyramid's implementation, which is considerably more complex and >>does *not* rely upon `ptr = &a; ptr++;' pointing to `b' (which is >>only sometimes the case). > >I presume this is because it's a register-window machine, and some >parameters may be passed in registers, so that not all of the >parameters are necessarily stored in memory? Exactly. The first 12 scalar arguments are passed through the register window, from left to right in registers pr0, pr1, pr2, etc. Structures (including one- word structs) and args beyond the 12th are pushed on the stack in order from right to left (VAX style). Doubles need two registers and are always aligned on an 8-byte boundary (to prevent an argument from straddling the register file and the stack). Since you can take the address of a register on the Pyramid, it is possible to do a VAX style varargs so long as you don't try to pass structs or doubles, or use more than 12 arguments. Like Chris said, "only sometimes the case." If you try taking the address of local variables, which is where this silly discussion started, you are totally hosed. The order of assignment in the register file is picked by the compiler, based on the frequency of reference. And if you declare "int a, b" and the references to them are isolated from each other, they will likely end up being the same register.