Return-Path: <gcc-patches-return-131492-bernie=develer.com@gcc.gnu.org>
Delivered-To: bernie@develer.com
Received: (qmail 26178 invoked from network); 21 Oct 2004 05:49:32 -0000
Received: from sourceware.org (12.107.209.250)
  by ns1.codewiz.org with SMTP; 21 Oct 2004 05:49:32 -0000
Received: (qmail 3185 invoked by alias); 21 Oct 2004 05:49:19 -0000
Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:gcc-patches-unsubscribe-bernie=develer.com@gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
List-Post: <mailto:gcc-patches@gcc.gnu.org>
List-Help: <mailto:gcc-patches-help@gcc.gnu.org>
Sender: gcc-patches-owner@gcc.gnu.org
Delivered-To: mailing list gcc-patches@gcc.gnu.org
Received: (qmail 3061 invoked from network); 21 Oct 2004 05:49:16 -0000
Received: from unknown (HELO baradas.org) (66.166.225.55)
  by sourceware.org with SMTP; 21 Oct 2004 05:49:16 -0000
Received: by baradas.org (Postfix, from userid 500)
	id 57BBD990F2; Thu, 21 Oct 2004 01:49:16 -0400 (EDT)
From: Peter Barada <peter@the-baradas.com>
To: rth@redhat.com
Cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org, peter@the-baradas.com
In-reply-to: <20041021005141.GA24957@redhat.com> (message from Richard
	Henderson on Wed, 20 Oct 2004 17:51:41 -0700)
Subject: Re: [m68k] register renaming not properly tracking used registers
References: <20041017203226.74E61990F2@baradas.org> <20041018165942.GA31795@redhat.com> <20041021004318.74B17990F2@baradas.org> <20041021005141.GA24957@redhat.com>
Message-Id: <20041021054916.57BBD990F2@baradas.org>
Date: Thu, 21 Oct 2004 01:49:16 -0400 (EDT)


>> 	* config/m68k/m68k.h (HARD_REGNO_RENAME_OK): New macro.
>> 	* config/m68k/m68k.c (m68k_hard regno_rename_ok): Disallow
>> 	  renaming of non-live registers in interrupt functions.
>> 	* config/m68k/m68k-protos.h (m68k_hard_regno_rename_ok): Add prototype.
>
>Ok.
>
>> + {
>> + 
>> + /* Interrupt functions can only use registers that have already been
>> +    saved by the prologue, even if they would normally be
>> +    call-clobbered.  */
>> + 
>> +   if (m68k_interrupt_function_p(current_function_decl)
>> +       && !regs_ever_live[new_reg])
>> +      return 0;
>> + 
>> +    return 1;
>> + }
>
>Watch the formatting.

Here it is again with what I hope is correct formatting:

gcc/ChangeLog:
2004-09-103  Peter Barada <peter@the-baradas.com>
	* config/m68k/m68k.h (HARD_REGNO_RENAME_OK): New macro.
	* config/m68k/m68k.c (m68k_hard regno_rename_ok): Disallow
	  renaming of non-live registers in interrupt functions.
	* config/m68k/m68k-protos.h (m68k_hard_regno_rename_ok): Add prototype.

Index: m68k-protos.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/m68k/m68k-protos.h,v
retrieving revision 1.16
diff -c -3 -p -r1.16 m68k-protos.h
*** m68k-protos.h	24 Jul 2004 11:12:29 -0000	1.16
--- m68k-protos.h	21 Oct 2004 05:48:03 -0000
*************** extern void print_operand_address (FILE 
*** 50,58 ****
--- 50,60 ----
  extern void print_operand (FILE *, rtx, int);
  extern void notice_update_cc (rtx, rtx);
  extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
+ 
  #endif /* RTX_CODE */
  
  extern int flags_in_68881 (void);
  extern bool use_return_insn (void);
  extern void override_options (void);
  extern void init_68881_table (void);
+ extern int m68k_hard_regno_rename_ok(unsigned int, unsigned int);
Index: m68k.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/m68k/m68k.c,v
retrieving revision 1.141
diff -c -3 -p -r1.141 m68k.c
*** m68k.c	18 Sep 2004 19:19:36 -0000	1.141
--- m68k.c	21 Oct 2004 05:48:04 -0000
*************** m68k_struct_value_rtx (tree fntype ATTRI
*** 3428,3430 ****
--- 3428,3447 ----
  {
    return gen_rtx_REG (Pmode, M68K_STRUCT_VALUE_REGNUM);
  }
+ 
+ /* Return nonzero if register old_reg can be renamed to register new_reg.  */
+ int
+ m68k_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
+ 			   unsigned int new_reg)
+ {
+ 
+   /* Interrupt functions can only use registers that have already been
+      saved by the prologue, even if they would normally be
+      call-clobbered.  */
+ 
+   if (m68k_interrupt_function_p (current_function_decl)
+       && !regs_ever_live[new_reg])
+     return 0;
+ 
+   return 1;
+ }
Index: m68k.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/m68k/m68k.h,v
retrieving revision 1.120
diff -c -3 -p -r1.120 m68k.h
*** m68k.h	6 Aug 2004 07:14:56 -0000	1.120
--- m68k.h	21 Oct 2004 05:48:04 -0000
*************** extern int target_flags;
*** 480,485 ****
--- 480,491 ----
    ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE)	\
     : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  
+ /* A C expression that is nonzero if hard register NEW_REG can be
+    considered for use as a rename register for OLD_REG register.  */
+ 
+ #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
+   m68k_hard_regno_rename_ok (OLD_REG, NEW_REG)
+ 
  /* On the m68k, the cpu registers can hold any mode but the 68881 registers
     can hold only SFmode or DFmode.  */
  #define HARD_REGNO_MODE_OK(REGNO, MODE) \
