This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ummy to initialize result to 0. Compilers are typically more conservative about generating code involving global variables, and therefore less likely to rearrange the ordering of the computations. The above code depends on quirks of the compiler to get proper behavior. In fact, it only works when compiled with optimization enabled (command line ﬂag -O). When compiled without optimization, it stores result on the stack and retrieves its value just before returning, overwriting the value set by the setae instruction. The compiler has no way of knowing how the inserted assembly language relates to the rest of the code, because we provided the compiler no such information. 3.15.2 Extended Form of asm
G CC provides an extended version of the asm that allows the programmer to specify which program values are to be used as operands to an assembly code sequence and which registers are overwritten by the assembly code. With this information the compiler can generate code that will correctly set up t...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American