Re: Detailed algorithms on inline optimization

Stefan Monnier <monnier@iro.umontreal.ca>
Mon, 25 Jan 2010 12:20:47 -0500

          From comp.compilers

Related articles
[8 earlier articles]
Re: Detailed algorithms on inline optimization dot@dotat.at (Tony Finch) (2010-01-21)
Re: Detailed algorithms on inline optimization bear@sonic.net (Ray) (2010-01-21)
Re: Detailed algorithms on inline optimization bobduff@shell01.TheWorld.com (Robert A Duff) (2010-01-21)
Re: Detailed algorithms on inline optimization cdodd@acm.org (Chris Dodd) (2010-01-23)
Re: Detailed algorithms on inline optimization mcrodgers@gmail.com (Martin Rodgers) (2010-01-24)
Re: Detailed algorithms on inline optimization anton@mips.complang.tuwien.ac.at (2010-01-25)
Re: Detailed algorithms on inline optimization monnier@iro.umontreal.ca (Stefan Monnier) (2010-01-25)
Re: Detailed algorithms on inline optimization kkylheku@gmail.com (Kaz Kylheku) (2010-01-28)
Re: Detailed algorithms on inline optimization martin@gkc.org.uk (Martin Ward) (2010-01-28)
Re: Detailed algorithms on inline optimization anton@mips.complang.tuwien.ac.at (2010-01-31)
Re: Detailed algorithms on inline optimization dot@dotat.at (Tony Finch) (2010-02-02)
Re: Detailed algorithms on inline optimization anton@mips.complang.tuwien.ac.at (2010-02-02)
| List of all articles for this month |
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: comp.compilers
Date: Mon, 25 Jan 2010 12:20:47 -0500
Organization: Compilers Central
References: 10-01-058 10-01-061 10-01-064
Keywords: optimize
Posted-Date: 28 Jan 2010 01:18:23 EST

>> You can inline recursive calls if you limit the depth.
>> [True. Does anyone do that, inline the first few times though and
>> then punt to the normal routine? -John]
> You can turn the recursion into a loop (if possible) and then inline
> the loop code.
> Offhand I can't point to any examples, but I'd look at Scheme and ML
> family compilers. Scheme and ML require tail recursion - at least
> simple tail recursion - to be implemented as a loop, so I'd guess that
> optimizing compilers for these languages would be able to demonstrate
> some inlining of loop-transformed recursion.


Yes, for such functional languages, all loops appear as recursive calls,
so any "loop optimisation" will apply to recursive functions as well.


In this context, John's question:


> [True. Does anyone do that, inline the first few times though and
> then punt to the normal routine? -John]


is the same as asking "does any do loop peeling?".
I can reply for some versions of SML/NJ: it tries not to do
loop-peeling, tho it can be tricked into doing it if the recursion is
not syntactically obvious; and it usually tries to inline the whole
loops. Last I heard it doesn't do loop-unrolling either.




                Stefan


Post a followup to this message

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