This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to not fold constants?
- To: egcs at gcc dot gnu dot org
- Subject: Re: How to not fold constants?
- From: Geoff Keating <geoffk at ozemail dot com dot au>
- Date: 11 Aug 1999 15:30:25 +1000
- References: <6933.934346002@upchuck.cygnus.com>
Jeffrey A Law <law@cygnus.com> writes:
> In message <37B0A847.B4EC8D0A@moene.indiv.nluug.nl>you write:
> > > Yes. There might be integer expressions inside that we want to fold.
> >
> > Is that true - shouldn't the *frontend* decide how to interpret mixed
> > mode expressions ? Or is fold-const.c so tied up with C that the
> > Fortran frontend probably shouldn't use it ?!?
> fold-const.c is supposed to be generic enough to be used by any front end. If
> we need to extend the tree structures to indicate when certain folds are safe
> vs not safe, then that's the way to deal with these problems.
>
> Similarly for the folding routines found in cse & combine; they are supposed to
> be language independent.
cse (& combine?) will need to be changed at a higher level; if you have
#pragma STDC FENV_ACCESS ON
void foo(void);
double bar(double x)
{
double y;
y = x + x;
foo(void);
y += x + x;
return y;
}
you must still perform three '+' operations, despite the common
subexpression, because foo() may change the rounding mode or test
the exception flags (the addition may overflow, for instance).
--
Geoffrey Keating <geoffk@cygnus.com>