Using the GNU Compiler Collection (GCC): Explicit Register Variables |
---|
Next: Size of an asm, Previous: Asm Labels, Up: Using Assembly Language with C [Contents][Index]
GNU C allows you to associate specific hardware registers with C variables. In almost all cases, allowing the compiler to assign registers produces the best code. However under certain unusual circumstances, more precise control over the variable storage is required.
Both global and local variables can be associated with a register. The consequences of performing this association are very different between the two, as explained in the sections below.
• Global Register Variables: | Variables declared at global scope. | |
• Local Register Variables: | Variables declared within a function. |