Related articles |
---|
[4 earlier articles] |
Re: non trivial constant folding bonzini@gnu.org (2001-01-06) |
Re: non trivial constant folding idbaxter@semdesigns.com (Ira D. Baxter) (2001-01-06) |
Re: non trivial constant folding cfc@world.std.com (Chris F Clark) (2001-01-06) |
Re: non trivial constant folding anton@mips.complang.tuwien.ac.at (2001-01-09) |
Re: non trivial constant folding anton@mips.complang.tuwien.ac.at (2001-01-09) |
Re: non trivial constant folding metzger@rsn.hp.com (Robert Metzger) (2001-01-09) |
Re: non trivial constant folding sjmeyer@www.tdl.com (2001-01-09) |
Re: non trivial constant folding henry@spsystems.net (2001-01-09) |
Re: non trivial constant folding dew@cray.com (2001-01-09) |
Re: non trivial constant folding mpointie@eden-studios.fr (Mickaƫl Pointier) (2001-01-09) |
Re: non trivial constant folding morrell@morrell.cup.hp.com (Michael Morrell) (2001-01-09) |
Re: non trivial constant folding dmr@bell-labs.com (Dennis Ritchie) (2001-01-11) |
Re: non trivial constant folding ONeillCJ@logica.com (Conor O'Neill) (2001-01-11) |
[6 later articles] |
From: | sjmeyer@www.tdl.com (Steve Meyer) |
Newsgroups: | comp.compilers |
Date: | 9 Jan 2001 23:14:23 -0500 |
Organization: | Global Network Services - Remote Access Mail & News Services |
References: | 01-01-015 01-01-022 |
Keywords: | optimize |
Posted-Date: | 09 Jan 2001 23:14:23 EST |
The old Bell Labs non portable C Compiler (early Unix compiler) had a
very good heuristic method for finding foldable constants (It is
described in Ctour document from 70s - someone posted url to it here a
while ago but I did not save it). Idea is to sort expressions by
operand complexity for communative and associative operators. Int
constant is less complex than real, etc. Then apply constant folding
after sorting. Then re-sort and re-fold until no progress or for a
few times. The sorting was most complex (on left) to least complex
order which has the added advantage that simple register assignment
algorithms do quite well on expressions with left operands more
complex.
/Steve
--
Steve Meyer Phone: (415) 296-7017
Pragmatic C Software Corp. Fax: (415) 296-0946
220 Montgomery St., Suite 925 email: sjmeyer@pragmatic-c.com
San Francisco, CA 94104
Return to the
comp.compilers page.
Search the
comp.compilers archives again.