FreeBSD Most wanted

stephan mantler step at stephanmantler.com
Sat Mar 6 13:41:55 PST 2004


Narvi wrote:
>>"Familiarity with the target machine and its instruction set is a
>>prerequisite for designing a good code generator.  Unfortunately, in a
>>general discussion of code generation it is not possible to describe
>>the nuances of any target machine in sufficient detail to be able to
>>generate good code for a complete language on that machine."
>>  -- The "Dragon" Book, pp 519
> 
> Sure - but code generation is but one part of the compiler and usualy not
> the largest.

Well, it is still a crucial part of the compiler and deeply tied into the
rest. It is also the reason why simply using the Intel C++ compiler instead
of .NET2003 (both at full optimization) made our vector math library run
five times faster... guess who knows the target architecture ;-)  In this
highly specific example hand optimized assembler code is another four times
faster for some functions, but I think this is not a problem of compilers per
se. I guess the C/C++ language simply isn't giving the compiler all the
information it would need. I haven't yet tried Intel's feedback optimization
feature, but it will be interesting to see what it will do to our library.

Also, to get a bit closer to the original topic. I can't remember where I
read this (DDJ probably), but apparently programmers who have a deep
understanding of computer architecture through low level programming also
produce "better" code in high level languages. My interpretation is that
they are simply feeding the compiler a better foundation to work with.

Cheers,
-stephan

-- 
stephan mantler             | web www.stephanmantler.com
----------------------------| net step at stephanmantler.com
It's not an adventure       | fon +43 (699) 104 128 42
until something f--ks up.   | fax +43 (699) 404 128 42



More information about the freebsd-chat mailing list