low level optimization

Jim Giles jlg at cochiti.lanl.gov
Sat Apr 27 01:23:54 AEST 1991


In article <1991Apr24.174057.22470 at ee.eng.ohio-state.edu>, rob at kaa.eng.ohio-state.edu (Rob Carriere) rants:
|> 
|> Err, yes it can.  Someone else has already explained how to do this by
|> including optimized and non-optimized versions of the code in the same object
|> file.  Since I assume that you read less selectively than you answer, I won't
|> repeat his scheme.

Yes, and I've already pointed out that this still relies on the 
_loader_ (or some post-translation tool) to make the actual decisions
about what optimizations to use.  Since I assume that you read less
selectively than you answer, I won't repeat the discussion.

|> [...]             Mister Giles started this whole brouhaha with a claim
|> that C coudn't be optimized as well as FORTRAN, since you needed to do IM
|> analysis for that and the standard didn't allow such things. 

No, I didn't.  I started this discussion by saying that C _isn't_
optimized as well as Fortran since you need IM analysis for that 
and the standard doesn't allow such things in the _translator_ and
_no_ C implementation I've ever seen has the _loader_ (or any post-
translation tool) do the job.  Only _one_ C implementation has been
brought to my attention which does IM analysis _at_all_.  This is 
the MIPS C compiler, which does IM analysis in a non-standard way
by requiring dependent compilation.  Since I don't have access to
the MIPS compiler, this info is of only academic interest.

So - optimization of pointer arguments to procedures requires IM
analysis in C.  The translator can't do this and be standard conforming.
If the translator leaves sufficient information in the object files,
the loader (or some load-time tool) can make the optimizations (even
if this only results in selecting among several versions that the
compiler produced).  In NO present implementation that does IM analysis
is the method standard conforming.

Finally, as I have pointed out before, I consider the MIPS method
perfectly acceptable for all but commercial function libraries (which
are inherently separately compiled so the vendor doesn't have to 
distribute source).  There is nothing wrong with an implementation
which provides an interesting capability as an _extension_ to the
standard.  What I object to is the claim that the extension _is_
standard.

J. Giles



More information about the Comp.lang.c mailing list