Related articles |
---|
C++ virtual function calls tim@franck.Princeton.EDU (1995-09-29) |
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-10-05) |
Re: C++ virtual function calls dlmoore@ix.netcom.com (1995-10-14) |
Re: C++ virtual function calls genew@mindlink.bc.ca (1995-10-23) |
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-10-25) |
Re: C++ virtual function calls joe@sanskrit.ho.att.com (1995-10-30) |
Re: C++ virtual function calls jplevyak@violet-femmes.cs.uiuc.edu (John B. Plevyak) (1995-11-09) |
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-11-05) |
Re: C++ virtual function calls martelli@cadlab.it (1995-11-05) |
Re: C++ virtual function calls bothner@cygnus.com (Per Bothner) (1995-11-06) |
C++ virtual function calls fjh@cs.mu.OZ.AU (1995-11-12) |
[1 later articles] |
Newsgroups: | comp.compilers |
From: | cliffc@ami.sps.mot.com (Cliff Click) |
Keywords: | C++, optimize |
Organization: | none |
References: | 95-10-029 95-10-107 |
Date: | Wed, 25 Oct 1995 15:42:30 GMT |
genew@mindlink.bc.ca (Gene Wirchenko) writes:
> On hoisting function calls out of a loop:
>
> It seems to me that this could (read as "would") cause trouble where
> the hoisted routine had static variables or (shudder) diddled globals.
> Would this not be enough to result in compiler designers not taking the
> chance or can checking for these cases be done efficiently (and
> accurately)?
Certainly the compiler must do it "correctly". Code can be hoisted
if it's loop-invariant - the value produced by the code doesn't
change with the loop interations. The _value_ produced by a
subroutine call is the return value, AND all side-effects, like
modifications to static/global memory and I/O. To hoist a call
requires you to know it doesn't modify memory or do I/O (correct
exception handling behavior is another tricky question).
Cliff
--
Cliff Click Compiler Researcher & Designer
RISC Software, Motorola PowerPC Compilers
cliffc@risc.sps.mot.com (512) 891-7240
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.