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 Run-time Target.
BITS_BIG_ENDIAN
This macro does not affect the way structure fields are packed into
bytes or words; that is controlled by BYTES_BIG_ENDIAN
.
BYTES_BIG_ENDIAN
WORDS_BIG_ENDIAN
LIBGCC2_WORDS_BIG_ENDIAN
WORDS_BIG_ENDIAN
is not constant. This must be a
constant value with the same meaning as WORDS_BIG_ENDIAN
, which will be
used only when compiling libgcc2.c
. Typically the value will be set
based on preprocessor defines.
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
BITS_PER_UNIT * UNITS_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
. If you do not specify
a value the default is BITS_PER_WORD
.
POINTERS_EXTEND_UNSIGNED
POINTER_SIZE
bits wide to Pmode
are to
be zero-extended and zero if they are to be sign-extended. If the value
is less then zero then there must be an "ptr_extend" instruction that
extends a pointer from POINTER_SIZE
to Pmode
.
You need not define this macro if the POINTER_SIZE
is equal
to the width of Pmode
.
PROMOTE_MODE (
m,
unsignedp,
type)
On most RISC machines, which only have operations that operate on a full
register, define this macro to set m to 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
PREFERRED_STACK_BOUNDARY
is not defined. On most machines,
this should be the same as PARM_BOUNDARY
.
PREFERRED_STACK_BOUNDARY
STACK_BOUNDARY
.
FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
PREFERRED_STACK_BOUNDARY
is
not guaranteed by the runtime and we should emit code to align the stack
at the beginning of main
.
If 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 PREFERRED_STACK_BOUNDARY
, the stack may
be momentarily unaligned while pushing arguments.
FUNCTION_BOUNDARY
BIGGEST_ALIGNMENT
MINIMUM_ATOMIC_ALIGNMENT
BITS_PER_UNIT
, but may be larger
on machines that don't have byte or half-word store operations.
BIGGEST_FIELD_ALIGNMENT
BIGGEST_ALIGNMENT
for
structure and union fields only, unless the field alignment has been set
by the __attribute__ ((aligned (
n)))
construct.
ADJUST_FIELD_ALIGN (
field,
computed)
BIGGEST_ALIGNMENT
and BIGGEST_FIELD_ALIGNMENT
to the
alignment) is computed. It overrides alignment only if the
field alignment has not been set by the
__attribute__ ((aligned (
n)))
construct.
MAX_OFILE_ALIGNMENT
__attribute__ ((aligned (
n)))
construct. If not defined,
the default value is BIGGEST_ALIGNMENT
.
DATA_ALIGNMENT (
type,
basic-align)
If this macro is not defined, then basic-align is used.
One use of this macro is to increase alignment of medium-size data to
make it all fit in fewer cache lines. Another is to cause character
arrays to be word-aligned so that strcpy
calls that copy
constants to character arrays can be done inline.
CONSTANT_ALIGNMENT (
constant,
basic-align)
If this macro is not defined, then basic-align is used.
The typical use of this macro is to increase alignment for string
constants to be word aligned so that strcpy
calls that copy
constants can be done inline.
LOCAL_ALIGNMENT (
type,
basic-align)
If this macro is not defined, then basic-align is used.
One use of this macro is to increase alignment of medium-size data to
make it all fit in fewer cache lines.
EMPTY_FIELD_BOUNDARY
int : 0;
.
Note that PCC_BITFIELD_TYPE_MATTERS
also affects the alignment
that results from an empty field.
STRUCTURE_SIZE_BOUNDARY
If you do not define this macro, the default is the same as
BITS_PER_UNIT
.
STRICT_ALIGNMENT
PCC_BITFIELD_TYPE_MATTERS
The behavior is that the type written for a named bit-field (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 bit-field 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 named bit-field 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.)
An unnamed bit-field will not affect the alignment of the containing structure.
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
bit-fields 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 bit-fields work is to define
STRUCTURE_SIZE_BOUNDARY
as large as BIGGEST_ALIGNMENT
.
Then every structure can be accessed with fullwords.
Unless the machine has bit-field 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 GCC use the same conventions for laying out bit-fields 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
PCC_BITFIELD_TYPE_MATTERS
except that its effect is limited
to aligning a bit-field within the structure.
MEMBER_TYPE_FORCES_BLK (
field,
mode)
BLKMODE
.
If field is the only field in the structure, mode is its mode, otherwise mode is VOIDmode. mode is provided in the case where structures of one field would require the structure's mode to retain the field's mode.
Normally, this is not needed. See the file c4x.h
for an example
of how to use this macro to prevent a structure having a floating point
field from being accessed in an integer mode.
ROUND_TYPE_SIZE (
type,
computed,
specified)
The default is to round computed up to a multiple of specified.
ROUND_TYPE_SIZE_UNIT (
type,
computed,
specified)
ROUND_TYPE_SIZE
, but sizes and alignments are
specified in units (bytes). If you define ROUND_TYPE_SIZE
,
you must also define this macro and they must be defined consistently
with each other.
ROUND_TYPE_ALIGN (
type,
computed,
specified)
The default is to use specified if it is larger; otherwise, use
the smaller of computed and BIGGEST_ALIGNMENT
MAX_FIXED_MODE_SIZE
GET_MODE_BITSIZE
(DImode)
is assumed.
VECTOR_MODE_SUPPORTED_P(
mode)
STACK_SAVEAREA_MODE (
save_level)
enum machine_mode
that
specifies the mode of the save area operand of a
save_stack_
level
named pattern (see Standard Names).
save_level is one of SAVE_BLOCK
, SAVE_FUNCTION
, or
SAVE_NONLOCAL
and selects which of the three named patterns is
having its mode specified.
You need not define this macro if it always returns Pmode
. You
would most commonly define this macro if the
save_stack_
level patterns need to support both a 32- and a
64-bit mode.
STACK_SIZE_MODE
enum machine_mode
that
specifies the mode of the size increment operand of an
allocate_stack
named pattern (see Standard Names).
You need not define this macro if it always returns word_mode
.
You would most commonly define this macro if the allocate_stack
pattern needs to support both a 32- and a 64-bit mode.
TARGET_FLOAT_FORMAT
IEEE_FLOAT_FORMAT
VAX_FLOAT_FORMAT
float
) and "D float"
or "G float" formats (for double
) used on the VAX and PDP-11.
IBM_FLOAT_FORMAT
C4X_FLOAT_FORMAT
UNKNOWN_FLOAT_FORMAT
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
.
MODE_HAS_NANS (
mode)
By default, this macro is true if mode is a floating-point
mode and the target floating-point format is IEEE.
MODE_HAS_INFINITIES (
mode)
x - x
is always defined. By default, the macro is true when mode
is a floating-point mode and the target format is IEEE.
MODE_HAS_SIGNED_ZEROS (
mode)
x + x
has the same sign as x
.
The default definition is true if mode is a floating-point
mode and the target format is IEEE.
MODE_HAS_SIGN_DEPENDENT_ROUNDING (
mode)
x
and -x
can be
rounded to numbers of different magnitude. Two such modes are
towards -infinity and towards +infinity.
The default definition of this macro is true if mode is
a floating-point mode and the target format is IEEE.
ROUND_TOWARDS_ZERO
MODE_HAS_SIGN_DEPENDENT_ROUNDING
will be false for all modes.
libgcc.a
's floating-point emulator will round towards zero
rather than towards nearest.
The macro does not affect the parsing of string literals. When the
primary rounding mode is towards zero, library functions like
strtod
might still round towards nearest, and the compiler's
parser should behave like the target's strtod
where possible.
Not defining this macro is equivalent to returning zero.
LARGEST_EXPONENT_IS_NORMAL (
size)
Defining this macro to true for size causes MODE_HAS_NANS
and MODE_HAS_INFINITIES
to be false for size-bit modes.
It also affects the way libgcc.a
and real.c
emulate
floating-point arithmetic.
The default definition of this macro returns false for all sizes.
bool TARGET_MS_BITFIELD_LAYOUT_P (tree record_type) | Target Hook |
This target hook returns true if bit-fields in the given
record_type are to be laid out following the rules of Microsoft
Visual C/C++, namely: (i) a bit-field won't share the same storage
unit with the previous bit-field if their underlying types have
different sizes, and the bit-field will be aligned to the highest
alignment of the underlying types of itself and of the previous
bit-field; (ii) a zero-sized bit-field will affect the alignment of
the whole enclosing structure, even if it is unnamed; except that
(iii) a zero-sized bit-field will be disregarded unless it follows
another bit-field of nonzero size. If this hook returns true ,
other macros that control bit-field layout are ignored.
When a bit-field is inserted into a packed record, the whole size of the underlying type is used by one or more same-size adjacent bit-fields (that is, if its long:3, 32 bits is used in the record, and any additional adjacent long bit-fields are packed into the same chunk of 32 bits. However, if the size changes, a new field of that size is allocated). In an unpacked record, this is the same as using alignment, but not equivalent when packing. If both MS bit-fields and |