Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!iuvax!pur-ee!hankd From: hankd@pur-ee.UUCP (Hank Dietz) Newsgroups: comp.arch Subject: Re: register save/restore Message-ID: <9756@pur-ee.UUCP> Date: 11 Nov 88 21:07:49 GMT References: <3300037@m.cs.uiuc.edu> <5938@killer.DALLAS.TX.US> <10600@tekecs.TEK.COM> Organization: Purdue University Engineering Computer Network Lines: 25 In article <10600@tekecs.TEK.COM>, andrew@frip.gwd.tek.com (Andrew Klossner) writes: > >>> Which is better - caller saves or callee saves? ... > >> It is, if library subroutines are to be used. A compiler cannot change > >> the procedure to be followed in this case. > > > This is actually a prime argument for caller saves. The reason is simple: > > the compiler optimizations, if constrained to be performed without changing > > the code of the called (library) routine, can only be applied in the caller. > > It is also a prime argument for callee saves. When the library routine > is being compiled, the compiler optimizations are constrained to be > performed without changing the code of the calling routine. The choice Not true! The fact that while compiling the library routines you can't change the callers is not an arguement for callee saves. The reason is that no knowledge of the caller is available when compiling the callee (the callee being the library routine), whereas complete info is available about the callee when compiling the caller. It is the availability of information about the routine you can't change which makes the best optimizations possible, and since library routines are generally callee routines which predate the callers, you can't win with callee saves. -hankd