Newsgroups: comp.arch Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: register save/restore Message-ID: <1988Oct30.013510.16861@utzoo.uucp> Organization: U of Toronto Zoology References: <3300037@m.cs.uiuc.edu> Date: Sun, 30 Oct 88 01:35:10 GMT In article <3300037@m.cs.uiuc.edu> grunwald@m.cs.uiuc.edu writes: >Many (most UNIX ) systems apply the convention that the callee must save >any registers used in a procedure. Other systems dictate that the caller >must save the registers. ... Is there an advantage? As usual, it depends. Ideally, one wants to save and restore registers as little as possible, because it costs time and memory. The caller knows which registers don't have to be saved because they don't contain anything interesting. The callee knows which registers don't have to be saved because he's going to leave them alone anyway. Neither is clearly superior for all situations. It's not unheard-of to split the available registers into a callee-saved group and a caller-saved group. (What does MIPS do?) The callee-saves bias in Unix is basically historical. On the 11, there were so few free registers that the calling sequence simply saved and restored all of them, and doing this in the callee saved code space. (This is a slight oversimplification.) On the VAX, the wonderful all- singing all-dancing standard calling sequence provided by the hardware encouraged callee-saves. Not everyone has bothered to rethink the issues when changing processors. -- The dream *IS* alive... | Henry Spencer at U of Toronto Zoology but not at NASA. |uunet!attcan!utzoo!henry henry@zoo.toronto.edu