Compiler design is a fascinating topic. I believe it is this together with operating systems that really got me "hooked" on computers. I couldn't put down Andrew Tanenbaum's MINIX book, it was simply fascinating. Of course, at the time I was working on my degree in mathematics. For some reason or another it never occurred to me to actually study computer science, I just picked up textbooks and read them "on the sly".

===
Gregory Woodhouse
[EMAIL PROTECTED]

"Education is a progressive discovery
of our own ignorance."
--Will Durant


On Jul 17, 2005, at 10:00 PM, Gregory Woodhouse wrote:

Compilers don't really generate assembly code (at least not anymore), but the -S option requests the compiler to produce a file containing a (PowerPC in this case) assembly language file representing the machine code that is actually generated. Typically, compilers will rewrite code considerably for the sake of efficiency. To understand why, keep in mind that not all operations take the same amount of time: retrieving a value from a register is orders of magnitude faster than retrieving the same value from main memory (because DRAM is slow, and it typically will take about 4 bus cycles, anyway). To get an idea of what kinds of "modifications" the compiler makes to your code, consider a program in which you set a variable, e.g. with something like

SET X=1

but you never, ever change the value of X. Then, it would be extremely wasteful to translate

SET Y=Y+X

by retrieving the value of X and then adding it to (the value of Y). Typically, operations at the digital logic level will execute in nanoseconds (or better), but a memory reference might take 10 microseconds (or worse). And that, of course, assumes on board memory.





-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to