10.5 Implications of Instruction Set Design to the Programmer


10.5 Implications of Instruction Set Design to the Programmer

Upon initial inspection, it would seem that instruction set design is of little interest to programmers who simply want to write great code, rather than design their own instruction sets. However, only by knowing the computer's architecture and, in particular, how the CPU encodes machine instructions, can a programmer make the most efficient use of the machine's instructions. By studying instruction set design, a programmer can gain a clear understanding of the following:

  • Why some instructions are shorter than others

  • Why some instructions are faster than others

  • Which constant values the CPU can handle efficiently

  • Whether constants are more efficient than memory locations

  • Why certain arithmetic and logical operations are more efficient than others

  • Which types of arithmetic expressions are more easily translated into machine code than other types

  • Why code is less efficient if it transfers control over a large distance in the object code

. . and so on.

By studying instruction set design, a programmer becomes more aware of the implications of the code they write (even in a high-level language) with respect to efficient operation on the CPU. Armed with this knowledge, the programmer can write great code.




Write Great Code. Understanding the Machine, Vol. 1
The Art of Assembly Language
ISBN: 1593270038
EAN: 2147483647
Year: 2003
Pages: 144
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net