summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-04 12:01:21 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-04 12:01:21 +0000
commitadaf4ef091f57a9a977db881fc2f3ce5a7fdd3bb (patch)
tree8900c45044a2c5fcbab68008ebff0cf2f9c08fa3 /gcc
parent852640e9c5bf075aaa74b75ee6bd276f81a135d9 (diff)
downloadgcc-adaf4ef091f57a9a977db881fc2f3ce5a7fdd3bb.tar.gz
2011-05-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* calls.c (emit_library_call_value_1): Invoke promote_function_mode hook on libcall arguments. * explow.c (promote_function_mode, promote_mode): Handle TYPE argument being NULL. * targhooks.c (default_promote_function_mode): Lisewise. * config/s390/s390.c (s390_promote_function_mode): Likewise. * config/sparc/sparc.c (sparc_promote_function_mode): Likewise. * doc/tm.texi: Document that TYPE argument might be NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/calls.c5
-rw-r--r--gcc/config/s390/s390.c2
-rw-r--r--gcc/config/sparc/sparc.c6
-rw-r--r--gcc/doc/tm.texi2
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/explow.c17
-rw-r--r--gcc/targhooks.c2
8 files changed, 41 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c77c1396a25..1f6d535c81e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2011-05-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * calls.c (emit_library_call_value_1): Invoke
+ promote_function_mode hook on libcall arguments.
+ * explow.c (promote_function_mode, promote_mode): Handle TYPE
+ argument being NULL.
+ * targhooks.c (default_promote_function_mode): Lisewise.
+ * config/s390/s390.c (s390_promote_function_mode): Likewise.
+ * config/sparc/sparc.c (sparc_promote_function_mode): Likewise.
+
+ * doc/tm.texi: Document that TYPE argument might be NULL.
+
2011-05-04 Stuart Henderson <shenders@gcc.gnu.org>
* config/bfin/bfin.c (bfin_cpus): Update silicon revisions.
diff --git a/gcc/calls.c b/gcc/calls.c
index 98f3009905a..44a16ff63ff 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -3477,6 +3477,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
{
rtx val = va_arg (p, rtx);
enum machine_mode mode = (enum machine_mode) va_arg (p, int);
+ int unsigned_p = 0;
/* We cannot convert the arg value to the mode the library wants here;
must do it earlier where we know the signedness of the arg. */
@@ -3524,9 +3525,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
val = force_operand (XEXP (slot, 0), NULL_RTX);
}
- argvec[count].value = val;
+ mode = promote_function_mode (NULL_TREE, mode, &unsigned_p, NULL_TREE, 0);
argvec[count].mode = mode;
-
+ argvec[count].value = convert_modes (mode, GET_MODE (val), val, unsigned_p);
argvec[count].reg = targetm.calls.function_arg (&args_so_far, mode,
NULL_TREE, true);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index e0f98e686e3..932ad31cfb7 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8742,7 +8742,7 @@ s390_promote_function_mode (const_tree type, enum machine_mode mode,
if (INTEGRAL_MODE_P (mode)
&& GET_MODE_SIZE (mode) < UNITS_PER_LONG)
{
- if (POINTER_TYPE_P (type))
+ if (type != NULL_TREE && POINTER_TYPE_P (type))
*punsignedp = POINTERS_EXTEND_UNSIGNED;
return Pmode;
}
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 44ba5f77002..a3bab331910 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -4983,13 +4983,13 @@ init_cumulative_args (struct sparc_args *cum, tree fntype,
/* Handle promotion of pointer and integer arguments. */
static enum machine_mode
-sparc_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+sparc_promote_function_mode (const_tree type,
enum machine_mode mode,
- int *punsignedp ATTRIBUTE_UNUSED,
+ int *punsignedp,
const_tree fntype ATTRIBUTE_UNUSED,
int for_return ATTRIBUTE_UNUSED)
{
- if (POINTER_TYPE_P (type))
+ if (type != NULL_TREE && POINTER_TYPE_P (type))
{
*punsignedp = POINTERS_EXTEND_UNSIGNED;
return Pmode;
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 7351e8338b8..874a2237829 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -962,6 +962,8 @@ which an incoming parameter is copied, or the outgoing result is computed;
then the hook should return the same mode as @code{promote_mode}, though
the signedness may be different.
+@var{type} can be NULL when promoting function arguments of libcalls.
+
The default is to not promote arguments and return values. You can
also define the hook to @code{default_promote_function_mode_always_promote}
if you would like to apply the same rules given by @code{PROMOTE_MODE}.
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 45d5982eb7b..be84e4e84fa 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -952,6 +952,8 @@ which an incoming parameter is copied, or the outgoing result is computed;
then the hook should return the same mode as @code{promote_mode}, though
the signedness may be different.
+@var{type} can be NULL when promoting function arguments of libcalls.
+
The default is to not promote arguments and return values. You can
also define the hook to @code{default_promote_function_mode_always_promote}
if you would like to apply the same rules given by @code{PROMOTE_MODE}.
diff --git a/gcc/explow.c b/gcc/explow.c
index a0a160dd2bd..da04505a7e8 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -771,6 +771,17 @@ enum machine_mode
promote_function_mode (const_tree type, enum machine_mode mode, int *punsignedp,
const_tree funtype, int for_return)
{
+ /* Called without a type node for a libcall. */
+ if (type == NULL_TREE)
+ {
+ if (INTEGRAL_MODE_P (mode))
+ return targetm.calls.promote_function_mode (NULL_TREE, mode,
+ punsignedp, funtype,
+ for_return);
+ else
+ return mode;
+ }
+
switch (TREE_CODE (type))
{
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
@@ -791,6 +802,12 @@ enum machine_mode
promote_mode (const_tree type ATTRIBUTE_UNUSED, enum machine_mode mode,
int *punsignedp ATTRIBUTE_UNUSED)
{
+ /* For libcalls this is invoked without TYPE from the backends
+ TARGET_PROMOTE_FUNCTION_MODE hooks. Don't do anything in that
+ case. */
+ if (type == NULL_TREE)
+ return mode;
+
/* FIXME: this is the same logic that was there until GCC 4.4, but we
probably want to test POINTERS_EXTEND_UNSIGNED even if PROMOTE_MODE
is not defined. The affected targets are M32C, S390, SPARC. */
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 93a2c305c8b..48d19a05416 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -124,7 +124,7 @@ default_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
const_tree funtype ATTRIBUTE_UNUSED,
int for_return ATTRIBUTE_UNUSED)
{
- if (for_return == 2)
+ if (type != NULL_TREE && for_return == 2)
return promote_mode (type, mode, punsignedp);
return mode;
}