This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Automatically choosing registers for register variables?


The GCC manual says that 

``Eventually there may be a way of asking the compiler to choose a register
automatacally...''

Would it be possible to implement it? My idea is: add a builtin function

  __builtin_choose_register(HINTS)

with the property

 a) it is special in that the return value is ``constant enough'' to be used in
     a ``register TYPE foo asm()'' (preprocessor expansion?)
 b) it looks for a register
 c) it honors the HINTS argument (more on this later in this message)

On the part of the machine description, there would be a macro, 
BUILTIN_CHOOSE_REG(HINTS) that returns a string containing what __builtin_
choose_register would return.  

The HINTS argument would be a bitmask contisting of the following bits:

01  Use a register normally used for global variables.  
02  Use highest register number possible (on CISC archs highest letter)
04  As last resort use memory
etc Other bits are arch-dependant

Samuel Lauber
-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com

Powered by Outblaze


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]