Re: procedures and environments

David L Moore <>
5 Nov 1999 01:35:59 -0500

          From comp.compilers

Related articles
procedures and environments debray@CS.Arizona.EDU (1999-11-04)
Re: procedures and environments (1999-11-05)
Re: procedures and environments (Max Hailperin) (1999-11-05)
Re: procedures and environments (David L Moore) (1999-11-05)
Re: procedures and environments (1999-11-05)
Re: procedures and environments (1999-11-09)
Re: procedures and environments (1999-11-09)
| List of all articles for this month |

From: David L Moore <>
Newsgroups: comp.compilers
Date: 5 Nov 1999 01:35:59 -0500
Organization: Compilers Central
References: 99-11-028
Keywords: optimize, code

John's comments are valid - many compilers do leaf procedure
optimization; a procedure which makes no further calls and has no
locals (or for which the locals can be allocated to caller save
registers) does not create a frame.

In addition, you may wish to look at implementation techniques for
Pascal like languages that allow nested procedures. These implement
"up level addressing". If the callee is nested inside the caller, the
caller's environment is still accessible.

You should also check out "Enhanced Code Compression for Embedded RISC
Processors" by Keith Cooper and Nathaniel McIntosh, presented at PLDI
99. This seems to me to be a solid attempt at what you may be
attempting to do, and they achieved less compression than I would have

I found their results interesting because many years ago I was trying
to reduce the footprint of the CDC Cyber Pascal compiler. I very
quickly determined that doing this on that compiler without register
renaming was not worth doing. Rather than doing the substantial work
to do the renaming, I wrote an overlayer instead, but I had always
wondered if I had made the correct decision.

You should consider working at the compiler intermediate language
level rather than at the machine code level. You would need to do a
literature search to confirm this, but I think that might be a field
less well ploughed. Might I suggest SUIF as a suitable intermediate
to work with?

David Moore

> (The need for this comes up in some code compression work we're
> doing, where we'd like to take identical code fragments and abstract
> them into procedures. The problem is that the procedures so created
> need to execute in their caller's environment. This feels like
> something someone must have looked at...)

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.