[lto] i386.c: Simplify init_cumulative_args.
Kazu Hirata
kazu@codesourcery.com
Sat Jun 10 17:46:00 GMT 2006
Hi,
Attached is a patch to simplify init_cumulative_args.
One of the things we would like to do on the LTO branch is to stop
using TREE_LIST in TYPE_ARG_TYPES. While working on a patch to
achieve that, I've noticed a clean-up opportunity shown below in the
form of a patch, which will also make the aforementioned patch smaller
and easier to review.
Observe that the control will get to "if (!TARGET_64_BIT)" if and only
if
- fntype is non-NULL,
- the linked list pointed to by TYPE_ARG_TYPES (fntype) contains at
least one type, and
- the linked list does not end with void_type_node.
The last two are exactly what stdarg_p does.
Tested on x86_64-pc-linux-gnu. OK to apply to the LTO branch?
Kazu Hirata
2006-06-10 Kazu Hirata <kazu@codesourcery.com>
* config/gcc/i386.c (init_cumulative_args): Simplify using
stdarg_p.
Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c (revision 114406)
--- config/i386/i386.c (working copy)
*************** init_cumulative_args (CUMULATIVE_ARGS *c
*** 2696,2702 ****
tree fndecl)
{
static CUMULATIVE_ARGS zero_cum;
- tree param, next_param;
if (TARGET_DEBUG_ARG)
{
--- 2696,2701 ----
*************** init_cumulative_args (CUMULATIVE_ARGS *c
*** 2746,2772 ****
are no variable arguments. If there are variable arguments, then
we won't pass anything in registers in 32-bit mode. */
! if (cum->nregs || cum->mmx_nregs || cum->sse_nregs)
{
! for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0;
! param != 0; param = next_param)
{
! next_param = TREE_CHAIN (param);
! if (next_param == 0 && TREE_VALUE (param) != void_type_node)
! {
! if (!TARGET_64BIT)
! {
! cum->nregs = 0;
! cum->sse_nregs = 0;
! cum->mmx_nregs = 0;
! cum->warn_sse = 0;
! cum->warn_mmx = 0;
! cum->fastcall = 0;
! cum->float_in_sse = 0;
! }
! cum->maybe_vaarg = true;
! }
}
}
if ((!fntype && !libname)
|| (fntype && !TYPE_ARG_TYPES (fntype)))
--- 2745,2764 ----
are no variable arguments. If there are variable arguments, then
we won't pass anything in registers in 32-bit mode. */
! if ((cum->nregs || cum->mmx_nregs || cum->sse_nregs)
! && fntype && stdarg_p (fntype))
{
! if (!TARGET_64BIT)
{
! cum->nregs = 0;
! cum->sse_nregs = 0;
! cum->mmx_nregs = 0;
! cum->warn_sse = 0;
! cum->warn_mmx = 0;
! cum->fastcall = 0;
! cum->float_in_sse = 0;
}
+ cum->maybe_vaarg = true;
}
if ((!fntype && !libname)
|| (fntype && !TYPE_ARG_TYPES (fntype)))
More information about the Gcc-patches
mailing list