From: "Marin David Condic, 407.796.8997, M/S 731-93" <condicma@PWFL.COM>
Subject: Re: Can compilers do this?
Date: 1996/02/26
Date: 1996-02-26T00:00:00+00:00 [thread overview]
Message-ID: <96022613123645@psavax.pwfl.com> (raw)
Robert Dewar <dewar@CS.NYU.EDU> writes:
>Subject: Re: Can compilers do this?
>
>BwB says
>
>"Also, suppose Y and X are floating point variables, and M and B are
>CONSTANT floating point variables (not named numbers) initialized to
>1.0 and 0.0 respectively. If one writes
>
> Y := M * X + B ;
>
>can (and will) any compiler reduce this to
>
> Y := X ;
>
>
>Sure, this is just standard constant propagation, a very common
>optimization.
>
Except that you might not always want to. Constant folding can be
a "good" optimization from a speed standpoint, but a "bad"
optimization from a test standpoint.
When we build control systems, we typically like to keep tables
and assorted "constants" as "rubber constants". They are declared
constants so that the program can't change the values, but when
they're loaded into the box, we can change them with test
equipment in order to affect "trim" on the control or accomplish
other test stuff. If they were optimized away, you couldn't do
this.
The EDS-Scicon compiler we are working with gives us a "pragma
VOLATILE" command to make sure that the constants aren't optimized
away. I personally think anyone making a compiler for embedded
systems should provide a similar option
Pax,
MDC
Marin David Condic, Senior Computer Engineer ATT: 407.796.8997
M/S 731-93 Technet: 796.8997
Pratt & Whitney, GESP Fax: 407.796.4669
P.O. Box 109600 Internet: CONDICMA@PWFL.COM
West Palm Beach, FL 33410-9600 Internet: MDCONDIC@AOL.COM
===============================================================================
"Nobody shot me."
-- Last words of Frank Gusenberg when asked by police who
shot him fourteen times with a machine gun in the Saint
Valentine's Day Massacre.
===============================================================================
next reply other threads:[~1996-02-26 0:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-02-26 0:00 Marin David Condic, 407.796.8997, M/S 731-93 [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-02-22 0:00 Can compilers do this? BWBurnsed
1996-02-23 0:00 ` Cordes MJ
1996-02-23 0:00 ` Robert Dewar
1996-02-23 0:00 ` Robert Dewar
1996-02-23 0:00 ` Mark A Biggar
1996-02-24 0:00 ` Robert A Duff
1996-02-23 0:00 ` Robert Dewar
1996-02-25 0:00 ` Robert Dewar
1996-02-23 0:00 ` Stuart Palin
1996-02-26 0:00 ` Robert I. Eachus
1996-02-26 0:00 ` BWBurnsed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox