From: Eric Botcazou <ebotcazou@adacore.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, Paolo Bonzini <bonzini@gnu.org>,
Andrew Pinski <pinskia@gmail.com>
Subject: Re: Patch: PR40900, extending call patterns
Date: Wed, 16 Jun 2010 21:23:00 -0000 [thread overview]
Message-ID: <201006162234.20410.ebotcazou@adacore.com> (raw)
In-Reply-To: <4C123547.90303@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
> That would be good.
Very lightly tested.
* expr.c (expand_expr_real_1) <SSA_NAME>: Fix long line. Save the
original expression for later reuse.
<expand_decl_rtl>: Use promote_function_mode to compute the signedness
of the promoted RTL for a SSA_NAME on the LHS of a call statement.
--
Eric Botcazou
[-- Attachment #2: pr40900.diff --]
[-- Type: text/x-diff, Size: 2555 bytes --]
Index: expr.c
===================================================================
--- expr.c (revision 160776)
+++ expr.c (working copy)
@@ -8284,6 +8284,8 @@ expand_expr_real_1 (tree exp, rtx target
location_t loc = EXPR_LOCATION (exp);
struct separate_ops ops;
tree treeop0, treeop1, treeop2;
+ tree ssa_name = NULL_TREE;
+ gimple g;
type = TREE_TYPE (exp);
mode = TYPE_MODE (type);
@@ -8396,15 +8398,17 @@ expand_expr_real_1 (tree exp, rtx target
base variable. This unnecessarily allocates a pseudo, see how we can
reuse it, if partition base vars have it set already. */
if (!currently_expanding_to_rtl)
- return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier, NULL);
- {
- gimple g = get_gimple_for_ssa_name (exp);
- if (g)
- return expand_expr_real (gimple_assign_rhs_to_tree (g), target,
- tmode, modifier, NULL);
- }
- decl_rtl = get_rtx_for_ssa_name (exp);
- exp = SSA_NAME_VAR (exp);
+ return expand_expr_real_1 (SSA_NAME_VAR (exp), target, tmode, modifier,
+ NULL);
+
+ g = get_gimple_for_ssa_name (exp);
+ if (g)
+ return expand_expr_real (gimple_assign_rhs_to_tree (g), target, tmode,
+ modifier, NULL);
+
+ ssa_name = exp;
+ decl_rtl = get_rtx_for_ssa_name (ssa_name);
+ exp = SSA_NAME_VAR (ssa_name);
goto expand_decl_rtl;
case PARM_DECL:
@@ -8506,15 +8510,21 @@ expand_expr_real_1 (tree exp, rtx target
/* If the mode of DECL_RTL does not match that of the decl, it
must be a promoted value. We return a SUBREG of the wanted mode,
but mark it so that we know that it was already extended. */
-
- if (REG_P (decl_rtl)
- && GET_MODE (decl_rtl) != DECL_MODE (exp))
+ if (REG_P (decl_rtl) && GET_MODE (decl_rtl) != DECL_MODE (exp))
{
enum machine_mode pmode;
- /* Get the signedness used for this variable. Ensure we get the
- same mode we got when the variable was declared. */
- pmode = promote_decl_mode (exp, &unsignedp);
+ /* Get the signedness to be used for this variable. Ensure we get
+ the same mode we got when the variable was declared. */
+ if (code == SSA_NAME
+ && (g = SSA_NAME_DEF_STMT (ssa_name))
+ && gimple_code (g) == GIMPLE_CALL)
+ pmode = promote_function_mode (type, mode, &unsignedp,
+ TREE_TYPE
+ (TREE_TYPE (gimple_call_fn (g))),
+ 2);
+ else
+ pmode = promote_decl_mode (exp, &unsignedp);
gcc_assert (GET_MODE (decl_rtl) == pmode);
temp = gen_lowpart_SUBREG (mode, decl_rtl);
next prev parent reply other threads:[~2010-06-16 20:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-30 1:05 Bernd Schmidt
2010-04-30 3:33 ` Andrew Pinski
2010-04-30 9:23 ` Paolo Bonzini
2010-04-30 15:09 ` Bernd Schmidt
[not found] ` <201005010054.17350.ebotcazou@adacore.com>
2010-05-01 10:45 ` Paolo Bonzini
2010-05-03 9:39 ` Bernd Schmidt
2010-05-05 13:01 ` Eric Botcazou
2010-05-06 7:14 ` Paolo Bonzini
2010-05-06 7:36 ` Eric Botcazou
2010-06-08 21:56 ` Bernd Schmidt
2010-06-09 22:14 ` Eric Botcazou
2010-06-11 13:58 ` Bernd Schmidt
2010-06-16 21:23 ` Eric Botcazou [this message]
2010-06-18 7:31 ` Bernd Schmidt
2010-06-18 17:09 ` 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=201006162234.20410.ebotcazou@adacore.com \
--to=ebotcazou@adacore.com \
--cc=bernds@codesourcery.com \
--cc=bonzini@gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=pinskia@gmail.com \
/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).