summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-14 20:59:12 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-14 20:59:12 +0000
commit4d19e7b378a28449190f722dc2d0536e97847c01 (patch)
treec6699fd934a8029f9dfb89ab3935ecb5f9f40682
parent0841d2957f82d21f5a460cde89ab25398a5bb508 (diff)
downloadgcc-4d19e7b378a28449190f722dc2d0536e97847c01.tar.gz
* config/mmix/mmix.c (mmix_opposite_regno): Handle the
return-value register too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192441 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/mmix/mmix.c26
2 files changed, 27 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f72c5300d4..82427de24ac 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-14 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * config/mmix/mmix.c (mmix_opposite_regno): Handle the
+ return-value register too.
+
2012-10-14 Steven Bosscher <steven@gcc.gnu.org>
PR rtl-optimization/38711
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 26668e76da8..1ce88001277 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -392,15 +392,33 @@ mmix_conditional_register_usage (void)
/* INCOMING_REGNO and OUTGOING_REGNO worker function.
Those two macros must only be applied to function argument
- registers. FIXME: for their current use in gcc, it'd be better
- with an explicit specific additional FUNCTION_INCOMING_ARG_REGNO_P
- a'la TARGET_FUNCTION_ARG / TARGET_FUNCTION_INCOMING_ARG instead of
+ registers and the function return value register for the opposite
+ use. FIXME: for their current use in gcc, it'd be better with an
+ explicit specific additional FUNCTION_INCOMING_ARG_REGNO_P a'la
+ TARGET_FUNCTION_ARG / TARGET_FUNCTION_INCOMING_ARG instead of
forcing the target to commit to a fixed mapping and for any
- unspecified register use. */
+ unspecified register use. Particularly when thinking about the
+ return-value, it is better to imagine INCOMING_REGNO and
+ OUTGOING_REGNO as named CALLEE_TO_CALLER_REGNO and INNER_REGNO as
+ named CALLER_TO_CALLEE_REGNO because the direction. The "incoming"
+ and "outgoing" is from the perspective of the parameter-registers,
+ but the same macro is (must be, lacking an alternative like
+ suggested above) used to map the return-value-register from the
+ same perspective. To make directions even more confusing, the macro
+ MMIX_OUTGOING_RETURN_VALUE_REGNUM holds the number of the register
+ in which to return a value, i.e. INCOMING_REGNO for the return-value-
+ register as received from a called function; the return-value on the
+ way out. */
int
mmix_opposite_regno (int regno, int incoming)
{
+ if (incoming && regno == MMIX_OUTGOING_RETURN_VALUE_REGNUM)
+ return MMIX_RETURN_VALUE_REGNUM;
+
+ if (!incoming && regno == MMIX_RETURN_VALUE_REGNUM)
+ return MMIX_OUTGOING_RETURN_VALUE_REGNUM;
+
if (!mmix_function_arg_regno_p (regno, incoming))
return regno;