gccint: Register Basics
1
1 18.7.1 Basic Characteristics of Registers
1 -----------------------------------------
1
1 Registers have various characteristics.
1
1 -- Macro: FIRST_PSEUDO_REGISTER
1 Number of hardware registers known to the compiler. They receive
1 numbers 0 through 'FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo
1 register's number really is assigned the number
1 'FIRST_PSEUDO_REGISTER'.
1
1 -- Macro: FIXED_REGISTERS
1 An initializer that says which registers are used for fixed
1 purposes all throughout the compiled code and are therefore not
1 available for general allocation. These would include the stack
1 pointer, the frame pointer (except on machines where that can be
1 used as a general register when no frame pointer is needed), the
1 program counter on machines where that is considered one of the
1 addressable registers, and any other numbered register with a
1 standard use.
1
1 This information is expressed as a sequence of numbers, separated
1 by commas and surrounded by braces. The Nth number is 1 if
1 register N is fixed, 0 otherwise.
1
1 The table initialized from this macro, and the table initialized by
1 the following one, may be overridden at run time either
1 automatically, by the actions of the macro
1 'CONDITIONAL_REGISTER_USAGE', or by the user with the command
1 options '-ffixed-REG', '-fcall-used-REG' and '-fcall-saved-REG'.
1
1 -- Macro: CALL_USED_REGISTERS
1 Like 'FIXED_REGISTERS' but has 1 for each register that is
1 clobbered (in general) by function calls as well as for fixed
1 registers. This macro therefore identifies the registers that are
1 not available for general allocation of values that must live
1 across function calls.
1
1 If a register has 0 in 'CALL_USED_REGISTERS', the compiler
1 automatically saves it on function entry and restores it on
1 function exit, if the register is used within the function.
1
1 -- Macro: CALL_REALLY_USED_REGISTERS
1 Like 'CALL_USED_REGISTERS' except this macro doesn't require that
1 the entire set of 'FIXED_REGISTERS' be included.
1 ('CALL_USED_REGISTERS' must be a superset of 'FIXED_REGISTERS').
1 This macro is optional. If not specified, it defaults to the value
1 of 'CALL_USED_REGISTERS'.
1
1 -- Target Hook: bool TARGET_HARD_REGNO_CALL_PART_CLOBBERED (unsigned
1 int REGNO, machine_mode MODE)
1 This hook should return true if REGNO is partly call-saved and
1 partly call-clobbered, and if a value of mode MODE would be partly
1 clobbered by a call. For example, if the low 32 bits of REGNO are
1 preserved across a call but higher bits are clobbered, this hook
1 should return true for a 64-bit mode but false for a 32-bit mode.
1
1 The default implementation returns false, which is correct for
1 targets that don't have partly call-clobbered registers.
1
1 -- Target Hook: void TARGET_CONDITIONAL_REGISTER_USAGE (void)
1 This hook may conditionally modify five variables 'fixed_regs',
1 'call_used_regs', 'global_regs', 'reg_names', and
1 'reg_class_contents', to take into account any dependence of these
1 register sets on target flags. The first three of these are of
1 type 'char []' (interpreted as boolean vectors). 'global_regs' is
1 a 'const char *[]', and 'reg_class_contents' is a 'HARD_REG_SET'.
1 Before the macro is called, 'fixed_regs', 'call_used_regs',
1 'reg_class_contents', and 'reg_names' have been initialized from
1 'FIXED_REGISTERS', 'CALL_USED_REGISTERS', 'REG_CLASS_CONTENTS', and
1 'REGISTER_NAMES', respectively. 'global_regs' has been cleared,
1 and any '-ffixed-REG', '-fcall-used-REG' and '-fcall-saved-REG'
1 command options have been applied.
1
1 If the usage of an entire class of registers depends on the target
1 flags, you may indicate this to GCC by using this macro to modify
1 'fixed_regs' and 'call_used_regs' to 1 for each of the registers in
1 the classes which should not be used by GCC. Also make
1 'define_register_constraint's return 'NO_REGS' for constraints that
1 shouldn't be used.
1
1 (However, if this class is not included in 'GENERAL_REGS' and all
1 of the insn patterns whose constraints permit this class are
1 controlled by target switches, then GCC will automatically avoid
1 using these registers when the target switches are opposed to
1 them.)
1
1 -- Macro: INCOMING_REGNO (OUT)
1 Define this macro if the target machine has register windows. This
1 C expression returns the register number as seen by the called
1 function corresponding to the register number OUT as seen by the
1 calling function. Return OUT if register number OUT is not an
1 outbound register.
1
1 -- Macro: OUTGOING_REGNO (IN)
1 Define this macro if the target machine has register windows. This
1 C expression returns the register number as seen by the calling
1 function corresponding to the register number IN as seen by the
1 called function. Return IN if register number IN is not an inbound
1 register.
1
1 -- Macro: LOCAL_REGNO (REGNO)
1 Define this macro if the target machine has register windows. This
1 C expression returns true if the register is call-saved but is in
1 the register window. Unlike most call-saved registers, such
1 registers need not be explicitly restored on function exit or
1 during non-local gotos.
1
1 -- Macro: PC_REGNUM
1 If the program counter has a register number, define this as that
1 register number. Otherwise, do not define it.
1