Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!grunwald From: grunwald@m.cs.uiuc.edu Newsgroups: comp.arch Subject: register save/restore Message-ID: <3300037@m.cs.uiuc.edu> Date: 28 Oct 88 04:34:00 GMT Lines: 43 Nf-ID: #N:m.cs.uiuc.edu:3300037:000:1968 Nf-From: m.cs.uiuc.edu!grunwald Oct 27 23:34:00 1988 This question is follows the line of recent questions concerning register save/restore conventions. 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. 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. 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. Presume that we have a mask of dirty bits for the register file. Presume that each procedure specifies a bit mask of registers that are used (as is already done on the 680x0 and NS32x32). The only registers that need to be saved are those denoted by the AND-ed product of the two bit masks. The initial dirty mask of the called procedure would contain those bits that didn't get AND-ed (i.e. those registers that aren't used by the current procedure but still contain live data). When registers get over-written, their dirty bit is set. This has the advantage of saving only those registers that actually need to be saved. The cost is similar to current register load/unload masks, for common architectures. There's a cost/perf. tradeoff as register sets get larger. For 64 registers, you'd need a double-longword of bits for the masks (although you'd probably split it into two 32 bit sets, since very few procedures would use more than 32 registers, and those procedures could just execute two instructions). It would require some slight changes to compilers. You'd like to randomize register accesses across subroutines, or perhaps record information about register acessses in other subroutines so you don't select the same registers they used. So, has this been done before? Modelled? Any data? Dirk Grunwald Univ. of Illinois grunwald@m.cs.uiuc.edu