[m68k] register renaming not properly tracking used registers
Peter Barada
peter@the-baradas.com
Thu Oct 21 11:28:00 GMT 2004
>> * 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) \
More information about the Gcc
mailing list