lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Re: `pushr' on SPARC


From: Paolo Bonzini
Subject: Re: [Lightning] Re: `pushr' on SPARC
Date: Tue, 14 Nov 2006 10:36:21 +0100
User-agent: Thunderbird 1.5.0.8 (Macintosh/20061025)

Ludovic Courtès wrote:
  %g2 through %g4

  Global integer registers 2, 3, and 4 are reserved for the application
  software.

Which I understand as: the compiler may assign specific roles to those
registers within a compilation unit, and using them arbitrarily in
lightning-generated code may interfere with the compiler's register
use.
No, they are actually caller-save registers but compilers provide a switch to disable them. GCC says:

  On non-v9 systems:
  g1 is free to use as temporary.
  g2-g4 are reserved for applications.  Gcc normally uses them as
  temporaries, but this can be disabled via the -mno-app-regs option.
  g5 through g7 are reserved for the operating system.

  On v9 systems:
  g1,g5 are free to use as temporaries, and are free to use between calls
  if the call is to an external function via the PLT.
  g4 is free to use as a temporary in the non-embedded case.
  g4 is reserved in the embedded case.
  g2-g3 are reserved for applications.  Gcc normally uses them as
  temporaries, but this can be disabled via the -mno-app-regs option.
  g6-g7 are reserved for the operating system (or application in
  embedded case).

In fact we already use one of them for JIT_R0. Something like this would be a start:

#define JIT_R_NUM               3
#define JIT_V_NUM               7
#define JIT_R(i)                _Rg((i)+2)
#define JIT_V(i)                _Rl((i))

It would free %l7 for your purpose and %l6 for a seventh callee-save register V6.

I didn't understand if you would need to add something like "move %g0, %l0" to the prolog? If so, I think the best option is to provide a JIT_NEED_PUSH_POP #define that enables a 32-byte jit_pushr/jit_popr region. If you do not define it, the frame is 104 bytes (plus the jit_allocai area), jit_pushr/jit_popr are not defined at all, and JIT_V_NUM is 8. By default it is not defined, and NEWS warns about that.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]