public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Diego Novillo <dnovillo@google.com>
To: gcc-patches@gcc.gnu.org
Subject: [tuples] Fix remaining gimplifier ICEs in check-gcc
Date: Tue, 07 Aug 2007 19:29:00 -0000	[thread overview]
Message-ID: <46B8C7E5.4070805@google.com> (raw)

[-- 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);

                 reply	other threads:[~2007-08-07 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46B8C7E5.4070805@google.com \
    --to=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).