[lto] i386.c: Simplify x86_this_parameter.

Kazu Hirata kazu@codesourcery.com
Sat Jun 10 17:21:00 GMT 2006


Hi,

Attached is a patch to simplify x86_this_parameter.

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.

The patch should be fairly obvious given that get_parm_info guarantees
that void_type_node can appear only at the end of the linked list
pointed to by TYPE_ARG_TYPES.

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
	tree_last.

Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c	(revision 114406)
--- config/i386/i386.c	(working copy)
*************** x86_this_parameter (tree function)
*** 17273,17288 ****
  
    if (ix86_function_regparm (type, function) > 0)
      {
!       tree parm;
  
!       parm = TYPE_ARG_TYPES (type);
!       /* Figure out whether or not the function has a variable number of
! 	 arguments.  */
!       for (; parm; parm = TREE_CHAIN (parm))
! 	if (TREE_VALUE (parm) == void_type_node)
! 	  break;
!       /* If not, the this parameter is in the first argument.  */
!       if (parm)
  	{
  	  int regno = 0;
  	  if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
--- 17273,17283 ----
  
    if (ix86_function_regparm (type, function) > 0)
      {
!       tree arg_types = TYPE_ARG_TYPES (type);
  
!       /* If the function does not have a variable number of arguments,
! 	 then the this parameter is in the first argument.  */
!       if (arg_types && TREE_VALUE (tree_last (arg_types)) == void_type_node)
  	{
  	  int regno = 0;
  	  if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))



More information about the Gcc-patches mailing list