Re: how to avoid a memset() optimization

"Chris F Clark" <cfc@shell01.TheWorld.com>
15 Nov 2002 00:39:13 -0500

          From comp.compilers

Related articles
[6 earlier articles]
Re: how to avoid a memset() optimization cgweav@aol.com (Clayton Weaver) (2002-11-12)
Re: how to avoid a memset() optimization n2102139816.ch@chch.demon.co.uk (Charles Bryant) (2002-11-13)
Re: how to avoid a memset() optimization dobes@dobesland.com (Dobes Vandermeer) (2002-11-13)
Re: how to avoid a memset() optimization fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-11-13)
Re: how to avoid a memset() optimization jvorbrueggen@mediasec.de (Jan C. =?iso-8859-1?Q?Vorbr=FCggen?=) (2002-11-13)
Re: how to avoid a memset() optimization usenet-1ugeabe@qeng-ho.org (Arthur Chance) (2002-11-13)
Re: how to avoid a memset() optimization cfc@shell01.TheWorld.com (Chris F Clark) (2002-11-15)
Re: how to avoid a memset() optimization usenet-1ugeabe@qeng-ho.org (Arthur Chance) (2002-11-15)
Re: how to avoid a memset() optimization joachim_d@gmx.de (Joachim Durchholz) (2002-11-17)
Re: how to avoid a memset() optimization cfc@shell01.TheWorld.com (Chris F Clark) (2002-11-20)
Re: how to avoid a memset() optimization thp@cs.ucr.edu (2002-11-24)
Re: how to avoid a memset() optimization n1096001003.ch@chch.demon.co.uk (Charles Bryant) (2002-12-01)
| List of all articles for this month |

From: "Chris F Clark" <cfc@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: 15 Nov 2002 00:39:13 -0500
Organization: The World Public Access UNIX, Brookline, MA
References: 02-11-030 02-11-069
Keywords: C, optimize
Posted-Date: 15 Nov 2002 00:39:13 EST

I have little insight to add to this discussion, but I do wish to
reply to something Charles Bryant wrote:
> In fact, it must be the linker which does this, since at compilation
> time you might not have written clrmem(). And even if such a linker
> conspires with a compiler to eliminate dead code, you can always
> write clrmem() in assembly.


The MIPS compiler suite had exactly this behavior. The compiler spit
out "intermediate" code that the linker linked, optimized (including
dead-code elimination and value propagation), and then translated into
machine language. Not only did the MIPS (now SGI) compilers use this
technology, but the early Unix compilers for DEC Alpha's used it too.
(I don't know how the current Compaq compilers deal with this issue.)


Later the DEC group I consulted for(*), took this apporach even further,
and wrote "OM" (object modifier) which took executable images (of
machine language instructions) and optimized them. Thus, when OM was
used to eliminate your dead-code, there was no hope (unless you wanted
to construct your dead code in the data segment and jump into it),
since even assembly language routines were susceptible to its reach.


(*Technically, the development of OM was done by DEC WRL (Western
Reasearch Labs), but the Unix group released it as part of their
standard compiler suite.)


Hope this helps,
-Chris


*****************************************************************************
Chris Clark Internet : compres@world.std.com
Compiler Resources, Inc. Web Site : http://world.std.com/~compres
3 Proctor Street voice : (508) 435-5016
Hopkinton, MA 01748 USA fax : (508) 435-4847 (24 hours)


Post a followup to this message

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