aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-10-19 10:26:31 +0000
committerNick Clifton <nickc@gcc.gnu.org>2010-10-19 10:26:31 +0000
commite2f289f3c75abb5716f15cd7d3e0d78b0439f952 (patch)
tree759435ed53eb8bc0782ca50e78af2f1dee8ae542 /gcc
parent462027293874eb55bf0da3468f5635bc9f550ed3 (diff)
downloadgcc-e2f289f3c75abb5716f15cd7d3e0d78b0439f952.zip
gcc-e2f289f3c75abb5716f15cd7d3e0d78b0439f952.tar.gz
gcc-e2f289f3c75abb5716f15cd7d3e0d78b0439f952.tar.bz2
rx.c (rx_function_value): Small integer types are promotes to SImode.
* config/rx/rx.c (rx_function_value): Small integer types are promotes to SImode. (rx_promote_function_mode): New function. (TARGET_PROMOTE_FUNCTION_MODE): Define. From-SVN: r165690
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rx/rx.c30
2 files changed, 36 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d6ada9..e124df7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2010-10-19 Nick Clifton <nickc@redhat.com>
+ * config/rx/rx.c (rx_function_value): Small integer types are
+ promotes to SImode.
+ (rx_promote_function_mode): New function.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+
+2010-10-19 Nick Clifton <nickc@redhat.com>
+
* config/mep/mep.c (mep_print_operand): Use
targetm.strip_name_encoding.
(mep_output_aligned_common): Likewise.
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index f087c66..2ce5f58 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -830,7 +830,32 @@ rx_function_value (const_tree ret_type,
const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
bool outgoing ATTRIBUTE_UNUSED)
{
- return gen_rtx_REG (TYPE_MODE (ret_type), FUNC_RETURN_REGNUM);
+ enum machine_mode mode = TYPE_MODE (ret_type);
+
+ /* RX ABI specifies that small integer types are
+ promoted to int when returned by a function. */
+ if (GET_MODE_SIZE (mode) > 0 && GET_MODE_SIZE (mode) < 4)
+ return gen_rtx_REG (SImode, FUNC_RETURN_REGNUM);
+
+ return gen_rtx_REG (mode, FUNC_RETURN_REGNUM);
+}
+
+/* TARGET_PROMOTE_FUNCTION_MODE must behave in the same way with
+ regard to function returns as does TARGET_FUNCTION_VALUE. */
+
+static enum machine_mode
+rx_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int * punsignedp,
+ const_tree funtype ATTRIBUTE_UNUSED,
+ int for_return)
+{
+ if (for_return != 1
+ || GET_MODE_SIZE (mode) >= 4
+ || GET_MODE_SIZE (mode) < 1)
+ return mode;
+
+ return SImode;
}
static bool
@@ -2825,6 +2850,9 @@ rx_memory_move_cost (enum machine_mode mode, enum reg_class regclass, bool in)
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE rx_option_override
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE rx_promote_function_mode
+
#undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE rx_override_options_after_change