From: "H.J. Lu" <hongjiu.lu@intel.com>
To: gcc-patches@gcc.gnu.org, Uros Bizjak <ubizjak@gmail.com>
Subject: PATCH [3/n] X32: Promote pointers to Pmode
Date: Sat, 09 Jul 2011 21:37:00 -0000 [thread overview]
Message-ID: <20110709212846.GA3563@intel.com> (raw)
Hi,
X32 psABI requires promoting pointers to Pmode when passing/returning
in registers. OK for trunk?
Thanks.
H.J.
--
2011-07-09 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (ix86_promote_function_mode): New.
(TARGET_PROMOTE_FUNCTION_MODE): Likewise.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 04cb07d..c852719 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7052,6 +7061,23 @@ ix86_function_value (const_tree valtype, const_tree fntype_or_decl,
return ix86_function_value_1 (valtype, fntype_or_decl, orig_mode, mode);
}
+/* Pointer function arguments and return values are promoted to
+ Pmode. */
+
+static enum machine_mode
+ix86_promote_function_mode (const_tree type, enum machine_mode mode,
+ int *punsignedp, const_tree fntype,
+ int for_return)
+{
+ if (for_return != 1 && type != NULL_TREE && POINTER_TYPE_P (type))
+ {
+ *punsignedp = POINTERS_EXTEND_UNSIGNED;
+ return Pmode;
+ }
+ return default_promote_function_mode (type, mode, punsignedp, fntype,
+ for_return);
+}
+
rtx
ix86_libcall_value (enum machine_mode mode)
{
@@ -34810,6 +35154,9 @@ ix86_autovectorize_vector_sizes (void)
#undef TARGET_FUNCTION_VALUE_REGNO_P
#define TARGET_FUNCTION_VALUE_REGNO_P ix86_function_value_regno_p
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE ix86_promote_function_mode
+
#undef TARGET_SECONDARY_RELOAD
#define TARGET_SECONDARY_RELOAD ix86_secondary_reload
next reply other threads:[~2011-07-09 21:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-09 21:37 H.J. Lu [this message]
2011-07-10 16:37 ` Uros Bizjak
2011-07-10 19:56 ` H.J. Lu
2011-07-10 23:51 ` Richard Henderson
2011-07-11 0:04 ` H.J. Lu
2011-07-11 1:16 ` Richard Henderson
2011-07-11 1:47 ` H.J. Lu
2011-07-13 14:07 ` H.J. Lu
2011-07-13 15:36 ` Richard Henderson
2011-07-13 15:38 ` H.J. Lu
2011-07-13 16:13 ` Richard Henderson
2011-07-14 7:36 ` H.J. Lu
2011-07-21 22:30 ` H.J. Lu
2011-07-21 22:46 ` Richard Henderson
2011-07-22 0:10 ` H.J. Lu
2011-07-22 3:23 ` Richard Henderson
2011-07-22 4:22 ` H.J. Lu
2011-07-22 8:08 ` H.J. Lu
2011-07-22 13:31 ` H.J. Lu
2011-07-22 16:34 ` Richard Henderson
2011-07-13 13:42 ` H.J. Lu
2011-07-13 13:48 ` Uros Bizjak
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=20110709212846.GA3563@intel.com \
--to=hongjiu.lu@intel.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.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).