public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Richard Guenther <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org, Diego Novillo <dnovillo@google.com>
Subject: Re: [PATCH][RFC] Make called function type explicit, make function pointer type conversions useless
Date: Thu, 14 Apr 2011 09:57:00 -0000	[thread overview]
Message-ID: <201104141151.28243.ebotcazou@adacore.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1104081744100.810@zhemvz.fhfr.qr>

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

> This is the "real" fix for PR46076 that I wanted to persue.  Make
> function pointer type conversions useless as to more aggressively
> be able to turn indirect into direct calls.  This requires that we
> preserve the original type signature of the called function as
> presented by the frontend.  The patch does that by adding a fntype
> field to every call stmt in GIMPLE and extract this information
> during gimplification.

The patch is incomplete though: the type is preserved at the GIMPLE level but 
is dropped at the RTL level, so you can get call convention mismatches.  The
attached patch is needed to cure the 3 ACATS failures on x86:

FAIL:   c431001
FAIL:   c731001
FAIL:   ca11c02

I think the GIMPLE->Tree->RTL interface would need to be audited here.


	* cfgexpand.c (expand_call_stmt): Rematerialize original function type.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 544 bytes --]

Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 172371)
+++ cfgexpand.c	(working copy)
@@ -1844,7 +1844,10 @@ expand_call_stmt (gimple stmt)
 
   exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
 
-  CALL_EXPR_FN (exp) = gimple_call_fn (stmt);
+  CALL_EXPR_FN (exp)
+    = fold_build1 (NOP_EXPR, build_pointer_type (gimple_call_fntype (stmt)),
+			     gimple_call_fn (stmt));
+
   decl = gimple_call_fndecl (stmt);
   builtin_p = decl && DECL_BUILT_IN (decl);
 

  parent reply	other threads:[~2011-04-14  9:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 15:49 Richard Guenther
2011-04-11 13:18 ` Diego Novillo
2011-04-12 10:44   ` Richard Guenther
2011-04-13  2:28 ` H.J. Lu
2011-04-14  9:57 ` Eric Botcazou [this message]
2011-04-14 10:15   ` Richard Guenther
2011-04-14 13:40   ` Richard Guenther
2011-04-14 15:58     ` Eric Botcazou
2011-04-14 16:05       ` Richard Guenther
2011-04-14 16:37         ` Eric Botcazou
2011-04-15  9:29           ` Richard Guenther
2011-04-15  3:00         ` Eric Botcazou
2011-04-15  8:20           ` Eric Botcazou

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=201104141151.28243.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).