public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] use build_function_type_list in the sh backend
@ 2011-04-20 21:05 Nathan Froyd
  2011-05-02 22:55 ` Kaz Kojima
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2011-04-20 21:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: kkojima

As $SUBJECT suggests.  The only tricky bit is the initialization of
`args' to NULL_TREEs so that we can safely pass all of the relevant args
to build_function_type_list, regardless of whether the function type in
question has that many args.

Tested with cross to sh-elf.  OK to commit?

-Nathan

	* config/sh/sh.c (sh_media_init_builtins): Call
	build_function_type_list instead of build_function_type.

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 78f6f0f..0f158d5 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -11222,6 +11222,7 @@ sh_media_init_builtins (void)
       else
 	{
 	  int has_result = signature_args[signature][0] != 0;
+	  tree args[3];
 
 	  if ((signature_args[signature][1] & 8)
 	      && (((signature_args[signature][1] & 1) && TARGET_SHMEDIA32)
@@ -11230,7 +11231,8 @@ sh_media_init_builtins (void)
 	  if (! TARGET_FPU_ANY
 	      && FLOAT_MODE_P (insn_data[d->icode].operand[0].mode))
 	    continue;
-	  type = void_list_node;
+	  for (i = 0; i < (int) ARRAY_SIZE (args); i++)
+	    args[i] = NULL_TREE;
 	  for (i = 3; ; i--)
 	    {
 	      int arg = signature_args[signature][i];
@@ -11248,9 +11250,10 @@ sh_media_init_builtins (void)
 		arg_type = void_type_node;
 	      if (i == 0)
 		break;
-	      type = tree_cons (NULL_TREE, arg_type, type);
+	      args[i-1] = arg_type;
 	    }
-	  type = build_function_type (arg_type, type);
+	  type = build_function_type_list (arg_type, args[0], args[1],
+					   args[2], NULL_TREE);
 	  if (signature < SH_BLTIN_NUM_SHARED_SIGNATURES)
 	    shared[signature] = type;
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] use build_function_type_list in the sh backend
  2011-04-20 21:05 [PATCH] use build_function_type_list in the sh backend Nathan Froyd
@ 2011-05-02 22:55 ` Kaz Kojima
  0 siblings, 0 replies; 2+ messages in thread
From: Kaz Kojima @ 2011-05-02 22:55 UTC (permalink / raw)
  To: froydnj; +Cc: gcc-patches

Nathan Froyd <froydnj@codesourcery.com> wrote:
> As $SUBJECT suggests.  The only tricky bit is the initialization of
> `args' to NULL_TREEs so that we can safely pass all of the relevant args
> to build_function_type_list, regardless of whether the function type in
> question has that many args.
> 
> Tested with cross to sh-elf.  OK to commit?

OK.  Thanks for the patch and sorry for the very slow reply.

Regards,
	kaz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-02 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 21:05 [PATCH] use build_function_type_list in the sh backend Nathan Froyd
2011-05-02 22:55 ` Kaz Kojima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).