[Q:] Implementation of global register variables

Fergus Henderson fjh@cs.mu.OZ.AU
Thu Feb 14 23:18:00 GMT 2002


On 14-Feb-2002, Fermin Reig <reig@ics.uci.edu> wrote:
> A straightforward way of implementing global register variables is by
> removing all registers that appear in global declarations from the
> pool of registers available to the allocator. Can someone confirm if
> this is how gcc does it?

Yes, that is how gcc does it.

There's a global array `fixed_regs' which records which registers
are not available for register allocation.  globalize_reg()
in regclass.c, which gets called for global register variable
declarations, sets this.  The register allocator avoids allocating
such registers.

This is an abbreviated description -- there's also a few other arrays and
HARD_REG_SETs which are used for related purposes (e.g. `global_regs',
`call_used_regs', `call_fixed_regs', and their corresponding HARD_REG_SETs
`fixed_reg_set', etc.).  For full details, read the source ;-)

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list