public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* CALL_USED_REGISTERS vs CALL_REALLY_USED_REGISTERS
@ 2009-07-10  6:38 Mohamed Shafi
  2009-07-10 14:33 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Mohamed Shafi @ 2009-07-10  6:38 UTC (permalink / raw)
  To: GCC

Hello all,

The GCC 4.4.0 internal says :
[Macro] CALL_REALLY_USED_REGISTERS
Like CALL_USED_REGISTERS except this macro doesn’t require that the
entire set of
FIXED_REGISTERS be included. (CALL_USED_REGISTERS must be a superset of FIXED_
REGISTERS). This macro is optional. If not specifed, it defaults to the value of
CALL_USED_REGISTERS.

But it doesn't say why one needs to use this.
What is the need for the macro CALL_REALLY_USED_REGISTERS when
compared to CALL_USED_REGISTERS?

regards,
Shafi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: CALL_USED_REGISTERS vs CALL_REALLY_USED_REGISTERS
  2009-07-10  6:38 CALL_USED_REGISTERS vs CALL_REALLY_USED_REGISTERS Mohamed Shafi
@ 2009-07-10 14:33 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2009-07-10 14:33 UTC (permalink / raw)
  To: Mohamed Shafi; +Cc: GCC

Mohamed Shafi <shafitvm@gmail.com> writes:

> The GCC 4.4.0 internal says :
> [Macro] CALL_REALLY_USED_REGISTERS
> Like CALL_USED_REGISTERS except this macro doesn’t require that the
> entire set of
> FIXED_REGISTERS be included. (CALL_USED_REGISTERS must be a superset of FIXED_
> REGISTERS). This macro is optional. If not specifed, it defaults to the value of
> CALL_USED_REGISTERS.
>
> But it doesn't say why one needs to use this.
> What is the need for the macro CALL_REALLY_USED_REGISTERS when
> compared to CALL_USED_REGISTERS?

As the doc says, CALL_USED_REGISTERS is required to include all fixed
registers.  However, some ABIs have fixed registers which appear in the
insn stream and are not modified by calls.  It can be useful for gcc to
know that those registers are not changed by a call instruction.  In
particular, this means that if gcc uses the value of the register in an
expression which includes a call, it knows that it does not have to copy
the register into a callee-saved register to preserve the value.

For example, the MIPS register $28 aka $gp has this characteristic.  It
is a fixed register in that it is not available for the register
allocator.  However, the instruction stream will contain code to use the
register to access global variables (or small variables, depending on
the ABI).  The register is not changed by function calls, so gcc does
not have to extra steps to preserve its value.  Also, gcc can CSE $gp
plus a large offset across a function call.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-10 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10  6:38 CALL_USED_REGISTERS vs CALL_REALLY_USED_REGISTERS Mohamed Shafi
2009-07-10 14:33 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).