public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Bernd Schmidt <bernds@codesourcery.com>,
	Richard Henderson <rth@redhat.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	gcc-patches@gcc.gnu.org, Jeff Law <law@redhat.com>
Subject: Re: [x32] PATCH: PR middle-end/47725: [x32] error: unable to find a register to spill in class DIREG
Date: Thu, 24 Mar 2011 15:56:00 -0000	[thread overview]
Message-ID: <201103241651.28202.ebotcazou@adacore.com> (raw)
In-Reply-To: <AANLkTinjSkpnPcc59JoDTBm-SXi974s16JXN5rkAcQ+g@mail.gmail.com>

> Pointer is promoted to Pmode from ptr_mode.

Indeed.  However the problem is the 2 in assign_parm_setup_reg:

  /* Store the parm in a pseudoregister during the function, but we may
     need to do it in a wider mode.  Using 2 here makes the result
     consistent with promote_decl_mode and thus expand_expr_real_1.  */
 promoted_nominal_mode
   = promote_function_mode (data->nominal_type, data->nominal_mode, &unsignedp,
			     TREE_TYPE (current_function_decl), 2);

which is supposed to match the 2 in promote_decl_mode:

  if (TREE_CODE (decl) == RESULT_DECL
      || TREE_CODE (decl) == PARM_DECL)
    pmode = promote_function_mode (type, mode, &unsignedp,
                                   TREE_TYPE (current_function_decl), 2);
  else
    pmode = promote_mode (type, mode, &unsignedp);

but doesn't match the 0 in assign_parm_find_data_types:

  promoted_mode = promote_function_mode (passed_type, passed_mode, &unsignedp,
				         TREE_TYPE (current_function_decl), 0);

so you get the redundant extension in the callee.  The solution is to define 
the promote_function_mode hook for x86 to something like:

static enum machine_mode
ix86_promote_function_mode (const_tree type,
                            enum machine_mode mode,
                            int *punsignedp,
                            const_tree fntype ATTRIBUTE_UNUSED,
                            int for_return ATTRIBUTE_UNUSED)
{
  if (POINTER_TYPE_P (type))
    {
      *punsignedp = POINTERS_EXTEND_UNSIGNED;
      return Pmode;
    }

  return mode;
}

-- 
Eric Botcazou

  reply	other threads:[~2011-03-24 15:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 19:04 H.J. Lu
2011-02-14 19:07 ` Jeff Law
2011-02-14 19:11   ` H.J. Lu
2011-02-14 19:17     ` Jeff Law
2011-02-14 19:39       ` Eric Botcazou
2011-02-14 19:49         ` Bernd Schmidt
2011-02-14 19:51           ` Eric Botcazou
2011-02-15 23:09             ` Bernd Schmidt
2011-03-18  0:30               ` H.J. Lu
2011-03-18  4:01                 ` H.J. Lu
2011-03-21  4:15                   ` H.J. Lu
2011-03-22 20:10                     ` Eric Botcazou
2011-03-23  3:29                       ` H.J. Lu
2011-03-23  8:27                         ` Eric Botcazou
2011-03-23 10:57                           ` H.J. Lu
2011-03-24 15:56                             ` Eric Botcazou [this message]
2011-03-29 17:50                               ` H.J. Lu
2011-02-14 19:54           ` H.J. Lu
2011-02-15 15:53             ` Bernd Schmidt
2011-02-15 17:02               ` H.J. Lu
2011-02-15 17:49               ` Eric Botcazou
2011-02-15 18:14                 ` H.J. Lu
2011-02-15 19:03                   ` Eric Botcazou
2011-02-15 21:16                   ` Jeff Law
2011-02-15 21:39                 ` Bernd Schmidt

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=201103241651.28202.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=law@redhat.com \
    --cc=rth@redhat.com \
    --cc=ubizjak@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).