Path: utzoo!utgpu!attcan!uunet!husc6!bbn!rochester!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!mimsy!eneevax!haven!purdue!decwrl!hplabs!hpda!hpcuhb!hpcllla!daryl From: daryl@hpcllla.HP.COM (Daryl Odnert) Newsgroups: comp.arch Subject: Re: register save/restore Message-ID: <960006@hpcllla.HP.COM> Date: 2 Nov 88 18:46:14 GMT References: <3300037@m.cs.uiuc.edu> Organization: HP NSG/ISD California Language Lab Lines: 39 Dirk Grunwald (grunwald@m.cs.uiuc.edu) asks: > 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. Some systems use a mixed strategy. For example, both the HP Precision Architecture (HPPA) and the MIPS R2000 split up the register set into two partitions, a caller-saves set and a callee-saves set. The compiler is free to use any register in the caller-saves set without saving or restoring that register. These registers cannot be used to hold live values across procedure calls. If a register in the callee-saves (or entry-saves) set can only be used if the procedure saves the value on entry and restores it at exit. Of course, these registers can be used to hold live values across calls. > Question One: Is there an advantage? I can think of many practical advantages > to the former method (callee saves) vs. caller saves, but I can also think > of advantages to the latter. The mixed strategy seems to work well. The difficult question is determining the right number of registers to put in each of the two partitions. Some benchmarks favor larger caller-saves partitions, other could take advantage of a large callee-saves set. > Now, the second question concerns a saving convention. I'd like to know if > this has been implemented/modelled anywhere, and what the advantages are. "Minimizing Register Usage Penalty at Procedure Calls" by Fred C. Chow of MIPS Computer Systems. It is published in the "Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation" (pg 85-94.) "Register Windows vs. Register Allocation" by David W. Wall of DEC Western Research Lab. Same conference proceedings (pg 67-78). Daryl Odnert daryl%hpda@hplabs.hp.com Hewlett Packard Information Software Division