Re: Squashing C Source

megatest!djones@decwrl.dec.com (Dave Jones)
14 Dec 90 00:16:35 GMT

          From comp.compilers

Related articles
Squashing C Source htf@sari.edinburgh.ac.uk (H T Fallside) (1990-12-05)
Re: Squashing C Source markhall@pyrps5.pyramid.com (1990-12-11)
Re: Squashing C Source megatest!djones@decwrl.dec.com (1990-12-14)
Re: Squashing C Source pardo@cs.washington.edu (1990-12-17)
Re: Squashing C Source htf@castle.ed.ac.uk (H T Fallside) (1990-12-17)
Re: Squashing C Source leland@cs.columbia.edu (Lee Woodbury) (1990-12-17)
Re: Squashing C Source Olivier.Levillain@cl.bull.fr (1990-12-18)
| List of all articles for this month |
Newsgroups: comp.compilers
From: megatest!djones@decwrl.dec.com (Dave Jones)
Keywords: optimize
Organization: Megatest Corporation, San Jose, Ca
References: <10767.9012051639@subnode.sari.ed.ac.uk>
Date: 14 Dec 90 00:16:35 GMT

> I'm after a preprocessor that will do in-line expansion of procedure
> calls IN SOURCE for C to produce one lovely long main() procedure,
> something capable of dealing intelligently with parameters and local
> variables. Anyone out there got any ideas before I start writing ?


You might look for inspiration in "cfront" or some other C++ to C compiler
that does in-line procedure expansion. Look at the C code that it produces
for in-line calls and you'll get the flavor of it.


Now then, please tell us why in the world you would want to make an entire
program into one procedure. That will certainly make the resulting object
code slower. For one thing, on most machines, the procedure call/return is
an efficient way to save and restore registers. For another, unless the
program is a rather simple one with most procedures being called from only
one place, the program will be larger. On machines that do paging, larger
usually means slower, sometimes much slower.


If you are trying to get around some system limitation, tell us what it is
and maybe someone will come up with an alterative method.


I will leave you with one last word: "recursion". You will have to
reinvent procedure calls to handle recursion.
--


Post a followup to this message

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