Registers have various characteristics.
Number of hardware registers known to the compiler. They receive
numbers 0 through FIRST_PSEUDO_REGISTER-1
; thus, the first
pseudo register’s number really is assigned the number
FIRST_PSEUDO_REGISTER
.
An initializer that says which registers are used for fixed purposes all throughout the compiled code and are therefore not available for general allocation. These would include the stack pointer, the frame pointer (except on machines where that can be used as a general register when no frame pointer is needed), the program counter on machines where that is considered one of the addressable registers, and any other numbered register with a standard use.
This information is expressed as a sequence of numbers, separated by commas and surrounded by braces. The nth number is 1 if register n is fixed, 0 otherwise.
The table initialized from this macro, and the table initialized by
the following one, may be overridden at run time either automatically,
by the actions of the macro CONDITIONAL_REGISTER_USAGE
, or by
the user with the command options -ffixed-reg,
-fcall-used-reg and -fcall-saved-reg.
Like FIXED_REGISTERS
but has 1 for each register that is
clobbered (in general) by function calls as well as for fixed
registers. This macro therefore identifies the registers that are not
available for general allocation of values that must live across
function calls.
If a register has 0 in CALL_USED_REGISTERS
, the compiler
automatically saves it on function entry and restores it on function
exit, if the register is used within the function.
Exactly one of CALL_USED_REGISTERS
and CALL_REALLY_USED_REGISTERS
must be defined. Modern ports should define 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
).
Exactly one of CALL_USED_REGISTERS
and CALL_REALLY_USED_REGISTERS
must be defined. Modern ports should define CALL_REALLY_USED_REGISTERS
.
const predefined_function_abi &
TARGET_FNTYPE_ABI (const_tree type)
¶Return the ABI used by a function with type type; see the
definition of predefined_function_abi
for details of the ABI
descriptor. Targets only need to define this hook if they support
interoperability between several ABIs in the same translation unit.
const predefined_function_abi &
TARGET_INSN_CALLEE_ABI (const rtx_insn *insn)
¶This hook returns a description of the ABI used by the target of
call instruction insn; see the definition of
predefined_function_abi
for details of the ABI descriptor.
Only the global function insn_callee_abi
should call this hook
directly.
Targets only need to define this hook if they support interoperability between several ABIs in the same translation unit.
bool
TARGET_HARD_REGNO_CALL_PART_CLOBBERED (unsigned int abi_id, unsigned int regno, machine_mode mode)
¶ABIs usually specify that calls must preserve the full contents
of a particular register, or that calls can alter any part of a
particular register. This information is captured by the target macro
CALL_REALLY_USED_REGISTERS
. However, some ABIs specify that calls
must preserve certain bits of a particular register but can alter others.
This hook should return true if this applies to at least one of the
registers in ‘(reg:mode regno)’, and if as a result the
call would alter part of the mode value. For example, if a call
preserves the low 32 bits of a 64-bit hard register regno but can
clobber the upper 32 bits, this hook should return true for a 64-bit mode
but false for a 32-bit mode.
The value of abi_id comes from the predefined_function_abi
structure that describes the ABI of the call; see the definition of the
structure for more details. If (as is usual) the target uses the same ABI
for all functions in a translation unit, abi_id is always 0.
The default implementation returns false, which is correct for targets that don’t have partly call-clobbered registers.
const char *
TARGET_GET_MULTILIB_ABI_NAME (void)
¶This hook returns name of multilib ABI name.
void
TARGET_CONDITIONAL_REGISTER_USAGE (void)
¶This hook may conditionally modify five variables
fixed_regs
, call_used_regs
, global_regs
,
reg_names
, and reg_class_contents
, to take into account
any dependence of these register sets on target flags. The first three
of these are of type char []
(interpreted as boolean vectors).
global_regs
is a const char *[]
, and
reg_class_contents
is a HARD_REG_SET
. Before the macro is
called, fixed_regs
, call_used_regs
,
reg_class_contents
, and reg_names
have been initialized
from FIXED_REGISTERS
, CALL_USED_REGISTERS
,
REG_CLASS_CONTENTS
, and REGISTER_NAMES
, respectively.
global_regs
has been cleared, and any -ffixed-reg,
-fcall-used-reg and -fcall-saved-reg
command options have been applied.
If the usage of an entire class of registers depends on the target
flags, you may indicate this to GCC by using this macro to modify
fixed_regs
and call_used_regs
to 1 for each of the
registers in the classes which should not be used by GCC. Also make
define_register_constraint
s return NO_REGS
for constraints
that shouldn’t be used.
(However, if this class is not included in GENERAL_REGS
and all
of the insn patterns whose constraints permit this class are
controlled by target switches, then GCC will automatically avoid using
these registers when the target switches are opposed to them.)
Define this macro if the target machine has register windows. This C expression returns the register number as seen by the called function corresponding to the register number out as seen by the calling function. Return out if register number out is not an outbound register.
Define this macro if the target machine has register windows. This C expression returns the register number as seen by the calling function corresponding to the register number in as seen by the called function. Return in if register number in is not an inbound register.
Define this macro if the target machine has register windows. This C expression returns true if the register is call-saved but is in the register window. Unlike most call-saved registers, such registers need not be explicitly restored on function exit or during non-local gotos.
If the program counter has a register number, define this as that register number. Otherwise, do not define it.