Assembly or ....

Fraser Orr orr at cs.glasgow.ac.uk
Tue Nov 29 03:44:36 AEST 1988


In article <1031 at l.cc.purdue.edu> cik at l.cc.purdue.edu (Herman Rubin) writes:
<A few of the compilers I have seen do a fair job; the others would get 
<a D--.  (Since D-- = C in C, this might be why C is so bad :-))  But one
<of the most amazing things that I have seen in the workings of the 
<designers is the assumption that the compiler has all the information
<necessary to produce optimized code!  There is no provision for input
<as to frequency of branches.  Should the common condition be the branch
<or the rare condition?  Does it make a difference in the combination?
<Since I have examples where the branches are of comparable frequencies,
<examples where the ratio of the frequencies are from 10-200, where the
<ratio is a few thousand, and where one branch may never occur, I certainly
<feel that I have input.  I think the compilers should be interactive, and
<discuss the various possibilities with the programmer.  I can even give
<cases where the dictum to remove a calculation from within a loop is wrong.

I agree entirely (including with the cheap jibe against C:^>). I think
that there would be great improvements if compilers were interactive.
Not perhaps realised with low level languages like C and its ilk,
but certainly realised in much higher level programming languages.
Interactive isn't necessarily the best by the way, since it means
you have to repeat yourself, and the decisions are not documented
in the program. There is no reason why you can't have an "advice"
command, that advises the compiler the best implementation. (Doesn't
"advise" sound so much better than "pragma"?)

<Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907

==Fraser Orr ( Dept C.S., Univ. Glasgow, Glasgow, G12 8QQ, UK)
UseNet: {uk}!cs.glasgow.ac.uk!orr       JANET: orr at uk.ac.glasgow.cs
ARPANet(preferred xAtlantic): orr%cs.glasgow.ac.uk at nss.cs.ucl.ac.uk



More information about the Comp.lang.c mailing list