Date: Thu, 08 Oct 1998 18:00:29 -0600 From: Wes Peters <wes@softweyr.com> To: Peter Jeremy <peter.jeremy@auss2.alcatel.com.au> Cc: freebsd-stable@FreeBSD.ORG Subject: Re: Global register variables in gcc and stdio.h?!? Message-ID: <361D521D.CFF9305C@softweyr.com> References: <98Oct9.071633est.40326@border.alcanet.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Wes Peters <wes@softweyr.com> wrote: % The compiler is a whole lot smarter about register allocation than % you are, especially on an architecture where there aren't any. Peter Jeremy wrote: > Actually, on a true 0 or 1-address architecture, register allocation > is trivial. The real difficulties occur with architectures that have > a small number of registers which aren't quite all general purpose. Like the x86. Remember AX = accumulator, BX = base, CX = counter, DX = destination, SI = source index, DI = destination index, etc? Yes, I KNOW most programmers use SI and DI like they're general purpose registers, but they're really not. I will amend my original statement, at least for x86, to "The compiler is a whole lot better than you at NOT screwing up it's register allocation and getting something out of whack." As was posted in another response, the best way to approach this is to write the code in the most obvious fashion possible, get it completely and thoroughly debugged, then time it to see if it meets it's goals. If so, LEAVE IT ALONE! If not, profile the code to determine where you can do some good, and optimize the top 1 or 2 functions. Repeat until done. Once you start delving into register allocation to solve performance problems, you're getting to the point where you need to isolate the real performance bottleneck and code that (and ONLY that) in assembler, using somebody who's really good. Especially on the fart-brained x86. (Registers? Huh? Why would you want registers, you already have RAM!) -- Where am I, and what am I doing in this handbasket? Wes Peters +1.801.915.2061 Softweyr LLC wes@softweyr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?361D521D.CFF9305C>