stormy16 (xstormy16_init_builtins): Call build_function_type_list instead of build_fu...
authorNathan Froyd <froydnj@codesourcery.com>
Tue, 3 May 2011 15:52:20 +0000 (15:52 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Tue, 3 May 2011 15:52:20 +0000 (15:52 +0000)
* config/stormy16/stormy16 (xstormy16_init_builtins): Call
build_function_type_list instead of build_function_type.
Rearrange initialization of `args' to do so.

From-SVN: r173321

gcc/ChangeLog
gcc/config/stormy16/stormy16.c

index 3f39898fb3d4fa51e0395768a99e4c326db39a81..6817e7b13b5b4321219fd9a57a783bbc4e2ac588 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-03  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * config/stormy16/stormy16 (xstormy16_init_builtins): Call
+       build_function_type_list instead of build_function_type.
+       Rearrange initialization of `args' to do so.
+
 2011-05-03  Nathan Froyd  <froydnj@codesourcery.com>
 
        * config/i386/i386.c (ix86_code_end): Call build_function_type_list
index 052285c284afdb35d27b67258011df603dd78ef0..1a90e16da08f355e1a60f08561befbd6c39e2104 100644 (file)
@@ -2255,15 +2255,21 @@ static struct
 static void
 xstormy16_init_builtins (void)
 {
-  tree args, ret_type, arg;
-  int i, a;
+  tree args[2], ret_type, arg = NULL_TREE, ftype;
+  int i, a, n_args;
 
   ret_type = void_type_node;
 
   for (i = 0; s16builtins[i].name; i++)
     {
-      args = void_list_node;
-      for (a = strlen (s16builtins[i].arg_types) - 1; a >= 0; a--)
+      n_args = strlen (s16builtins[i].arg_types) - 1;
+
+      gcc_assert (n_args <= (int) ARRAY_SIZE (args));
+
+      for (a = n_args; a >= 0; a--)
+       args[a] = NULL_TREE;
+
+      for (a = n_args; a >= 0; a--)
        {
          switch (s16builtins[i].arg_types[a])
            {
@@ -2276,10 +2282,10 @@ xstormy16_init_builtins (void)
          if (a == 0)
            ret_type = arg;
          else
-           args = tree_cons (NULL_TREE, arg, args);
+           args[a-1] = arg;
        }
-      add_builtin_function (s16builtins[i].name,
-                           build_function_type (ret_type, args),
+      ftype = build_function_type_list (ret_type, arg[0], arg[1], NULL_TREE);
+      add_builtin_function (s16builtins[i].name, ftype,
                            i, BUILT_IN_MD, NULL, NULL);
     }
 }