* Commit: RX: Predicate return pattern
@ 2012-01-17 15:40 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2012-01-17 15:40 UTC (permalink / raw)
To: gcc-patches
Hi Guys,
As pointed out by Richard Henderson the new return pattern in the RX
backend should only be used when it is possible to return with just a
simple RTS instruction, so I am checking in the patch below to
implement this.
Cheers
Nick
gcc/ChangeLog
2012-01-17 Nick Clifton <nickc@redhat.com>
* config/rx/rx.c (rx_can_use_simple_return): New function.
* config/rx/rx-protos.h (rx_can_use_simple_return): Prototype.
* config/rx/rx.md (return): Predicate on rx_can_use_simple_return.
Index: gcc/config/rx/rx-protos.h
===================================================================
--- gcc/config/rx/rx-protos.h (revision 183234)
+++ gcc/config/rx/rx-protos.h (working copy)
@@ -21,6 +22,8 @@
#ifndef GCC_RX_PROTOS_H
#define GCC_RX_PROTOS_H
+extern bool rx_can_use_simple_return (void);
+extern void rx_expand_epilogue (bool);
extern void rx_expand_prologue (void);
extern int rx_initial_elimination_offset (int, int);
@@ -29,7 +32,6 @@
extern int rx_align_for_label (rtx, int);
extern void rx_emit_stack_popm (rtx *, bool);
extern void rx_emit_stack_pushm (rtx *);
-extern void rx_expand_epilogue (bool);
extern char * rx_gen_move_template (rtx *, bool);
extern bool rx_is_legitimate_constant (enum machine_mode, rtx);
extern bool rx_is_restricted_memory_address (rtx,
Index: gcc/config/rx/rx.md
===================================================================
--- gcc/config/rx/rx.md (revision 183234)
+++ gcc/config/rx/rx.md (working copy)
@@ -342,7 +343,7 @@
(define_expand "return"
[(return)]
- ""
+ "rx_can_use_simple_return ()"
"rx_expand_epilogue (false); DONE;"
)
Index: gcc/config/rx/rx.c
===================================================================
--- gcc/config/rx/rx.c (revision 183234)
+++ gcc/config/rx/rx.c (working copy)
@@ -1818,7 +1819,31 @@
return vector;
}
-
+
+/* Returns true if a simple return insn can be used. */
+
+bool
+rx_can_use_simple_return (void)
+{
+ unsigned int low;
+ unsigned int high;
+ unsigned int frame_size;
+ unsigned int stack_size;
+ unsigned int register_mask;
+
+ if (is_naked_func (NULL_TREE)
+ || is_fast_interrupt_func (NULL_TREE)
+ || is_interrupt_func (NULL_TREE))
+ return false;
+
+ rx_get_stack_layout (& low, & high, & register_mask,
+ & frame_size, & stack_size);
+
+ return (register_mask == 0
+ && (frame_size + stack_size) == 0
+ && low == 0);
+}
+
void
rx_expand_epilogue (bool is_sibcall)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-01-17 15:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17 15:40 Commit: RX: Predicate return pattern Nick Clifton
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).