This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[power7-meissner] Modify how builtin function decls are created


In looking at a bug, I decided that it was simpler for builtin_function_type to
create the function list via tree_cons, rather than having a switch statement
to call builtin_function_type_list with different number of arguments, and
those functions would create the list and call builtin_function_type.

I also checked in the fix for PR 40219 into the branch.

2009-05-22  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (builtin_function_type): Create the
	argument list and call builtin_function_type instead of calling
	the varargs builtin_function_type_list.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 147757)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -11444,6 +11444,7 @@ builtin_function_type (enum machine_mode
   int i;
   tree ret_type = NULL_TREE;
   tree arg_type[3] = { NULL_TREE, NULL_TREE, NULL_TREE };
+  tree args;
 
   /* Create builtin_hash_table.  */
   if (builtin_hash_table == NULL)
@@ -11567,28 +11568,12 @@ builtin_function_type (enum machine_mode
       h2 = GGC_NEW (struct builtin_hash_struct);
       *h2 = h;
       *found = (void *)h2;
+      args = void_list_node;
 
-      switch (num_args)
-	{
-	case 1:
-	  h2->type = build_function_type_list (ret_type, arg_type[0],
-					       NULL_TREE);
-	  break;
+      for (i = num_args - 1; i >= 0; i--)
+	args = tree_cons (NULL_TREE, arg_type[i], args);
 
-	case 2:
-	  h2->type = build_function_type_list (ret_type, arg_type[0],
-					       arg_type[1], NULL_TREE);
-	  break;
-
-	case 3:
-	  h2->type = build_function_type_list (ret_type, arg_type[0],
-					       arg_type[1], arg_type[2],
-					       NULL_TREE);
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
+      h2->type = build_function_type (ret_type, args);
     }
 
   return ((struct builtin_hash_struct *)(*found))->type;


-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]