+2011-07-12 Bernd Schmidt <bernds@codesourcery.com>
+
+ * doc/tm.texi.in (FUNCTION_ARG_PADDING): Mention
+ TARGET_FUNCTION_ARG_ROUND_BOUNDARY.
+ (TARGET_FUNCTION_ARG_ROUND_BOUNDARY): Add hook.
+ * function.c (locate_and_pad_parm): Take it into account.
+ * target.def (function_arg_round_boundary): New hook.
+ * targhooks.c (default_function_arg_round_boundary): New function.
+ * targhooks.h (default_function_arg_round_boundary): Declare.
+ * doc/tm.texi: Regenerate.
+
2011-07-12 Richard Guenther <rguenther@suse.de>
* tree-ssa-copyrename.c (rename_ssa_copies): Zero statistics.
@code{enum direction}: either @code{upward} to pad above the argument,
@code{downward} to pad below, or @code{none} to inhibit padding.
-The @emph{amount} of padding is always just enough to reach the next
-multiple of @code{TARGET_FUNCTION_ARG_BOUNDARY}; this macro does not
-control it.
+The @emph{amount} of padding is not controlled by this macro, but by the
+target hook @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. It is
+always just enough to reach the next multiple of that boundary.
This macro has a default definition which is right for most systems.
For little-endian machines, the default is to pad upward. For
@code{PARM_BOUNDARY} for all arguments.
@end deftypefn
+@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY (enum machine_mode @var{mode}, const_tree @var{type})
+Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY},
+which is the default value for this hook. You can define this hook to
+return a different value if an argument size must be rounded to a larger
+value.
+@end deftypefn
+
@defmac FUNCTION_ARG_REGNO_P (@var{regno})
A C expression that is nonzero if @var{regno} is the number of a hard
register in which function arguments are sometimes passed. This does
@code{enum direction}: either @code{upward} to pad above the argument,
@code{downward} to pad below, or @code{none} to inhibit padding.
-The @emph{amount} of padding is always just enough to reach the next
-multiple of @code{TARGET_FUNCTION_ARG_BOUNDARY}; this macro does not
-control it.
+The @emph{amount} of padding is not controlled by this macro, but by the
+target hook @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. It is
+always just enough to reach the next multiple of that boundary.
This macro has a default definition which is right for most systems.
For little-endian machines, the default is to pad upward. For
@code{PARM_BOUNDARY} for all arguments.
@end deftypefn
+@hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY
+
@defmac FUNCTION_ARG_REGNO_P (@var{regno})
A C expression that is nonzero if @var{regno} is the number of a hard
register in which function arguments are sometimes passed. This does
{
tree sizetree;
enum direction where_pad;
- unsigned int boundary;
+ unsigned int boundary, round_boundary;
int reg_parm_stack_space = 0;
int part_size_in_regs;
= type ? size_in_bytes (type) : size_int (GET_MODE_SIZE (passed_mode));
where_pad = FUNCTION_ARG_PADDING (passed_mode, type);
boundary = targetm.calls.function_arg_boundary (passed_mode, type);
+ round_boundary = targetm.calls.function_arg_round_boundary (passed_mode,
+ type);
locate->where_pad = where_pad;
/* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT. */
tree s2 = sizetree;
if (where_pad != none
&& (!host_integerp (sizetree, 1)
- || (tree_low_cst (sizetree, 1) * BITS_PER_UNIT) % PARM_BOUNDARY))
- s2 = round_up (s2, PARM_BOUNDARY / BITS_PER_UNIT);
+ || (tree_low_cst (sizetree, 1) * BITS_PER_UNIT) % round_boundary))
+ s2 = round_up (s2, round_boundary / BITS_PER_UNIT);
SUB_PARM_SIZE (locate->slot_offset, s2);
}
if (where_pad != none
&& (!host_integerp (sizetree, 1)
- || (tree_low_cst (sizetree, 1) * BITS_PER_UNIT) % PARM_BOUNDARY))
- sizetree = round_up (sizetree, PARM_BOUNDARY / BITS_PER_UNIT);
+ || (tree_low_cst (sizetree, 1) * BITS_PER_UNIT) % round_boundary))
+ sizetree = round_up (sizetree, round_boundary / BITS_PER_UNIT);
ADD_PARM_SIZE (locate->size, sizetree);
unsigned int, (enum machine_mode mode, const_tree type),
default_function_arg_boundary)
+DEFHOOK
+(function_arg_round_boundary,
+ "Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY},\n\
+which is the default value for this hook. You can define this hook to\n\
+return a different value if an argument size must be rounded to a larger\n\
+value.",
+ unsigned int, (enum machine_mode mode, const_tree type),
+ default_function_arg_round_boundary)
+
/* Return the diagnostic message string if function without a prototype
is not allowed for this 'val' argument; NULL otherwise. */
DEFHOOK
return PARM_BOUNDARY;
}
+unsigned int
+default_function_arg_round_boundary (enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED)
+{
+ return PARM_BOUNDARY;
+}
+
void
hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED)
{
(cumulative_args_t, enum machine_mode, const_tree, bool);
extern unsigned int default_function_arg_boundary (enum machine_mode,
const_tree);
+extern unsigned int default_function_arg_round_boundary (enum machine_mode,
+ const_tree);
extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
extern rtx default_function_value (const_tree, const_tree, bool);
extern rtx default_libcall_value (enum machine_mode, const_rtx);