| Variables in Specified Registers

Previous | GNU C Language Extensions | Next

GNU C allows you to put a few global variables into specified hardware registers. You can also specify the register in which an ordinary register variable should be allocated. TIGCC also allows you to specify an explicit register for function parameters.

- Defining Global Register Variables

  Global register variables reserve registers throughout the program. This may be useful in programs such as programming language interpreters which have a couple of global variables that are accessed very often.

- Specifying Registers for Local Variables

  Local register variables in specific registers do not reserve the registers. The compiler's data flow analysis is capable of determining where the specified registers contain live values, and where they are available for other uses. Stores into local register variables may be deleted when they appear to be dead according to dataflow analysis. References to local register variables may be deleted or moved or simplified.

- Specifying Registers for Function Parameters

  In TIGCC, it is possible to specify explictly where the parameters to a function a stored, in a syntax similar to global and local register variables.