In addition to the file `machine.md', a machine description includes a C header file conventionally given the name `machine.h'. This header file defines numerous macros that convey the information about the target machine that does not fit into the scheme of the `.md' file. The file `tm.h' should be a link to `machine.h'. The header file `config.h' includes `tm.h' and most compiler source files include `config.h'.
You can control the compilation driver.
SWITCH_TAKES_ARG (char)
WORD_SWITCH_TAKES_ARG (name)
SWITCH_TAKES_ARG is used for multi-character option names.
By default, this macro is defined as
DEFAULT_WORD_SWITCH_TAKES_ARG, which handles the standard options
properly. You need not define WORD_SWITCH_TAKES_ARG unless you
wish to add additional options which take arguments. Any redefinition
should call DEFAULT_WORD_SWITCH_TAKES_ARG and then check for
additional options.
SWITCHES_NEED_SPACES
CPP_SPEC
NO_BUILTIN_SIZE_TYPE
__SIZE_TYPE__. The macro __SIZE_TYPE__ must then be defined
by CPP_SPEC instead.
This should be defined if SIZE_TYPE depends on target dependent flags
which are not accessible to the preprocessor. Otherwise, it should not
be defined.
NO_BUILTIN_PTRDIFF_TYPE
__PTRDIFF_TYPE__. The macro __PTRDIFF_TYPE__ must then be
defined by CPP_SPEC instead.
This should be defined if PTRDIFF_TYPE depends on target dependent flags
which are not accessible to the preprocessor. Otherwise, it should not
be defined.
SIGNED_CHAR_SPEC
char will be treated as
unsigned char by cc1.
Do not define this macro unless you need to override the default
definition.
CC1_SPEC
cc1. It can also specify how to translate options you
give to GNU CC into options for GNU CC to pass to the cc1.
Do not define this macro if it does not need to do anything.
CC1PLUS_SPEC
cc1plus. It can also specify how to translate options you
give to GNU CC into options for GNU CC to pass to the cc1plus.
Do not define this macro if it does not need to do anything.
ASM_SPEC
ASM_FINAL_SPEC
LINK_SPEC
LIB_SPEC
LINK_SPEC. The difference
between the two is that LIB_SPEC is used at the end of the
command given to the linker.
If this macro is not defined, a default is provided that
loads the standard C library from the usual place. See `gcc.c'.
LIBGCC_SPEC
LIB_SPEC.
If this macro is not defined, the GNU CC driver provides a default that
passes the string `-lgcc' to the linker unless the `-shared'
option is specified.
STARTFILE_SPEC
LINK_SPEC. The
difference between the two is that STARTFILE_SPEC is used at
the very beginning of the command given to the linker.
If this macro is not defined, a default is provided that loads the
standard C startup file from the usual place. See `gcc.c'.
ENDFILE_SPEC
LINK_SPEC. The
difference between the two is that ENDFILE_SPEC is used at
the very end of the command given to the linker.
Do not define this macro if it does not need to do anything.
LINK_LIBGCC_SPECIAL
LINK_LIBGCC_SPECIAL_1
LINK_LIBGCC_SPECIAL, except that it does
not affect `-L' options.
MULTILIB_DEFAULTS
MULTILIB_OPTIONS.
Do not define this macro if MULTILIB_OPTIONS is not defined in
the target makefile fragment or if none of the options listed in
MULTILIB_OPTIONS are set by default.
See section The Target Makefile Fragment.
RELATIVE_PREFIX_NOT_LINKDIR
gcc that it should only translate
a `-B' prefix into a `-L' linker option if the prefix
indicates an absolute file name.
STANDARD_EXEC_PREFIX
MD_EXEC_PREFIX
STANDARD_EXEC_PREFIX. MD_EXEC_PREFIX is not searched
when the `-b' option is used, or the compiler is built as a cross
compiler.
STANDARD_STARTFILE_PREFIX
MD_STARTFILE_PREFIX
MD_EXEC_PREFIX is not searched when the
`-b' option is used, or when the compiler is built as a cross
compiler.
MD_STARTFILE_PREFIX_1
INIT_ENVIRONMENT
putenv to
initialize the necessary environment variables.
LOCAL_INCLUDE_DIR
LOCAL_INCLUDE_DIR
comes before SYSTEM_INCLUDE_DIR in the search order.
Cross compilers do not use this macro and do not search either
`/usr/local/include' or its replacement.
SYSTEM_INCLUDE_DIR
SYSTEM_INCLUDE_DIR comes before
STANDARD_INCLUDE_DIR in the search order.
Cross compilers do not use this macro and do not search the directory
specified.
STANDARD_INCLUDE_DIR
INCLUDE_DEFAULTS
GCC_INCLUDE_DIR, LOCAL_INCLUDE_DIR,
SYSTEM_INCLUDE_DIR, GPLUSPLUS_INCLUDE_DIR, and
STANDARD_INCLUDE_DIR. In addition, GPLUSPLUS_INCLUDE_DIR
and GCC_INCLUDE_DIR are defined automatically by `Makefile',
and specify private search areas for GCC. The directory
GPLUSPLUS_INCLUDE_DIR is used only for C++ programs.
The definition should be an initializer for an array of structures.
Each array element should have two elements: the directory name (a
string constant) and a flag for C++-only directories. Mark the end of
the array with a null element. For example, here is the definition used
for VMS:
#define INCLUDE_DEFAULTS \
{ \
{ "GNU_GXX_INCLUDE:", 1}, \
{ "GNU_CC_INCLUDE:", 0}, \
{ "SYS$SYSROOT:[SYSLIB.]", 0}, \
{ ".", 0}, \
{ 0, 0} \
}
Here is the order of prefixes tried for exec files:
GCC_EXEC_PREFIX, if any.
COMPILER_PATH.
STANDARD_EXEC_PREFIX.
MD_EXEC_PREFIX, if any.
Here is the order of prefixes tried for startfiles:
GCC_EXEC_PREFIX, if any.
LIBRARY_PATH
(native only, cross compilers do not use this).
STANDARD_EXEC_PREFIX.
MD_EXEC_PREFIX, if any.
MD_STARTFILE_PREFIX, if any.
STANDARD_STARTFILE_PREFIX.
Here are run-time target specifications.
CPP_PREDEFINES
"-Dmc68000 -Dsun -Dunix"The result is to define the macros
__mc68000__, __sun__
and __unix__ unconditionally, and the macros mc68000,
sun and unix provided `-ansi' is not specified.
extern int target_flags;
TARGET_...
TARGET_68020 that tests a bit in
target_flags.
Define a macro TARGET_featurename for each such option.
Its definition should test a bit in target_flags; for example:
#define TARGET_68020 (target_flags & 1)One place where these macros are used is in the condition-expressions of instruction patterns. Note how
TARGET_68020 appears
frequently in the 68000 machine description file, `m68k.md'.
Another place they are used is in the definitions of the other
macros in the `machine.h' file.
TARGET_SWITCHES
target_flags. Its definition is an initializer
with a subgrouping for each command option.
Each subgrouping contains a string constant, that defines the option
name, and a number, which contains the bits to set in
target_flags. A negative number says to clear bits instead;
the negative of the number is which bits to clear. The actual option
name is made by appending `-m' to the specified name.
One of the subgroupings should have a null string. The number in
this grouping is the default value for target_flags. Any
target options act starting with that value.
Here is an example which defines `-m68000' and `-m68020'
with opposite meanings, and picks the latter as the default:
#define TARGET_SWITCHES \
{ { "68020", 1}, \
{ "68000", -1}, \
{ "", 1}}
TARGET_OPTIONS
TARGET_SWITCHES but defines names of command
options that have values. Its definition is an initializer with a
subgrouping for each command option.
Each subgrouping contains a string constant, that defines the fixed part
of the option name, and the address of a variable. The variable, type
char *, is set to the variable part of the given option if the fixed
part matches. The actual option name is made by appending `-m' to the
specified name.
Here is an example which defines `-mshort-data-number'. If the
given option is `-mshort-data-512', the variable m88k_short_data
will be set to the string "512".
extern char *m88k_short_data;
#define TARGET_OPTIONS \
{ { "short-data-", &m88k_short_data } }
TARGET_VERSION
stderr a string
describing the particular machine description choice. Every machine
description should define TARGET_VERSION. For example:
#ifdef MOTOROLA #define TARGET_VERSION \ fprintf (stderr, " (68k, Motorola syntax)"); #else #define TARGET_VERSION \ fprintf (stderr, " (68k, MIT syntax)"); #endif
OVERRIDE_OPTIONS
OVERRIDE_OPTIONS to take account of this. This macro, if
defined, is executed once just after all the command options have been
parsed.
Don't use this macro to turn on various extra optimizations for
`-O'. That is what OPTIMIZATION_OPTIONS is for.
OPTIMIZATION_OPTIONS (level)
write_symbols in
this macro! The debugging options are not supposed to alter the
generated code.
CAN_DEBUG_WITHOUT_FP
Note that the definitions of the macros in this table which are sizes or
alignments measured in bits do not need to be constant. They can be C
expressions that refer to static variables, such as the target_flags.
See section Run-time Target Specification.
BITS_BIG_ENDIAN
BYTES_BIG_ENDIAN.
BYTES_BIG_ENDIAN
WORDS_BIG_ENDIAN
LIBGCC2_WORDS_BIG_ENDIAN
FLOAT_WORDS_BIG_ENDIAN
DFmode, XFmode or
TFmode floating point numbers are stored in memory with the word
containing the sign bit at the lowest address; otherwise define it to
have the value 0. This macro need not be a constant.
You need not define this macro if the ordering is the same as for
multi-word integers.
BITS_PER_UNIT
BITS_PER_WORD
MAX_BITS_PER_WORD
BITS_PER_WORD. Otherwise, it is the constant value that is the
largest value that BITS_PER_WORD can have at run-time.
UNITS_PER_WORD
MIN_UNITS_PER_WORD
UNITS_PER_WORD. Otherwise, it is the constant value that is the
smallest value that UNITS_PER_WORD can have at run-time.
POINTER_SIZE
Pmode. If it is not equal to the width of Pmode,
you must define POINTERS_EXTEND_UNSIGNED.
POINTERS_EXTEND_UNSIGNED
POINTER_SIZE bits wide to Pmode
are sign-extended and zero if they are zero-extended.
You need not define this macro if the POINTER_SIZE is equal
to the width of Pmode.
PROMOTE_MODE (m, unsignedp, type)
word_mode if
m is an integer mode narrower than BITS_PER_WORD. In most
cases, only integer modes should be widened because wider-precision
floating-point operations are usually more expensive than their narrower
counterparts.
For most machines, the macro definition does not change unsignedp.
However, some machines, have instructions that preferentially handle
either signed or unsigned quantities of certain modes. For example, on
the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
sign-extend the result to 64 bits. On such machines, set
unsignedp according to which kind of extension is more efficient.
Do not define this macro if it would never modify m.
PROMOTE_FUNCTION_ARGS
PROMOTE_MODE
should also be done for outgoing function arguments.
PROMOTE_FUNCTION_RETURN
PROMOTE_MODE
should also be done for the return value of functions.
If this macro is defined, FUNCTION_VALUE must perform the same
promotions done by PROMOTE_MODE.
PROMOTE_FOR_CALL_ONLY
PROMOTE_MODE
should only be performed for outgoing function arguments or
function return values, as specified by PROMOTE_FUNCTION_ARGS
and PROMOTE_FUNCTION_RETURN, respectively.
PARM_BOUNDARY
STACK_BOUNDARY
PUSH_ROUNDING is not defined, the stack will always be aligned
to the specified boundary. If PUSH_ROUNDING is defined and specifies a
less strict alignment than STACK_BOUNDARY, the stack may be
momentarily unaligned while pushing arguments.
FUNCTION_BOUNDARY
BIGGEST_ALIGNMENT
BIGGEST_FIELD_ALIGNMENT
BIGGEST_ALIGNMENT for
structure fields only.
MAX_OFILE_ALIGNMENT
__attribute__ ((aligned (n))) construct. If not defined,
the default value is BIGGEST_ALIGNMENT.
DATA_ALIGNMENT (type, basic-align)
strcpy calls that copy
constants to character arrays can be done inline.
CONSTANT_ALIGNMENT (constant, basic-align)
strcpy calls that copy
constants can be done inline.
EMPTY_FIELD_BOUNDARY
int : 0;.
Note that PCC_BITFIELD_TYPE_MATTERS also affects the alignment
that results from an empty field.
STRUCTURE_SIZE_BOUNDARY
BITS_PER_UNIT.
STRICT_ALIGNMENT
PCC_BITFIELD_TYPE_MATTERS
int,
short, or other integer type) imposes an alignment for the
entire structure, as if the structure really did contain an ordinary
field of that type. In addition, the bitfield is placed within the
structure so that it would fit within such a field, not crossing a
boundary for it.
Thus, on most machines, a bitfield whose type is written as int
would not cross a four-byte boundary, and would force four-byte
alignment for the whole structure. (The alignment used may not be four
bytes; it is controlled by the other alignment parameters.)
If the macro is defined, its definition should be a C expression;
a nonzero value for the expression enables this behavior.
Note that if this macro is not defined, or its value is zero, some
bitfields may cross more than one alignment boundary. The compiler can
support such references if there are `insv', `extv', and
`extzv' insns that can directly reference memory.
The other known way of making bitfields work is to define
STRUCTURE_SIZE_BOUNDARY as large as BIGGEST_ALIGNMENT.
Then every structure can be accessed with fullwords.
Unless the machine has bitfield instructions or you define
STRUCTURE_SIZE_BOUNDARY that way, you must define
PCC_BITFIELD_TYPE_MATTERS to have a nonzero value.
If your aim is to make GNU CC use the same conventions for laying out
bitfields as are used by another compiler, here is how to investigate
what the other compiler does. Compile and run this program:
struct foo1
{
char x;
char :0;
char y;
};
struct foo2
{
char x;
int :0;
char y;
};
main ()
{
printf ("Size of foo1 is %d\n",
sizeof (struct foo1));
printf ("Size of foo2 is %d\n",
sizeof (struct foo2));
exit (0);
}
If this prints 2 and 5, then the compiler's behavior is what you would
get from PCC_BITFIELD_TYPE_MATTERS.
BITFIELD_NBYTES_LIMITED
ROUND_TYPE_SIZE (struct, size, align)
ROUND_TYPE_ALIGN (struct, computed, specified)
BIGGEST_ALIGNMENT
MAX_FIXED_MODE_SIZE
GET_MODE_BITSIZE
(DImode) is assumed.
CHECK_FLOAT_VALUE (mode, value, overflow)
double) for mode mode. This means that you check whether
value fits within the possible range of values for mode
mode on this target machine. The mode mode is always
a mode of class MODE_FLOAT. overflow is nonzero if
the value is already known to be out of range.
If value is not valid or if overflow is nonzero, you should
set overflow to 1 and then assign some valid value to value.
Allowing an invalid value to go through the compiler can produce
incorrect assembler code which may even cause Unix assemblers to crash.
This macro need not be defined if there is no work for it to do.
TARGET_FLOAT_FORMAT
IEEE_FLOAT_FORMAT
VAX_FLOAT_FORMAT
UNKNOWN_FLOAT_FORMAT
HOST_FLOAT_FORMAT
(see section The Configuration File) to determine whether the target machine has the same
format as the host machine. If any other formats are actually in use on
supported machines, new codes should be defined for them.
The ordering of the component words of floating point values stored in
memory is controlled by FLOAT_WORDS_BIG_ENDIAN for the target
machine and HOST_FLOAT_WORDS_BIG_ENDIAN for the host.
These macros define the sizes and other characteristics of the standard basic data types used in programs being compiled. Unlike the macros in the previous section, these apply to specific features of C and related languages, rather than to fundamental aspects of storage layout.
INT_TYPE_SIZE
int on the
target machine. If you don't define this, the default is one word.
MAX_INT_TYPE_SIZE
int on the target
machine. If this is undefined, the default is INT_TYPE_SIZE.
Otherwise, it is the constant value that is the largest value that
INT_TYPE_SIZE can have at run-time. This is used in cpp.
SHORT_TYPE_SIZE
short on the
target machine. If you don't define this, the default is half a word.
(If this would be less than one storage unit, it is rounded up to one
unit.)
LONG_TYPE_SIZE
long on the
target machine. If you don't define this, the default is one word.
MAX_LONG_TYPE_SIZE
long on the
target machine. If this is undefined, the default is
LONG_TYPE_SIZE. Otherwise, it is the constant value that is the
largest value that LONG_TYPE_SIZE can have at run-time. This is
used in cpp.
LONG_LONG_TYPE_SIZE
long long on the
target machine. If you don't define this, the default is two
words. If you want to support GNU Ada on your machine, the value of
macro must be at least 64.
CHAR_TYPE_SIZE
char on the
target machine. If you don't define this, the default is one quarter
of a word. (If this would be less than one storage unit, it is rounded up
to one unit.)
MAX_CHAR_TYPE_SIZE
char on the
target machine. If this is undefined, the default is
CHAR_TYPE_SIZE. Otherwise, it is the constant value that is the
largest value that CHAR_TYPE_SIZE can have at run-time. This is
used in cpp.
FLOAT_TYPE_SIZE
float on the
target machine. If you don't define this, the default is one word.
DOUBLE_TYPE_SIZE
double on the
target machine. If you don't define this, the default is two
words.
LONG_DOUBLE_TYPE_SIZE
long double on
the target machine. If you don't define this, the default is two
words.
DEFAULT_SIGNED_CHAR
char should be signed or unsigned by default. The user can
always override this default with the options `-fsigned-char'
and `-funsigned-char'.
DEFAULT_SHORT_ENUMS
enum type
only as many bytes as it takes to represent the range of possible values
of that type. A nonzero value means to do that; a zero value means all
enum types should be allocated like int.
If you don't define the macro, the default is 0.
SIZE_TYPE
size_t is defined using the
contents of the string.
The string can contain more than one keyword. If so, separate them with
spaces, and write first any length keyword, then unsigned if
appropriate, and finally int. The string must exactly match one
of the data type names defined in the function
init_decl_processing in the file `c-decl.c'. You may not
omit int or change the order--that would cause the compiler to
crash on startup.
If you don't define this macro, the default is "long unsigned
int".
PTRDIFF_TYPE
ptrdiff_t is defined using the contents of the string. See
SIZE_TYPE above for more information.
If you don't define this macro, the default is "long int".
WCHAR_TYPE
wchar_t is defined using
the contents of the string. See SIZE_TYPE above for more
information.
If you don't define this macro, the default is "int".
WCHAR_TYPE_SIZE
cpp, which cannot make use of
WCHAR_TYPE.
MAX_WCHAR_TYPE_SIZE
WCHAR_TYPE_SIZE. Otherwise, it is the constant value that is the
largest value that WCHAR_TYPE_SIZE can have at run-time. This is
used in cpp.
OBJC_INT_SELECTORS
int.
If this macro is not defined, then selectors should have the type
struct objc_selector *.
OBJC_SELECTORS_WITHOUT_LABELS
TARGET_BELL
TARGET_BS
TARGET_TAB
TARGET_NEWLINE
TARGET_VT
TARGET_FF
TARGET_CR
This section explains how to describe what registers the target machine has, and how (in general) they can be used.
The description of which registers a specific instruction can use is done with register classes; see section Register Classes. For information on using registers to access a stack frame, see section Registers That Address the Stack Frame. For passing values in registers, see section Passing Arguments in Registers. For returning values in registers, see section How Scalar Function Values Are Returned.
Registers have various characteristics.
FIRST_PSEUDO_REGISTER
FIRST_PSEUDO_REGISTER-1; thus, the first
pseudo register's number really is assigned the number
FIRST_PSEUDO_REGISTER.
FIXED_REGISTERS
CONDITIONAL_REGISTER_USAGE, or by
the user with the command options `-ffixed-reg',
`-fcall-used-reg' and `-fcall-saved-reg'.
CALL_USED_REGISTERS
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.
CONDITIONAL_REGISTER_USAGE
fixed_regs and call_used_regs (both of type char
[]) after they have been initialized from the two preceding macros.
This is necessary in case the fixed or call-clobbered registers depend
on target flags.
You need not define this macro if it has no work to do.
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 define
the macro REG_CLASS_FROM_LETTER to return NO_REGS if it
is called with a letter for a class 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.)
NON_SAVING_SETJMP
setjmp and related functions fail to save the registers, or that
longjmp fails to restore them. To compensate, the compiler
avoids putting variables in registers in functions that use
setjmp.
INCOMING_REGNO (out)
OUTGOING_REGNO (in)
Registers are allocated in order.
REG_ALLOC_ORDER
REG_ALLOC_ORDER to be an initializer that lists
the highest numbered allocatable register first.
ORDER_REGS_FOR_LOCAL_ALLOC
reg_alloc_order.
Element 0 should be the register to allocate first; element 1, the next
register; and so on.
The macro body should not assume anything about the contents of
reg_alloc_order before execution of the macro.
On most machines, it is not necessary to define this macro.
This section discusses the macros that describe which kinds of values (specifically, which machine modes) each register can hold, and how many consecutive registers are needed for a given mode.
HARD_REGNO_NREGS (regno, mode)
#define HARD_REGNO_NREGS(REGNO, MODE) \
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
/ UNITS_PER_WORD))
HARD_REGNO_MODE_OK (regno, mode)
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1It is not necessary for this macro to check for the numbers of fixed registers, because the allocation mechanism considers them to be always occupied. On some machines, double-precision values must be kept in even/odd register pairs. The way to implement that is to define this macro to reject odd register numbers for such modes. The minimum requirement for a mode to be OK in a register is that the `movmode' instruction pattern support moves between the register and any other hard register for which the mode is OK; and that moving a value into the register and back out not alter it. Since the same instruction used to move
SImode will work for all
narrower integer modes, it is not necessary on any machine for
HARD_REGNO_MODE_OK to distinguish between these modes, provided
you define patterns `movhi', etc., to take advantage of this. This
is useful because of the interaction between HARD_REGNO_MODE_OK
and MODES_TIEABLE_P; it is very desirable for all integer modes
to be tieable.
Many machines have special registers for floating point arithmetic.
Often people assume that floating point machine modes are allowed only
in floating point registers. This is not true. Any registers that
can hold integers can safely hold a floating point machine
mode, whether or not floating arithmetic can be done on it in those
registers. Integer move instructions can be used to move the values.
On some machines, though, the converse is true: fixed-point machine
modes may not go in floating registers. This is true if the floating
registers normalize any value stored in them, because storing a
non-floating value there would garble it. In this case,
HARD_REGNO_MODE_OK should reject fixed-point machine modes in
floating registers. But if the floating registers do not automatically
normalize, if you can store any bit pattern in one and retrieve it
unchanged without a trap, then any machine mode may go in a floating
register, so you can define this macro to say so.
The primary significance of special floating registers is rather that
they are the registers acceptable in floating point arithmetic
instructions. However, this is of no concern to
HARD_REGNO_MODE_OK. You handle it by writing the proper
constraints for those instructions.
On some machines, the floating registers are especially slow to access,
so that it is better to store a value in a stack frame than in such a
register if floating point arithmetic is not being done. As long as the
floating registers are not in class GENERAL_REGS, they will not
be used unless some pattern's constraint asks for one.
MODES_TIEABLE_P (mode1, mode2)
HARD_REGNO_MODE_OK (r, mode1) and
HARD_REGNO_MODE_OK (r, mode2) are ever different
for any r, then MODES_TIEABLE_P (mode1,
mode2) must be zero.
On some machines, a leaf function (i.e., one which makes no calls) can run more efficiently if it does not make its own register window. Often this means it is required to receive its arguments in the registers where they are passed by the caller, instead of the registers where they would normally arrive.
The special treatment for leaf functions generally applies only when other conditions are met; for example, often they may use only those registers for its own variables and temporaries. We use the term "leaf function" to mean a function that is suitable for this special handling, so that functions with no calls are not necessarily "leaf functions".
GNU CC assigns register numbers before it knows whether the function is suitable for leaf function treatment. So it needs to renumber the registers in order to output a leaf function. The following macros accomplish this.
LEAF_REGISTERS
LEAF_REG_REMAP (regno)
Normally, FUNCTION_PROLOGUE and FUNCTION_EPILOGUE must
treat leaf functions specially. It can test the C variable
leaf_function which is nonzero for leaf functions. (The variable
leaf_function is defined only if LEAF_REGISTERS is
defined.)
There are special features to handle computers where some of the "registers" form a stack, as in the 80387 coprocessor for the 80386. Stack registers are normally written by pushing onto the stack, and are numbered relative to the top of the stack.
Currently, GNU CC can only handle one group of stack-like registers, and they must be consecutively numbered.
STACK_REGS
FIRST_STACK_REG
LAST_STACK_REG
These features do not work very well. They exist because they used to be required to generate correct code for the 80387 coprocessor of the 80386. They are no longer used by that machine description and may be removed in a later version of the compiler. Don't use them!
OVERLAPPING_REGNO_P (regno)
INSN_CLOBBERS_REGNO_P (insn, regno)
PRESERVE_DEATH_INFO_REGNO_P (regno)
REG_DEAD notes are needed for hard register number regno
at the time of outputting the assembler code. When this is so, a few
optimizations that take place after register allocation and could
invalidate the death notes are not done when this register is
involved.
You would arrange to preserve death info for a register when some of the
code in the machine description which is executed to write the assembler
code looks at the death notes. This is necessary only when the actual
hardware feature which GNU CC thinks of as a register is not actually a
register of the usual sort. (It might, for example, be a hardware
stack.)
If this macro is not defined, it means that no death notes need to be
preserved. This is the usual situation.
On many machines, the numbered registers are not all equivalent. For example, certain registers may not be allowed for indexed addressing; certain registers may not be allowed in some instructions. These machine restrictions are described to the compiler using register classes.
You define a number of register classes, giving each one a name and saying which of the registers belong to it. Then you can specify register classes that are allowed as operands to particular instruction patterns.
In general, each register will belong to several classes. In fact, one
class must be named ALL_REGS and contain all the registers. Another
class must be named NO_REGS and contain no registers. Often the
union of two classes will be another class; however, this is not required.
One of the classes must be named GENERAL_REGS. There is nothing
terribly special about the name, but the operand constraint letters
`r' and `g' specify this class. If GENERAL_REGS is
the same as ALL_REGS, just define it as a macro which expands
to ALL_REGS.
Order the classes so that if class x is contained in class y then x has a lower class number than y.
The way classes other than GENERAL_REGS are specified in operand
constraints is through machine-dependent operand constraint letters.
You can define such letters to correspond to various classes, then use
them in operand constraints.
You should define a class for the union of two classes whenever some
instruction allows both classes. For example, if an instruction allows
either a floating point (coprocessor) register or a general register for a
certain operand, you should define a class FLOAT_OR_GENERAL_REGS
which includes both of them. Otherwise you will get suboptimal code.
You must also specify certain redundant information about the register classes: for each class, which classes contain it and which ones are contained in it; for each pair of classes, the largest class contained in their union.
When a value occupying several consecutive registers is expected in a
certain class, all the registers used must belong to that class.
Therefore, register classes cannot be used to enforce a requirement for
a register pair to start with an even-numbered register. The way to
specify this requirement is with HARD_REGNO_MODE_OK.
Register classes used for input-operands of bitwise-and or shift
instructions have a special requirement: each such class must have, for
each fixed-point machine mode, a subclass whose registers can transfer that
mode to or from memory. For example, on some machines, the operations for
single-byte values (QImode) are limited to certain registers. When
this is so, each register class that is used in a bitwise-and or shift
instruction must have a subclass consisting of registers from which
single-byte values can be loaded or stored. This is so that
PREFERRED_RELOAD_CLASS can always have a possible value to return.
enum reg_class
NO_REGS must be first. ALL_REGS
must be the last register class, followed by one more enumeral value,
LIM_REG_CLASSES, which is not a register class but rather
tells how many classes there are.
Each register class has a number, which is the value of casting
the class name to type int. The number serves as an index
in many of the tables described below.
N_REG_CLASSES
#define N_REG_CLASSES (int) LIM_REG_CLASSES
REG_CLASS_NAMES
REG_CLASS_CONTENTS
mask & (1 << r) is 1.
When the machine has more than 32 registers, an integer does not suffice.
Then the integers are replaced by sub-initializers, braced groupings containing
several integers. Each sub-initializer must be suitable as an initializer
for the type HARD_REG_SET which is defined in `hard-reg-set.h'.
REGNO_REG_CLASS (regno)
BASE_REG_CLASS
INDEX_REG_CLASS
REG_CLASS_FROM_LETTER (char)
NO_REGS. The register letter `r',
corresponding to class GENERAL_REGS, will not be passed
to this macro; you do not need to handle it.
REGNO_OK_FOR_BASE_P (num)
REGNO_OK_FOR_INDEX_P (num)
PREFERRED_RELOAD_CLASS (x, class)
#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASSSometimes returning a more restrictive class makes better code. For example, on the 68000, when x is an integer constant that is in range for a `moveq' instruction, the value of this macro is always
DATA_REGS as long as class includes the data registers.
Requiring a data register guarantees that a `moveq' will be used.
If x is a const_double, by returning NO_REGS
you can force x into a memory constant. This is useful on
certain machines where immediate floating values cannot be loaded into
certain kinds of registers.
PREFERRED_OUTPUT_RELOAD_CLASS (x, class)
PREFERRED_RELOAD_CLASS, but for output reloads instead of
input reloads. If you don't define this macro, the default is to use
class, unchanged.
LIMIT_RELOAD_CLASS (mode, class)
PREFERRED_RELOAD_CLASS, this macro should be used when
there are certain modes that simply can't go in certain reload classes.
The value is a register class; perhaps class, or perhaps another,
smaller class.
Don't define this macro unless the target machine has limitations which
require the macro to do something nontrivial.
SECONDARY_RELOAD_CLASS (class, mode, x)
SECONDARY_INPUT_RELOAD_CLASS (class, mode, x)
SECONDARY_OUTPUT_RELOAD_CLASS (class, mode, x)
SECONDARY_INPUT_RELOAD_CLASS to return the
largest register class all of whose registers can be used as
intermediate registers or scratch registers.
If copying a register class in mode to x requires an
intermediate or scratch register, SECONDARY_OUTPUT_RELOAD_CLASS
should be defined to return the largest register class required. If the
requirements for input and output reloads are the same, the macro
SECONDARY_RELOAD_CLASS should be used instead of defining both
macros identically.
The values returned by these macros are often GENERAL_REGS.
Return NO_REGS if no spare register is needed; i.e., if x
can be directly copied to or from a register of class in
mode without requiring a scratch register. Do not define this
macro if it would always return NO_REGS.
If a scratch register is required (either with or without an
intermediate register), you should define patterns for
`reload_inm' or `reload_outm', as required
(see section Standard Pattern Names For Generation. These patterns, which will normally be
implemented with a define_expand, should be similar to the
`movm' patterns, except that operand 2 is the scratch
register.
Define constraints for the reload register and scratch register that
contain a single register class. If the original reload register (whose
class is class) can meet the constraint given in the pattern, the
value returned by these macros is used for the class of the scratch
register. Otherwise, two additional reload registers are required.
Their classes are obtained from the constraints in the insn pattern.
x might be a pseudo-register or a subreg of a
pseudo-register, which could either be in a hard register or in memory.
Use true_regnum to find out; it will return -1 if the pseudo is
in memory and the hard register number if it is in a register.
These macros should not be used in the case where a particular class of
registers can only be copied to memory and not to another class of
registers. In that case, secondary reload registers are not needed and
would not be helpful. Instead, a stack location must be used to perform
the copy and the movm pattern should use memory as a
intermediate storage. This case often occurs between floating-point and
general registers.
SECONDARY_MEMORY_NEEDED (class1, class2, m)
SECONDARY_MEMORY_NEEDED_RTX (mode)
SECONDARY_MEMORY_NEEDED is defined, the compiler
allocates a stack slot for a memory location needed for register copies.
If this macro is defined, the compiler instead uses the memory location
defined by this macro.
Do not define this macro if you do not define
SECONDARY_MEMORY_NEEDED.
SECONDARY_MEMORY_NEEDED_MODE (mode)
BITS_PER_WORD bits and performs the store and
load operations in a mode that many bits wide and whose class is the
same as that of mode.
This is right thing to do on most machines because it ensures that all
bits of the register are copied and prevents accesses to the registers
in a narrower mode, which some machines prohibit for floating-point
registers.
However, this default behavior is not correct on some machines, such as
the DEC Alpha, that store short integers in floating-point registers
differently than in integer registers. On those machines, the default
widening will not work correctly and you must define this macro to
suppress that widening in some cases. See the file `alpha.h' for
details.
Do not define this macro if you do not define
SECONDARY_MEMORY_NEEDED or if widening mode to a mode that
is BITS_PER_WORD bits wide is correct for your machine.
SMALL_REGISTER_CLASSES
SMALL_REGISTER_CLASSES on these machines. When it is
defined, the compiler allows registers explicitly used in the rtl to be
used as spill registers but avoids extending the lifetime of these
registers.
It is always safe to define this macro, but if you unnecessarily define
it, you will reduce the amount of optimizations that can be performed in
some cases. If you do not define this macro when it is required, the
compiler will run out of spill registers and print a fatal error
message. For most machines, you should not define this macro.
CLASS_LIKELY_SPILLED_P (class)
CLASS_MAX_NREGS (class, mode)
HARD_REGNO_NREGS. In fact,
the value of the macro CLASS_MAX_NREGS (class, mode)
should be the maximum value of HARD_REGNO_NREGS (regno,
mode) for all regno values in the class class.
This macro helps control the handling of multiple-word values
in the reload pass.
CLASS_CANNOT_CHANGE_SIZE
FLOAT_REGS.
Three other special macros describe which operands fit which constraint letters.
CONST_OK_FOR_LETTER_P (value, c)
CONST_DOUBLE_OK_FOR_LETTER_P (value, c)
const_double values.
If c is one of those letters, the expression should check that
value, an RTX of code const_double, is in the appropriate
range and return 1 if so, 0 otherwise. If c is not one of those
letters, the value should be 0 regardless of value.
const_double is used for all floating-point constants and for
DImode fixed-point constants. A given letter can accept either
or both kinds of values. It can use GET_MODE to distinguish
between these kinds.
EXTRA_CONSTRAINT (value, c)
This describes the stack layout and calling conventions.
Here is the basic stack layout.
STACK_GROWS_DOWNWARD
#ifdef so the precise
definition used does not matter.
FRAME_GROWS_DOWNWARD
ARGS_GROW_DOWNWARD
STARTING_FRAME_OFFSET
FRAME_GROWS_DOWNWARD, find the next slot's offset by
subtracting the first slot's length from STARTING_FRAME_OFFSET.
Otherwise, it is found by adding the length of the first slot to the
value STARTING_FRAME_OFFSET.
STACK_POINTER_OFFSET
ARGS_GROW_DOWNWARD, this is the offset to the location above
the first location at which outgoing arguments are placed.
FIRST_PARM_OFFSET (fundecl)
ARGS_GROW_DOWNWARD, this is the offset to the location above
the first argument's address.
STACK_DYNAMIC_OFFSET (fundecl)
alloca.
The default value for this macro is STACK_POINTER_OFFSET plus the
length of the outgoing arguments. The default is correct for most
machines. See `function.c' for details.
DYNAMIC_CHAIN_ADDRESS (frameaddr)
SETUP_FRAME_ADDRESSES ()
RETURN_ADDR_RTX (count, frameaddr)
RETURN_ADDR_IN_PREVIOUS_FRAME is defined.
RETURN_ADDR_IN_PREVIOUS_FRAME
This discusses registers that address the stack frame.
STACK_POINTER_REGNUM
FIXED_REGISTERS. On most machines,
the hardware determines which register this is.
FRAME_POINTER_REGNUM
HARD_FRAME_POINTER_REGNUM
FRAME_POINTER_REGNUM the number of a special, fixed register to
be used internally until the offset is known, and define
HARD_FRAME_POINTER_REGNUM to be actual the hard register number
used for the frame pointer.
You should define this macro only in the very rare circumstances when it
is not possible to calculate the offset between the frame pointer and
the automatic variables until after register allocation has been
completed. When this macro is defined, you must also indicate in your
definition of ELIMINABLE_REGS how to eliminate
FRAME_POINTER_REGNUM into either HARD_FRAME_POINTER_REGNUM
or STACK_POINTER_REGNUM.
Do not define this macro if it would be the same as
FRAME_POINTER_REGNUM.
ARG_POINTER_REGNUM
FIXED_REGISTERS, or arrange to be able to eliminate it
(see section Eliminating Frame Pointer and Arg Pointer).
STATIC_CHAIN_REGNUM
STATIC_CHAIN_INCOMING_REGNUM
STATIC_CHAIN_INCOMING_REGNUM, while the register
number as seen by the calling function is STATIC_CHAIN_REGNUM. If
these registers are the same, STATIC_CHAIN_INCOMING_REGNUM need
not be defined.
The static chain register need not be a fixed register.
If the static chain is passed in memory, these macros should not be
defined; instead, the next two macros should be defined.
STATIC_CHAIN
STATIC_CHAIN_INCOMING
mem expressions that denote where they are stored.
STATIC_CHAIN and STATIC_CHAIN_INCOMING give the locations
as seen by the calling and called functions, respectively. Often the former
will be at an offset from the stack pointer and the latter at an offset from
the frame pointer.
The variables stack_pointer_rtx, frame_pointer_rtx, and
arg_pointer_rtx will have been initialized prior to the use of these
macros and should be used to refer to those items.
If the static chain is passed in a register, the two previous macros should
be defined instead.
This is about eliminating the frame pointer and arg pointer.
FRAME_POINTER_REQUIRED
FRAME_POINTER_REQUIRED says. You don't need to worry about
them.
In a function that does not require a frame pointer, the frame pointer
register can be allocated for ordinary usage, unless you mark it as a
fixed register. See FIXED_REGISTERS for more information.
INITIAL_FRAME_POINTER_OFFSET (depth-var)
get_frame_size () and the tables of
registers regs_ever_live and call_used_regs.
If ELIMINABLE_REGS is defined, this macro will be not be used and
need not be defined. Otherwise, it must be defined even if
FRAME_POINTER_REQUIRED is defined to always be true; in that
case, you may set depth-var to anything.
ELIMINABLE_REGS
#define ELIMINABLE_REGS \
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
Note that the elimination of the argument pointer with the stack pointer is
specified first since that is the preferred elimination.
CAN_ELIMINATE (from-reg, to-reg)
ELIMINABLE_REGS
is defined, and will usually be the constant 1, since most of the cases
preventing register elimination are things that the compiler already
knows about.
INITIAL_ELIMINATION_OFFSET (from-reg, to-reg, offset-var)
INITIAL_FRAME_POINTER_OFFSET. It
specifies the initial difference between the specified pair of
registers. This macro must be defined if ELIMINABLE_REGS is
defined.
LONGJMP_RESTORE_FROM_STACK
longjmp function restores registers from
the stack frames, rather than from those saved specifically by
setjmp. Certain quantities must not be kept in registers across
a call to setjmp on such machines.
The macros in this section control how arguments are passed on the stack. See the following section for other macros that control passing certain arguments in registers.
PROMOTE_PROTOTYPES
int should actually be passed as an
int. In addition to avoiding errors in certain cases of
mismatch, it also makes for better code on certain machines.
PUSH_ROUNDING (npushed)
#define PUSH_ROUNDING(BYTES) (BYTES)will suffice. But on other machines, instructions that appear to push one byte actually push two bytes in an attempt to maintain alignment. Then the definition should be
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
ACCUMULATE_OUTGOING_ARGS
current_function_outgoing_args_size. No space will be pushed
onto the stack for each call; instead, the function prologue should
increase the stack frame size by this amount.
Defining both PUSH_ROUNDING and ACCUMULATE_OUTGOING_ARGS
is not proper.
REG_PARM_STACK_SPACE (fndecl)
OUTGOING_REG_PARM_STACK_SPACE says
which.
MAYBE_REG_PARM_STACK_SPACE
FINAL_REG_PARM_STACK_SPACE (const_size, var_size)
REG_PARM_STACK_SPACE will only be
called for libcall functions, the current function, or for a function
being called when it is known that such stack space must be allocated.
In each case this value can be easily computed.
When deciding whether a called function needs such stack space, and how
much space to reserve, GNU CC uses these two macros instead of
REG_PARM_STACK_SPACE.
OUTGOING_REG_PARM_STACK_SPACE
ACCUMULATE_OUTGOING_ARGS is defined, this macro controls
whether the space for these arguments counts in the value of
current_function_outgoing_args_size.
STACK_PARMS_IN_REG_PARM_AREA
REG_PARM_STACK_SPACE is defined, but the
stack parameters don't skip the area specified by it.
Normally, when a parameter is not passed in registers, it is placed on the
stack beyond the REG_PARM_STACK_SPACE area. Defining this macro
suppresses this behavior and causes the parameter to be passed on the
stack in its natural location.
RETURN_POPS_ARGS (fundecl, funtype, stack-size)
FUNCTION_DECL that describes the declaration of the function.
From this it is possible to obtain the DECL_MACHINE_ATTRIBUTES of
the function.
funtype is a C variable whose value is a tree node that
describes the function in question. Normally it is a node of type
FUNCTION_TYPE that describes the data type of the function.
From this it is possible to obtain the data types of the value and
arguments (if known).
When a call to a library function is being considered, funtype
will contain an identifier node for the library function. Thus, if
you need to distinguish among various library functions, you can do so
by their names. Note that "library function" in this context means
a function used to perform arithmetic, whose name is known specially
in the compiler and was not mentioned in the C code being compiled.
stack-size is the number of bytes of arguments passed on the
stack. If a variable number of bytes is passed, it is zero, and
argument popping will always be the responsibility of the calling function.
On the Vax, all functions always pop their arguments, so the definition
of this macro is stack-size. On the 68000, using the standard
calling convention, no functions pop their arguments, so the value of
the macro is always 0 in this case. But an alternative calling
convention is available in which functions that take a fixed number of
arguments pop them but other functions (such as printf) pop
nothing (the caller pops all). When this convention is in use,
funtype is examined to determine whether a function takes a fixed
number of arguments.
This section describes the macros which let you control how various types of arguments are passed in registers or how they are arranged in the stack.
FUNCTION_ARG (cum, mode, type, named)
reg RTX for the
hard register in which to pass the argument, or zero to pass the
argument on the stack.
For machines like the Vax and 68000, where normally all arguments are
pushed, zero suffices as a definition.
The usual way to make the ANSI library `stdarg.h' work on a machine
where some arguments are usually passed in registers, is to cause
nameless arguments to be passed on the stack instead. This is done
by making FUNCTION_ARG return 0 whenever named is 0.
You may use the macro MUST_PASS_IN_STACK (mode, type)
in the definition of this macro to determine if this argument is of a
type that must be passed in the stack. If REG_PARM_STACK_SPACE
is not defined and FUNCTION_ARG returns non-zero for such an
argument, the compiler will abort. If REG_PARM_STACK_SPACE is
defined, the argument will be computed in the stack and then loaded into
a register.
FUNCTION_INCOMING_ARG (cum, mode, type, named)
FUNCTION_ARG computes the register in which
the caller passes the value, and FUNCTION_INCOMING_ARG should
be defined in a similar fashion to tell the function being called
where the arguments will arrive.
If FUNCTION_INCOMING_ARG is not defined, FUNCTION_ARG
serves both purposes.
FUNCTION_ARG_PARTIAL_NREGS (cum, mode, type, named)
double or a
structure) crosses that boundary, its first few words must be passed
in registers and the rest must be pushed. This macro tells the
compiler when this occurs, and how many of the words should go in
registers.
FUNCTION_ARG for these arguments should return the first
register to be used by the caller for this argument; likewise
FUNCTION_INCOMING_ARG, for the called function.
FUNCTION_ARG_PASS_BY_REFERENCE (cum, mode, type, named)
REG_PARM_STACK_SPACE is not defined, a suitable
definition of this macro might be
#define FUNCTION_ARG_PASS_BY_REFERENCE\ (CUM, MODE, TYPE, NAMED) \ MUST_PASS_IN_STACK (MODE, TYPE)
FUNCTION_ARG_CALLEE_COPIES (cum, mode, type, named)
CUMULATIVE_ARGS
FUNCTION_ARG and other related values. For some target machines,
the type int suffices and can hold the number of bytes of
argument so far.
There is no need to record in CUMULATIVE_ARGS anything about the
arguments that have been passed on the stack. The compiler has other
variables to keep track of that. For target machines on which all
arguments are passed on the stack, there is no need to store anything in
CUMULATIVE_ARGS; however, the data structure must exist and
should not be empty, so use int.
INIT_CUMULATIVE_ARGS (cum, fntype, libname)
CUMULATIVE_ARGS. The value of fntype is the tree node
for the data type of the function which will receive the args, or 0
if the args are to a compiler support library function.
When processing a call to a compiler support library function,
libname identifies which one. It is a symbol_ref rtx which
contains the name of the function, as a string. libname is 0 when
an ordinary C function call is being processed. Thus, each time this
macro is called, either libname or fntype is nonzero, but
never both of them at once.
INIT_CUMULATIVE_INCOMING_ARGS (cum, fntype, libname)
INIT_CUMULATIVE_ARGS but overrides it for the purposes of
finding the arguments for the function being compiled. If this macro is
undefined, INIT_CUMULATIVE_ARGS is used instead.
The value passed for libname is always 0, since library routines
with special calling conventions are never compiled with GNU CC. The
argument libname exists for symmetry with
INIT_CUMULATIVE_ARGS.
FUNCTION_ARG_ADVANCE (cum, mode, type, named)
FUNCTION_ARG, etc.
This macro need not do anything if the argument in question was passed
on the stack. The compiler knows how to track the amount of stack space
used for arguments without any special help.
FUNCTION_ARG_PADDING (mode, type)
enum direction: either upward to pad above the argument,
downward to pad below, or none to inhibit padding.
The amount of padding is always just enough to reach the next
multiple of FUNCTION_ARG_BOUNDARY; this macro does not control
it.
This macro has a default definition which is right for most systems.
For little-endian machines, the default is to pad upward. For
big-endian machines, the default is to pad downward for an argument of
constant size shorter than an int, and upward otherwise.
FUNCTION_ARG_BOUNDARY (mode, type)
PARM_BOUNDARY is used for all arguments.
FUNCTION_ARG_REGNO_P (regno)
This section discusses the macros that control returning scalars as values--values that can fit in registers.
TRADITIONAL_RETURN_FLOAT
float to convert the value to double.
FUNCTION_VALUE (valtype, func)
TYPE_MODE
(valtype) to get the machine mode used to represent that type.
On many machines, only the mode is relevant. (Actually, on most
machines, scalar values are returned in the same place regardless of
mode).
If PROMOTE_FUNCTION_RETURN is defined, you must apply the same
promotion rules specified in PROMOTE_MODE if valtype is a
scalar type.
If the precise function being called is known, func is a tree
node (FUNCTION_DECL) for it; otherwise, func is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
FUNCTION_VALUE is not used for return vales with aggregate data
types, because these are returned in another way. See
STRUCT_VALUE_REGNUM and related macros, below.
FUNCTION_OUTGOING_VALUE (valtype, func)
FUNCTION_VALUE computes the register in which
the caller will see the value. FUNCTION_OUTGOING_VALUE should be
defined in a similar fashion to tell the function where to put the
value.
If FUNCTION_OUTGOING_VALUE is not defined,
FUNCTION_VALUE serves both purposes.
FUNCTION_OUTGOING_VALUE is not used for return vales with
aggregate data types, because these are returned in another way. See
STRUCT_VALUE_REGNUM and related macros, below.
LIBCALL_VALUE (mode)
FUNCTION_DECL) for it; otherwise, func is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
Note that "library function" in this context means a compiler
support routine, used to perform arithmetic, whose name is known
specially by the compiler and was not mentioned in the C code being
compiled.
The definition of LIBRARY_VALUE need not be concerned aggregate
data types, because none of the library functions returns such types.
FUNCTION_VALUE_REGNO_P (regno)
double, say) need not be
recognized by this macro. So for most machines, this definition
suffices:
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)If the machine has register windows, so that the caller and the called function use different registers for the return value, this macro should recognize only the caller's register numbers.
APPLY_RESULT_SIZE
FUNCTION_VALUE_REGNO_P for
saving and restoring an arbitrary return value.
When a function value's mode is BLKmode (and in some other
cases), the value is not returned according to FUNCTION_VALUE
(see section How Scalar Function Values Are Returned). Instead, the caller passes the address of a
block of memory in which the value should be stored. This address
is called the structure value address.
This section describes how to control returning structure values in memory.
RETURN_IN_MEMORY (type)
tree, representing the data type of the value.
Note that values of mode BLKmode must be explicitly handled
by this macro. Also, the option `-fpcc-struct-return'
takes effect regardless of this macro. On most systems, it is
possible to leave the macro undefined; this causes a default
definition to be used, whose value is the constant 1 for BLKmode
values, and 0 otherwise.
Do not use this macro to indicate that structures and unions should always
be returned in memory. You should instead use DEFAULT_PCC_STRUCT_RETURN
to indicate this.
DEFAULT_PCC_STRUCT_RETURN
RETURN_IN_MEMORY macro.
If not defined, this defaults to the value 1.
STRUCT_VALUE_REGNUM
STRUCT_VALUE_REGNUM should be the number of that register.
STRUCT_VALUE
STRUCT_VALUE as an expression returning an RTX for the place
where the address is passed. If it returns 0, the address is passed as
an "invisible" first argument.
STRUCT_VALUE_INCOMING_REGNUM
STRUCT_VALUE_INCOMING
STRUCT_VALUE_INCOMING as an expression for an RTX for where the
called function should find the value. If it should find the value on
the stack, define this to create a mem which refers to the frame
pointer. A definition of 0 means that the address is passed as an
"invisible" first argument.
PCC_STATIC_STRUCT_RETURN
If you enable it, GNU CC can save registers around function calls. This makes it possible to use call-clobbered registers to hold variables that must live across calls.
DEFAULT_CALLER_SAVES
CALL_USED_REGISTERS has 1
for all registers. This macro enables `-fcaller-saves' by default.
Eventually that option will be enabled by default on all machines and both
the option and this macro will be eliminated.
CALLER_SAVE_PROFITABLE (refs, calls)
4 * calls < refs.
This section describes the macros that output function entry (prologue) and exit (epilogue) code.
FUNCTION_PROLOGUE (file, size)
regs_ever_live: element r is nonzero if hard register
r is used anywhere within the function. This implies the function
prologue should save register r, provided it is not one of the
call-used registers. (FUNCTION_EPILOGUE must likewise use
regs_ever_live.)
On machines that have "register windows", the function entry code does
not save on the stack the registers that are in the windows, even if
they are supposed to be preserved by function calls; instead it takes
appropriate steps to "push" the register stack, if any non-call-used
registers are used in the function.
On machines where functions may or may not have frame-pointers, the
function entry code must vary accordingly; it must set up the frame
pointer if one is wanted, and not otherwise. To determine whether a
frame pointer is in wanted, the macro can refer to the variable
frame_pointer_needed. The variable's value will be 1 at run
time in a function that needs a frame pointer. See section Eliminating Frame Pointer and Arg Pointer.
The function entry code is responsible for allocating any stack space
required for the function. This stack space consists of the regions
listed below. In most cases, these regions are allocated in the
order listed, with the last listed region closest to the top of the
stack (the lowest address if STACK_GROWS_DOWNWARD is defined, and
the highest address if it is not defined). You can use a different order
for a machine if doing so is more convenient or required for
compatibility reasons. Except in cases where required by standard
or by a debugger, there is no reason why the stack layout used by GCC
need agree with that used by other compilers for a machine.
current_function_pretend_args_size bytes of
uninitialized space just underneath the first argument arriving on the
stack. (This may not be at the very start of the allocated stack region
if the calling sequence has pushed anything else since pushing the stack
arguments. But usually, on such machines, nothing else has been pushed
yet, because the function prologue itself does all the pushing.) This
region is used on machines where an argument may be passed partly in
registers and partly in memory, and, in some cases to support the
features in `varargs.h' and `stdargs.h'.
ACCUMULATE_OUTGOING_ARGS is defined, a region of
current_function_outgoing_args_size bytes to be used for outgoing
argument lists of the function. See section Passing Function Arguments on the Stack.
FUNCTION_PROLOGUE and
FUNCTION_EPILOGUE to treat leaf functions specially. The C
variable leaf_function is nonzero for such a function.
EXIT_IGNORE_STACK
EXIT_IGNORE_STACK.
FUNCTION_EPILOGUE (file, size)