OSDN Git Service

PR middle-end/32398
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Jul 2007 17:19:13 +0000 (17:19 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 15 Jul 2007 17:19:13 +0000 (17:19 +0000)
PR middle-end/32769
* pa-protos.h (pa_eh_return_handler_rtx): Declare.
* pa.c (pa_extra_live_on_entry, rp_saved): Declare.
(TARGET_EXTRA_LIVE_ON_ENTRY): Define.
(pa_output_function_prologue): Use rp_saved and current_function_is_leaf
to generate .CALLINFO statement.
(hppa_expand_prologue): Set rp_saved.
(hppa_expand_epilogue): Use rp_saved.
(pa_extra_live_on_entry, pa_eh_return_handler_rtx): New functions.
* pa.h (EH_RETURN_HANDLER_RTX): Use pa_eh_return_handler_rtx.

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

gcc/ChangeLog
gcc/config/pa/pa-protos.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h

index 4903b79..7ca3bbf 100644 (file)
@@ -1,3 +1,17 @@
+2007-07-15  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR middle-end/32398
+       PR middle-end/32769
+       * pa-protos.h (pa_eh_return_handler_rtx): Declare.
+       * pa.c (pa_extra_live_on_entry, rp_saved): Declare.
+       (TARGET_EXTRA_LIVE_ON_ENTRY): Define.
+       (pa_output_function_prologue): Use rp_saved and current_function_is_leaf
+       to generate .CALLINFO statement.
+       (hppa_expand_prologue): Set rp_saved.
+       (hppa_expand_epilogue): Use rp_saved.
+       (pa_extra_live_on_entry, pa_eh_return_handler_rtx): New functions.
+       * pa.h (EH_RETURN_HANDLER_RTX): Use pa_eh_return_handler_rtx.
+
 2007-07-14  Dirk Mueller  <dmueller@suse.de>
 
        * omega.c (coalesce): Fix memory leak on early exit.
 2007-07-14  Dirk Mueller  <dmueller@suse.de>
 
        * omega.c (coalesce): Fix memory leak on early exit.
index 51b7ecb..111a4c0 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02110-1301, USA.  */
 /* Prototype function used in various macros.  */
 extern int symbolic_operand (rtx, enum machine_mode);
 extern int tls_symbolic_operand (rtx);
 /* Prototype function used in various macros.  */
 extern int symbolic_operand (rtx, enum machine_mode);
 extern int tls_symbolic_operand (rtx);
+extern rtx pa_eh_return_handler_rtx (void);
 
 /* Used in insn-*.c.  */
 extern int following_call (rtx);
 
 /* Used in insn-*.c.  */
 extern int following_call (rtx);
index 4948174..63437b7 100644 (file)
@@ -156,7 +156,7 @@ static struct machine_function * pa_init_machine_status (void);
 static enum reg_class pa_secondary_reload (bool, rtx, enum reg_class,
                                           enum machine_mode,
                                           secondary_reload_info *);
 static enum reg_class pa_secondary_reload (bool, rtx, enum reg_class,
                                           enum machine_mode,
                                           secondary_reload_info *);
-
+static void pa_extra_live_on_entry (bitmap);
 
 /* The following extra sections are only used for SOM.  */
 static GTY(()) section *som_readonly_data_section;
 
 /* The following extra sections are only used for SOM.  */
 static GTY(()) section *som_readonly_data_section;
@@ -178,6 +178,10 @@ int flag_pa_unix = TARGET_HPUX_11_11 ? 1998 : TARGET_HPUX_10_10 ? 1995 : 1993;
    registers which were saved by the current function's prologue.  */
 static int gr_saved, fr_saved;
 
    registers which were saved by the current function's prologue.  */
 static int gr_saved, fr_saved;
 
+/* Boolean indicating whether the return pointer was saved by the
+   current function's prologue.  */
+static bool rp_saved;
+
 static rtx find_addr_reg (rtx);
 
 /* Keep track of the number of bytes we have output in the CODE subspace
 static rtx find_addr_reg (rtx);
 
 /* Keep track of the number of bytes we have output in the CODE subspace
@@ -313,6 +317,9 @@ static size_t n_deferred_plabels = 0;
 #undef TARGET_SECONDARY_RELOAD
 #define TARGET_SECONDARY_RELOAD pa_secondary_reload
 
 #undef TARGET_SECONDARY_RELOAD
 #define TARGET_SECONDARY_RELOAD pa_secondary_reload
 
+#undef TARGET_EXTRA_LIVE_ON_ENTRY
+#define TARGET_EXTRA_LIVE_ON_ENTRY pa_extra_live_on_entry
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Parse the -mfixed-range= option string.  */
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Parse the -mfixed-range= option string.  */
@@ -3563,10 +3570,12 @@ pa_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
      to output the assembler directives which denote the start
      of a function.  */
   fprintf (file, "\t.CALLINFO FRAME=" HOST_WIDE_INT_PRINT_DEC, actual_fsize);
      to output the assembler directives which denote the start
      of a function.  */
   fprintf (file, "\t.CALLINFO FRAME=" HOST_WIDE_INT_PRINT_DEC, actual_fsize);
-  if (df_regs_ever_live_p (2))
-    fputs (",CALLS,SAVE_RP", file);
-  else
+  if (current_function_is_leaf)
     fputs (",NO_CALLS", file);
     fputs (",NO_CALLS", file);
+  else
+    fputs (",CALLS", file);
+  if (rp_saved)
+    fputs (",SAVE_RP", file);
 
   /* The SAVE_SP flag is used to indicate that register %r3 is stored
      at the beginning of the frame and that it is used as the frame
 
   /* The SAVE_SP flag is used to indicate that register %r3 is stored
      at the beginning of the frame and that it is used as the frame
@@ -3628,7 +3637,12 @@ hppa_expand_prologue (void)
      always be stored into the caller's frame at sp - 20 or sp - 16
      depending on which ABI is in use.  */
   if (df_regs_ever_live_p (2) || current_function_calls_eh_return)
      always be stored into the caller's frame at sp - 20 or sp - 16
      depending on which ABI is in use.  */
   if (df_regs_ever_live_p (2) || current_function_calls_eh_return)
-    store_reg (2, TARGET_64BIT ? -16 : -20, STACK_POINTER_REGNUM);
+    {
+      store_reg (2, TARGET_64BIT ? -16 : -20, STACK_POINTER_REGNUM);
+      rp_saved = true;
+    }
+  else
+    rp_saved = false;
 
   /* Allocate the local frame and set up the frame pointer if needed.  */
   if (actual_fsize != 0)
 
   /* Allocate the local frame and set up the frame pointer if needed.  */
   if (actual_fsize != 0)
@@ -4030,7 +4044,7 @@ hppa_expand_epilogue (void)
   /* Try to restore RP early to avoid load/use interlocks when
      RP gets used in the return (bv) instruction.  This appears to still
      be necessary even when we schedule the prologue and epilogue.  */
   /* Try to restore RP early to avoid load/use interlocks when
      RP gets used in the return (bv) instruction.  This appears to still
      be necessary even when we schedule the prologue and epilogue.  */
-  if (df_regs_ever_live_p (2) || current_function_calls_eh_return)
+  if (rp_saved)
     {
       ret_off = TARGET_64BIT ? -16 : -20;
       if (frame_pointer_needed)
     {
       ret_off = TARGET_64BIT ? -16 : -20;
       if (frame_pointer_needed)
@@ -5734,6 +5748,33 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
   return NO_REGS;
 }
 
   return NO_REGS;
 }
 
+/* Implement TARGET_EXTRA_LIVE_ON_ENTRY.  The argument pointer
+   is only marked as live on entry by df-scan when it is a fixed
+   register.  It isn't a fixed register in the 64-bit runtime,
+   so we need to mark it here.  */
+
+static void
+pa_extra_live_on_entry (bitmap regs)
+{
+  if (TARGET_64BIT)
+    bitmap_set_bit (regs, ARG_POINTER_REGNUM);
+}
+
+/* Implement EH_RETURN_HANDLER_RTX.  The MEM needs to be volatile
+   to prevent it from being deleted.  */
+
+rtx
+pa_eh_return_handler_rtx (void)
+{
+  rtx tmp;
+
+  tmp = gen_rtx_PLUS (word_mode, frame_pointer_rtx,
+                     TARGET_64BIT ? GEN_INT (-16) : GEN_INT (-20));
+  tmp = gen_rtx_MEM (word_mode, tmp);
+  tmp->volatil = 1;
+  return tmp;
+}
+
 /* In the 32-bit runtime, arguments larger than eight bytes are passed
    by invisible reference.  As a GCC extension, we also pass anything
    with a zero or variable size by reference.
 /* In the 32-bit runtime, arguments larger than eight bytes are passed
    by invisible reference.  As a GCC extension, we also pass anything
    with a zero or variable size by reference.
index b95dd8a..1ae199a 100644 (file)
@@ -410,10 +410,7 @@ extern struct rtx_def *hppa_pic_save_rtx (void);
 #define EH_RETURN_DATA_REGNO(N)        \
   ((N) < 3 ? (N) + 20 : (N) == 3 ? 31 : INVALID_REGNUM)
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 29)
 #define EH_RETURN_DATA_REGNO(N)        \
   ((N) < 3 ? (N) + 20 : (N) == 3 ? 31 : INVALID_REGNUM)
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 29)
-#define EH_RETURN_HANDLER_RTX \
-  gen_rtx_MEM (word_mode,                                              \
-              gen_rtx_PLUS (word_mode, frame_pointer_rtx,              \
-                            TARGET_64BIT ? GEN_INT (-16) : GEN_INT (-20)))
+#define EH_RETURN_HANDLER_RTX pa_eh_return_handler_rtx ()
 
 /* Offset from the frame pointer register value to the top of stack.  */
 #define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
 
 /* Offset from the frame pointer register value to the top of stack.  */
 #define FRAME_POINTER_CFA_OFFSET(FNDECL) 0