public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [tuples] Fix remaining gimplifier ICEs in check-gcc
@ 2007-08-07 19:29 Diego Novillo
  0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2007-08-07 19:29 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]


This patch adds a new function to determine the type returned by a
GIMPLE_CALL.  This was causing the only check-gcc failure in the
gimplifier.  Now on to the gimplifier ICEs in the other front ends.


[-- Attachment #2: 20070807-add-gimple_call_return_type.diff --]
[-- Type: text/x-patch, Size: 1511 bytes --]

2007-08-07  Diego Novillo  <dnovillo@google.com>

	* gimple.h (gimple_call_return): New.
	* gimplify.c (get_tmp_var_for): Call it.

Index: gimplify.c
===================================================================
--- gimplify.c	(revision 127275)
+++ gimplify.c	(working copy)
@@ -634,9 +634,9 @@ get_tmp_var_for (gimple stmt)
 
   /* FIXME tuples, add support for formal temporaries (worth it?)  */
   if (code == GIMPLE_ASSIGN)
-    return create_tmp_from_val (gimple_assign_operand (stmt, 1));
+    lhs = create_tmp_from_val (gimple_assign_operand (stmt, 1));
   else if (code == GIMPLE_CALL)
-    return create_tmp_var (TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt))),
+    lhs = create_tmp_var (gimple_call_return_type (stmt),
 			   get_name (gimple_call_fn (stmt)));
   else
     gcc_unreachable ();
Index: gimple.h
===================================================================
--- gimple.h	(revision 127275)
+++ gimple.h	(working copy)
@@ -574,6 +574,23 @@ gimple_call_fn (gimple gs)
 }
 
 static inline tree
+gimple_call_return_type (gimple gs)
+{
+  tree fn = gimple_call_fn (gs);
+  tree type = TREE_TYPE (fn);
+
+  /* See through pointer to functions.  */
+  if (TREE_CODE (type) == POINTER_TYPE)
+    type = TREE_TYPE (type);
+
+  gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
+
+  /* The type returned by a FUNCTION_DECL is the type of its
+     function type.  */
+  return TREE_TYPE (type);
+}
+
+static inline tree
 gimple_call_chain (gimple gs)
 {
   GIMPLE_CHECK (gs, GIMPLE_CALL);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-07 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-07 19:29 [tuples] Fix remaining gimplifier ICEs in check-gcc Diego Novillo

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