Article View: comp.arch
Article #12858Re: Available no. of registers
From: Marc W. Mengel
Date: Thu, 22 Jan 1987 05:04
Date: Thu, 22 Jan 1987 05:04
33 lines
1602 bytes
1602 bytes
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
Technical Details
Message-ID:
<1029@cuuxb.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcnc!gatech!cuae2!ltuxa!cuuxb!mwmReferences:
<3810002@nucsrl.UUCP> <926@mips.UUCP> <759@vaxb.calgary.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!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