Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!gatech!cuae2!ltuxa!cuuxb!mwm From: mwm@cuuxb.UUCP (Marc W. Mengel) Newsgroups: comp.arch Subject: Re: Available no. of registers Message-ID: <1029@cuuxb.UUCP> Date: Thu, 22-Jan-87 00:04:27 EST Article-I.D.: cuuxb.1029 Posted: Thu Jan 22 00:04:27 1987 Date-Received: Thu, 22-Jan-87 19:56:52 EST References: <3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP> Reply-To: mwm@cuuxb.UUCP (Marc W. Mengel) Organization: AT&T-IS, Software Support, Lisle IL Lines: 33 In article <759@vaxb.calgary.UUCP> radford@calgary.UUCP writes: >Shouldn't a compiler smart enough to allocate variables to registers be >smart enough to see that a local variable is never the operand of the >& (address-of) operator, and thus cannot be referenced by a pointer? >Both of these tasks seem to require that the procedure be completely >scanned before code generation. Unfortunately, you don't have to take the address of a given variable to use it, you merely have to take the address of a variable near it and add an offset to it. The way C is defined, this is quite legal. For example, suppose I have a function f, declared as follows: f(p) struct { int a, b, c; } *p; { ... } And I call it as follows: b() { int a, b, c; f( &a ); } According to our venerable friends kerningham&ritchie, this is legal; it is also used to some great extent in the older (v6 & v7) unix kernels. > Radford Neal > The University of Calgary -- Marc Mengel ...!ihnp4!cuuxb!mwm