register variables

Jim Moore jmoore at mips.UUCP
Wed Jun 26 23:37:28 AEST 1985


> You have an infinite number of registers.  No, seriously, this is the
> way to think about it.  You should declare EVERYTHING which you don't
> have to take the address of to be a register. [...] Just be somewhat
> careful to declare things in the order you care about.

This is the method I always use in the procedures I write. I am
accustomed to programming a 68k based machine and it does not take
many references to a variable to justify any additional cost in making
it a register on that architecture.

Using this declaration method seems to be saying that the register
hint given the compiler contains no information (other than promising
not to take its address). What I really want is for the compiler to
assign as many variables to registers as it can. I would also like it
to assign to "right" variables to registers, including globals.
In this scenerio, register declarations should act as over-rides to
the compilers register allocation policy. This would result in code
with fewer register declarations, but with more information contained
in each one.

Jim Moore
MIPS Computer Systems
Mountain View, CA
ucbvax!decwrl!mips!jmoore



More information about the Comp.lang.c mailing list