+2012-11-20 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx.c (rx_function_arg_boundary): When using the RX ABI
+ align stack arguments to their natural alignment.
+ (rx_narrow_volatile_bitfield): New function. Allows narrow
+ volatile bitfields.
+ (rx_ok_to_inline): New function. Do not inline functions with
+ local variables into a naked caller.
+ (TARGET_NARROW_VOLATILE_BITFIELD): Define.
+ (TARGET_CAN_INLINE_P): Define.
+ * config/rx/rx.c (TARGET_CPU_CPP_BUILTINS): Define __RX_ABI__ or
+ __RX_GC_ABI__.
+ (ASM_SPEC): Pass -mgcc-abi on to the assembler.
+ (STRICT_ALIGNMENT): Set to false.
+ (CTORS_SECTION_ASM_OP): Add executable attribute.
+ (DTORS_SECTION_ASM_OP): Add executable attribute.
+ (INIT_ARRAY_SECTION_ASM_OP): Add executable attribute.
+ (FINI_ARRAY_SECTION_ASM_OP): Add executable attribute.
+ * config/rx/rx.md (subdi3): Don't allow MEMs as the third operand,
+ as it causes too much reload pressure.
+ * config/rx/rx.opt (mgcc-abi): New option.
+ (mrx-abi): New option.
+ * config/rx/t-rx (MULTILIB_OPTIONS): Show how to add an ABI
+ multilib.
+ (MULTILIB_DIRNAMES): Likewise.
+
2012-11-20 James Greenhalgh <james.greenhalgh@arm.com>
Tejas Belagod <tejas.belagod@arm.com>
rx_function_arg_boundary (enum machine_mode mode ATTRIBUTE_UNUSED,
const_tree type ATTRIBUTE_UNUSED)
{
- return 32;
+ /* Older versions of the RX backend aligned all on-stack arguements
+ to 32-bits. The RX C ABI however says that they should be
+ aligned to their natural alignment. (See section 5.2.2 of the ABI). */
+ if (TARGET_GCC_ABI)
+ return STACK_BOUNDARY;
+
+ if (type)
+ {
+ if (DECL_P (type))
+ return DECL_ALIGN (type);
+ return TYPE_ALIGN (type);
+ }
+
+ return PARM_BOUNDARY;
}
/* Return an RTL describing where a function return value of type RET_TYPE
return (zero && factor == 1) ? 4 : 5;
}
+
+static bool
+rx_narrow_volatile_bitfield (void)
+{
+ return true;
+}
+
+static bool
+rx_ok_to_inline (tree caller, tree callee)
+{
+ /* Do not inline functions with local variables
+ into a naked CALLER - naked function have no stack frame and
+ locals need a frame in order to have somewhere to live.
+
+ Unfortunately we have no way to determine the presence of
+ local variables in CALLEE, so we have to be cautious and
+ assume that there might be some there.
+
+ We do allow inlining when CALLEE has the "inline" type
+ modifier or the "always_inline" or "gnu_inline" attributes. */
+ return lookup_attribute ("naked", DECL_ATTRIBUTES (caller)) == NULL_TREE
+ || DECL_DECLARED_INLINE_P (callee)
+ || lookup_attribute ("always_inline", DECL_ATTRIBUTES (callee)) != NULL_TREE
+ || lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (callee)) != NULL_TREE;
+}
+
\f
+#undef TARGET_NARROW_VOLATILE_BITFIELD
+#define TARGET_NARROW_VOLATILE_BITFIELD rx_narrow_volatile_bitfield
+
+#undef TARGET_CAN_INLINE_P
+#define TARGET_CAN_INLINE_P rx_ok_to_inline
+
#undef TARGET_ASM_JUMP_ALIGN_MAX_SKIP
#define TARGET_ASM_JUMP_ALIGN_MAX_SKIP rx_max_skip_for_label
#undef TARGET_ASM_LOOP_ALIGN_MAX_SKIP
#undef TARGET_LEGITIMIZE_ADDRESS
#define TARGET_LEGITIMIZE_ADDRESS rx_legitimize_address
-#undef TARGET_WARN_FUNC_RETURN
-#define TARGET_WARN_FUNC_RETURN rx_warn_func_return
+#undef TARGET_WARN_FUNC_RETURN
+#define TARGET_WARN_FUNC_RETURN rx_warn_func_return
struct gcc_target targetm = TARGET_INITIALIZER;
/* GCC backend definitions for the Renesas RX processor.
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by Red Hat.
This file is part of GCC.
builtin_define ("__RX_AS100_SYNTAX__"); \
else \
builtin_define ("__RX_GAS_SYNTAX__"); \
+ \
+ if (TARGET_GCC_ABI) \
+ builtin_define ("__RX_GCC_ABI__"); \
+ else \
+ builtin_define ("__RX_ABI__"); \
} \
while (0)
%{mrelax:-relax} \
%{mpid} \
%{mint-register=*} \
+%{mgcc-abi:-mgcc-abi} %{!mgcc-abi:-mrx-abi} \
"
#undef LIB_SPEC
#define DEFAULT_SIGNED_CHAR 0
-#define STRICT_ALIGNMENT 1
+/* RX load/store instructions can handle unaligned addresses. */
+#define STRICT_ALIGNMENT 0
#define FUNCTION_BOUNDARY 8
#define BIGGEST_ALIGNMENT 32
#define STACK_BOUNDARY 32
# else
# define TEXT_SECTION_ASM_OP "\t.section P,\"ax\""
# define CTORS_SECTION_ASM_OP \
- "\t.section\t.init_array,\"aw\",@init_array"
+ "\t.section\t.init_array,\"awx\",@init_array"
# define DTORS_SECTION_ASM_OP \
- "\t.section\t.fini_array,\"aw\",@fini_array"
+ "\t.section\t.fini_array,\"awx\",@fini_array"
# define INIT_ARRAY_SECTION_ASM_OP \
- "\t.section\t.init_array,\"aw\",@init_array"
+ "\t.section\t.init_array,\"awx\",@init_array"
# define FINI_ARRAY_SECTION_ASM_OP \
- "\t.section\t.fini_array,\"aw\",@fini_array"
+ "\t.section\t.fini_array,\"awx\",@fini_array"
# endif
#else
# define TEXT_SECTION_ASM_OP \
# define CTORS_SECTION_ASM_OP \
(TARGET_AS100_SYNTAX ? "\t.SECTION init_array,CODE" \
- : "\t.section\t.init_array,\"aw\",@init_array")
+ : "\t.section\t.init_array,\"awx\",@init_array")
# define DTORS_SECTION_ASM_OP \
(TARGET_AS100_SYNTAX ? "\t.SECTION fini_array,CODE" \
- : "\t.section\t.fini_array,\"aw\",@fini_array")
+ : "\t.section\t.fini_array,\"awx\",@fini_array")
# define INIT_ARRAY_SECTION_ASM_OP \
(TARGET_AS100_SYNTAX ? "\t.SECTION init_array,CODE" \
- : "\t.section\t.init_array,\"aw\",@init_array")
+ : "\t.section\t.init_array,\"awx\",@init_array")
# define FINI_ARRAY_SECTION_ASM_OP \
(TARGET_AS100_SYNTAX ? "\t.SECTION fini_array,CODE" \
- : "\t.section\t.fini_array,\"aw\",@fini_array")
+ : "\t.section\t.fini_array,\"awx\",@fini_array")
#endif
#define GLOBAL_ASM_OP \
(define_expand "subdi3"
[(set (match_operand:DI 0 "register_operand")
(minus:DI (match_operand:DI 1 "register_operand")
- (match_operand:DI 2 "rx_compare_operand")))]
+ (match_operand:DI 2 "register_operand")))]
""
{
rtx op0l, op0h, op1l, op1h, op2l, op2h;
; Command line options for the Renesas RX port of GCC.
-; Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+; Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
; Contributed by Red Hat.
;
; This file is part of GCC.
mwarn-multiple-fast-interrupts
Target Report Var(rx_warn_multiple_fast_interrupts) Init(1) Warning
Warn when multiple, different, fast interrupt handlers are in the compilation unit.
+
+mgcc-abi
+Target RejectNegative Report Mask(GCC_ABI)
+Enable the use of the old, broken, ABI where all stacked function arguments are aligned to 32-bits.
+
+mrx-abi
+Target RejectNegative Report InverseMask(GCC_ABI)
+Enable the use the standard RX ABI where all stacked function arguments are naturally aligned. This is the default.
MULTILIB_OPTIONS = m64bit-doubles nofpu mbig-endian-data mpid
MULTILIB_DIRNAMES = 64-bit-double no-fpu-libs big-endian-data pid
+# If necessary uncomment the next two lines to generate multilibs
+# using the old, broken, ABI.
+# MULTILIB_OPTIONS += mgcc-abi
+# MULTILIB_DIRNAMES += gcc-abi
+
MULTILIB_MATCHES = nofpu=mnofpu nofpu=mcpu?rx200
MULTILIB_EXCEPTIONS =