Re: Writing fast compilers...

preston@helena.rice.edu (Preston Briggs)
13 Aug 91 13:46:36 GMT

          From comp.compilers

Related articles
Re: Writing fast compilers... pcg@aber.ac.uk (1991-08-11)
Re: Writing fast compilers... preston@helena.rice.edu (1991-08-11)
Re: Writing fast compilers... pardo@gar.cs.washington.edu (1991-08-13)
Re: Writing fast compilers... davidsen@crdos1.crd.ge.com (1991-08-13)
Re: Writing fast compilers... preston@helena.rice.edu (1991-08-13)
Re: Writing fast compilers... alex@vmars.tuwien.ac.at (1991-08-13)
Re: Writing fast compilers... pcg@aber.ac.uk (1991-08-14)
Re: Writing fast compilers... markh@csd4.csd.uwm.edu (1991-08-16)
Re: Writing fast compilers... glew@pdx007.intel.com (1991-08-16)
Re: Writing fast compilers... blenko-tom@CS.YALE.EDU (1991-08-16)
Re: Writing fast compilers... brnstnd@kramden.acf.nyu.edu (1991-08-18)
[2 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: preston@helena.rice.edu (Preston Briggs)
Keywords: performance, optimize
Organization: Rice University, Houston
References: <1991Aug10.132405.19359@walter.bellcore.com> <20167@helios.TAMU.EDU> <3593@crdos1.crd.ge.COM>
Date: 13 Aug 91 13:46:36 GMT

[From comp.arch -John]


davidsen@crdos1.crd.ge.com (bill davidsen) writes:


> Optimizing compilers are not going to
>produce as much improvement on well written code as they will on student
>first attempts, because the common subexpressions have be done in
>source, the invariant stuff is out of loops, the loops are unrolled, the
>register type has been used here and there... all by a one pass code
>generator called a programmer.


I'm going to poke a little at this...
IMHO, traditional optimizations (say, up to vectorization) are mostly
useful for cleaning up addressing expressions -- things that arise
when compiling


A(i, j) = A(i-1, j) * B(i, j-1)


It's the sort of thing C programmers can get at using pointer arithmetic, but
most other languages must leave alone. Field accesses are a wonderful source
of constant additions to be folded, pointer accesses offer lots of
opportunity for common subexpression elimination, and array accesses are
always great for strength reduction. If we happen to catch some extra left
in by the programmer... well, that's fine too.


If you do a good job on your basic optimization, and use some care in
instruction selection and register allocation, the compiler makes the sort of
code you'd hope for -- clean and straightforward, nothing fancy.


I remember C. A. R. Hoare writing persuasively for a language in which "a
simple straightforward 'non-pessimising' compiler will produce
straightforward object programs of acceptable efficiency." To an extent, C
and its early compilers accomplish this, but the amount of detail required of
the programmer seems extreme.


Relying on "a one pass code generator called a programmer" is inadequate.
Programmers aren't 1-pass; they go over the code repeatedly, during the
initial creation and, more importantly, during maintanence.


Therefore, I'd advocate writing clean, straightforward code that correctly
expresses the algorithm you've carefully selected and let the compiler worry
about the low level tedium that they were designed to handle.


Then, if the resulting code is inadequate (or worse, incorrect),
push hard on the vendor to improve his compiler.


Preston Briggs
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.