Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 1999 16:43:25 +1100 (EST)
From:      "Andrew Reilly" <andrew@lake.com.au>
To:        dillon@apollo.backplane.com
Cc:        andrew@lake.com.au, sjr@home.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Use of "register" in code
Message-ID:  <19990316054325.40786.qmail@areilly.bpc-users.org>
In-Reply-To: <199903160527.VAA06458@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Matthew Dillon said:
>     No, only the auto variable that you took the address of.  If an array or
>     structure, the entire array or structure is put on a real stack.  Other
>     auto variables are left uneffected.
> 
>     While it is true that in the olden days people would take the address of
>     one auto variable in order to reference another by indexing it, in modern
>     days the alignment and reordering optimizations made by compilers pretty
>     much nixes such uses on auto variables.  Such uses are considered
>     'bad code' these days, so compilers have no problem assuming that other
>     auto variables can remain optimized. 

Fair enough.  I was under the impression that the standard or the
compilers had been written to avoid breakage of that "bad code", and so
therefore had to be pessimistic.  If that's not the case, and they can
get away with making those optimisations anyway, then that's good.

I've had to use some pretty ordinary compilers.  They still exist, and
are still shipped with new systems.  

>     specific processor or compiler - usually the VAX.  As kernel code started
>     to migrate to other processors, such optimizations have historically
>     produced *WORSE* code on the other processors.  So people stopped using
>     'register' and started expecting compilers to optimize it themselves.

But how is using 'register' with gcc in FreeBSD going to make
performance _worse_, given that gcc is quite happy to move register
variables to and from the stack?

I'll shut up now.

-- 
Andrew



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990316054325.40786.qmail>