Related articles |
---|
non trivial constant folding mpointie@eden-studios.fr (Mickaël Pointier) (2001-01-05) |
Re: non trivial constant folding broeker@physik.rwth-aachen.de (Hans-Bernhard Broeker) (2001-01-05) |
Re: non trivial constant folding mihai@cs.wisc.edu (Mihai Christodorescu) (2001-01-06) |
Re: non trivial constant folding pat@jantar.org (Patryk Zadarnowski) (2001-01-06) |
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) |
[9 later articles] |
From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | 9 Jan 2001 23:09:44 -0500 |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 01-01-015 |
Keywords: | optimize |
Posted-Date: | 09 Jan 2001 23:09:43 EST |
"Mickaël Pointier" <mpointie@eden-studios.fr> writes:
>My problem is that I do not manage to find a clean solution
>to optimise this:
>
>eval(1+var+1)
Others have discussed ways to optimize this at the intermediate
representation level. You can also optimize this during tree parsing
code selection, with a tree grammar like this:
Production Cost Action
rpc: reg # 0 # val=0;
rpc: Plus(rpc,const) # 0 # val=kid0.val+kid1.val;
rpc: Plus(const,rpc) # 0 # val=kid0.val+kid1.val;
rpc: Plus(rpc,rpc) # 1 # val=kid0.val+kid1.val; gen("addu ...
reg: rpc # 1 # gen("addiu ...
rpc (Reg Plus Const) is a nonterminal that represents the case where
you have to add val to the contents of a register to get the value of
the expression.
Some more examples of optimization during tree parsing can be found in
Optimization during tree-parsing code selection
(http://www.complang.tuwien.ac.at/papers/ertl00dagstuhl.ps.gz); Talk
given at the Dagstuhl Seminar on Code Optimization, September 2000.
- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Return to the
comp.compilers page.
Search the
comp.compilers archives again.