Re: Is inlining evil?

Marc Sabatella <mjs@hpfcso.fc.hp.com>
Wed, 8 May 91 11:17:59 mdt

          From comp.compilers

Related articles
Is inlining evil? mike@vlsivie.tuwien.ac.at (Michael K. Gschwind) (1991-05-03)
Re: Is inlining evil? hoelzle@neon.Stanford.EDU (1991-05-04)
Re: Is inlining evil? quale@cs.wisc.edu (1991-05-04)
Re: Is inlining evil? clark@ingr.com (Clark Williams) (1991-05-05)
Re: Is inlining evil? mjs@hpfcso.fc.hp.com (Marc Sabatella) (1991-05-08)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Marc Sabatella <mjs@hpfcso.fc.hp.com>
Keywords: optimize, design
Organization: Compilers Central
References: <9105031304.AA00625@slave.vlsivie.tuwien.ac.at>
Date: Wed, 8 May 91 11:17:59 mdt

Preston makes some good points about "naive inlining". But there is no
particular reason inlining need be so naive. The HP-UX C and Fortran
compilers for 680x0 do inlining under +O3, and the programmer is offered
considerable control over the inlining process via command line options
and compiler directives. The default for +O3 is to inline any function
that is under a certain size, but that measurement is made before any of
its own calls are inlined, so you can easily end up with a sort of
combinatorial explosion. However, you can set the size limit, also you
can (via directive) turn on or off inlining for a particular function, and
you can even turn off the inlining at the point of call, so that some
calls to a given function are inlined and others aren't. You can also
control whether standalone code for the function should also be emitted
(to allow external calls).


My own experience on a small but very "real" program is that after spending
a day or two experimenting, figuring out which calls to inline and which not
to, I ended up with a program that was 10% larger and 10% faster, and I
considered the whole deal to be a fair tradeoff of my time, run time, and
space.


--------------
Marc Sabatella (marc@hpmonk.fc.hp.com)
--


Post a followup to this message

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