Inlining functions with loops

Dave Lloyd <dave@occl-cam.demon.co.uk>
Fri, 1 Dec 1995 18:25:32 GMT

          From comp.compilers

Related articles
Inlining functions with loops mpr@absoft.com (Michael Rice) (1995-11-29)
Re: Inlining functions with loops jplevyak@violet-femmes.cs.uiuc.edu (1995-11-30)
Re: Inlining functions with loops meissner@cygnus.com (Michael Meissner) (1995-11-30)
Re: Inlining functions with loops preston@tera.com (1995-11-30)
Re: Inlining functions with loops ayers@apollo.hp.com (1995-11-30)
Re: Inlining functions with loops cdg@nullstone.com (1995-12-01)
Re: Inlining functions with loops jeremy@suede.sw.oz.au (1995-12-01)
Inlining functions with loops dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-12-01)
Re: Inlining functions with loops serrano@ardeche.IRO.UMontreal.CA (1995-12-01)
Re: Inlining functions with loops tore@lis.pitt.edu (1995-12-09)
Re: Inlining functions with loops preston@tera.com (1995-12-09)
Re: Inlining functions with loops ball@Eng.Sun.COM (1995-12-09)
Re: Inlining functions with loops ok@cs.rmit.edu.au (1995-12-09)
Re: Inlining functions with loops jsa@organon.com (1995-12-09)
[1 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: Dave Lloyd <dave@occl-cam.demon.co.uk>
Keywords: optimize, C++
Organization: Compilers Central
References: 95-11-241
Date: Fri, 1 Dec 1995 18:25:32 GMT

> All C++ compilers that I am aware of will not inline a function if it
> contains any type of loop. Is anyone aware of ANY C++ compiler that
> will do this? Is anyone aware of a compiler for any language which is
> able to do this?


I'm glad to say our F90 and A68 compilers will inline procedures
regardless of form of body - obviously we have heuristics to control
automatic inlining and they are fairly draconian (based on time/space
cost of call vs cost of body with a depth limit to control recursive
expansion).


I would be surprised if the internal representation is the limit to
the inline ability of most compilers - I suspect you are seeing the
particular heuristics in play of your compiler (loops tend to be
expensive in time and space) and our heuristics, e.g., only inline
the most trivial of loops. If you delve deep enough you may find a
compiler switch to allow more expansion. You should also make sure
the procedures to be inlined are in the same compilation unit as most
compilers will only inline locally (ours included although expansion
across module boundaries is due for the next release).


Regards,
----------------------------------------------------------------------
Dave Lloyd Email: Dave@occl-cam.demon.co.uk
Oxford and Cambridge Compilers Ltd Phone: (44) 1223 572074
55 Brampton Rd, Cambridge CB1 3HJ, UK
--


Post a followup to this message

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