OSDN Git Service

* config/rx/rx.c (rx_can_use_simple_return): New function.
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jan 2012 15:41:50 +0000 (15:41 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Jan 2012 15:41:50 +0000 (15:41 +0000)
        * config/rx/rx-protos.h (rx_can_use_simple_return): Prototype.
        * config/rx/rx.md (return): Predicate on rx_can_use_simple_return.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183252 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rx/rx-protos.h
gcc/config/rx/rx.c
gcc/config/rx/rx.md

index 055cc2e..ceba9c2 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2012-01-17  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/51782
 2012-01-17  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/51782
index 365bf66..f0352a8 100644 (file)
@@ -1,5 +1,6 @@
 /* Exported function prototypes from the Renesas RX backend.
 /* Exported function prototypes from the Renesas RX backend.
-   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.
    Contributed by Red Hat.
 
    This file is part of GCC.
@@ -21,6 +22,8 @@
 #ifndef GCC_RX_PROTOS_H
 #define GCC_RX_PROTOS_H
 
 #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);
 
 extern void            rx_expand_prologue (void);
 extern int             rx_initial_elimination_offset (int, int);
 
@@ -29,7 +32,6 @@ extern int            rx_adjust_insn_length (rtx, int);
 extern int             rx_align_for_label (rtx, int);
 extern void             rx_emit_stack_popm (rtx *, bool);
 extern void             rx_emit_stack_pushm (rtx *);
 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,
 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 4a73285..655f318 100644 (file)
@@ -1,5 +1,6 @@
 /* Subroutines used for code generation on Renesas RX processors.
 /* Subroutines used for code generation on Renesas RX processors.
-   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.
    Contributed by Red Hat.
 
    This file is part of GCC.
@@ -1818,7 +1819,31 @@ gen_rx_popm_vector (unsigned int low, unsigned int high)
 
   return vector;
 }
 
   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)
 {
 void
 rx_expand_epilogue (bool is_sibcall)
 {
index 92768c6..1ba603f 100644 (file)
@@ -1,5 +1,6 @@
 ;;  Machine Description for Renesas RX processors
 ;;  Machine Description for Renesas RX processors
-;;  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.
 ;;  Contributed by Red Hat.
 
 ;; This file is part of GCC.
 
 (define_expand "return"
   [(return)]
 
 (define_expand "return"
   [(return)]
-  ""
+  "rx_can_use_simple_return ()"
   "rx_expand_epilogue (false); DONE;"
 )
 
   "rx_expand_epilogue (false); DONE;"
 )