Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Bart Newsgroups: comp.compilers Subject: Re: Optimization techniques and runtime checks Date: Wed, 8 May 2019 14:58:29 +0100 Organization: virginmedia.com Lines: 32 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-05-068@comp.compilers> References: <72d208c9-169f-155c-5e73-9ca74f78e390@gkc.org.uk> <19-04-021@comp.compilers> <19-04-023@comp.compilers> <19-04-037@comp.compilers> <19-04-046@comp.compilers> <19-05-052@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="57804"; mail-complaints-to="abuse@iecc.com" Keywords: optimize, debug Posted-Date: 08 May 2019 12:47:21 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <19-05-052@comp.compilers> Content-Language: en-GB Xref: csiph.com comp.compilers:2303 On 07/05/2019 15:29, David Brown wrote: > On 29/04/2019 22:36, Hans-Peter Diettrich wrote: >> A better compiler could have a look at multiple (dependent) modules, so >> that it can apply some more global optimizations during compilation >> already. > > Indeed. And better compilers do that - it is known as "link time > optimisation", "whole program optimisation", "omniscient optimisation", > "inter-module optimisation", etc. My recent compilers (not for C; the language doesn't really allow it) have all been whole-program** compilers. Although they don't really do optimisation (it's a separate project I might get around to), they would be ideally placed as all the source code is available for all functions at the same time. There is one global, hierarchical symbol table linking all functions, variables, types etc. across the project. So anyway, thanks for confirming that mine might be one of the better compilers! Usually you are not so kind. (** The 'whole-program' is defined as all the source files that are built into a single binary executable, or single shared library. Functions in external libraries, which tend to be in another language anyway, are not included in the source visible to the compiler. Such libraries are also used only as shared libraries (eg. dll) so are never statically linked.)