Newsgroups: comp.arch Path: utzoo!utgpu!cunews!dgbt!don From: don@dgbt.doc.ca (Donald McLachlan) Subject: RE: register save Message-ID: <1991Mar11.192116.1974@dgbt.doc.ca> Sender: don@dgbt.doc.ca (Donald McLachlan) Organization: The Communications Research Centre, Ottawa, Canada Date: Mon, 11 Mar 91 19:21:16 GMT The idea of saving the return address in a register, rather than on the stack sounds nice to me, but ... This requires that the calling function knows that the called function is a leaf function, not very practical from a high level language point of view as far as I can tell. The only way I can think to generalise this would be to always put the return address in a dedicated register. This would require that the "call" would first push the old contents onto the stack and then load in the new return address. The matching return would use in the dedicated register as the return address. The function making the call would then be responsible for grabbing the old return address off the stack and loading it into the dedicated register. A further optimisation I could see for this is any function that performs a call could save the "return register" on the stack once at invocation, and restore it prior to returning. (gee isn't this what is done now:-) Now that all the mechanics are out of the way (the way I see them) only one question remains. HOW MUCH DOES THIS ACTUALLY SAVE??? I interpret this as ... What is the ratio of calls to "leaf functions" versus calls to "non-leaf functions"? Does anyone have any data, or a good guess at this last question?