+2015-08-18 Robert Suchanek <robert.suchanek@imgtec.com>
+
+ * config/mips/mips-protos.h (mips_hard_regno_rename_ok): New prototype.
+ * config/mips/mips.c (mips_hard_regno_rename_ok): New function.
+ (mips_hard_regno_scratch_ok): Likewise.
+ (TARGET_HARD_REGNO_SCRATCH_OK): Define macro.
+ * config/mips/mips.h (HARD_REGNO_RENAME_OK): New.
+
2015-08-18 Bin Cheng <bin.cheng@arm.com>
* tree-ssa-loop-niter.c (refine_value_range_using_guard): New.
extern unsigned int mips_sync_loop_insns (rtx_insn *, rtx *);
extern const char *mips_output_division (const char *, rtx *);
extern const char *mips_output_probe_stack_range (rtx, rtx);
+extern bool mips_hard_regno_rename_ok (unsigned int, unsigned int);
extern unsigned int mips_hard_regno_nregs (int, machine_mode);
extern bool mips_linked_madd_p (rtx_insn *, rtx_insn *);
extern bool mips_store_data_bypass_p (rtx_insn *, rtx_insn *);
return false;
}
+/* Return nonzero if register OLD_REG can be renamed to register NEW_REG. */
+
+bool
+mips_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 (cfun->machine->interrupt_handler_p && !df_regs_ever_live_p (new_reg))
+ return false;
+
+ return true;
+}
+
+/* Return nonzero if register REGNO can be used as a scratch register
+ in peephole2. */
+
+bool
+mips_hard_regno_scratch_ok (unsigned int regno)
+{
+ /* See mips_hard_regno_rename_ok. */
+ if (cfun->machine->interrupt_handler_p && !df_regs_ever_live_p (regno))
+ return false;
+
+ return true;
+}
+
/* Implement HARD_REGNO_NREGS. */
unsigned int
#undef TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
#define TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS mips_ira_change_pseudo_allocno_class
+#undef TARGET_HARD_REGNO_SCRATCH_OK
+#define TARGET_HARD_REGNO_SCRATCH_OK mips_hard_regno_scratch_ok
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
#include "gt-mips.h"
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ]
+#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
+ mips_hard_regno_rename_ok (OLD_REG, NEW_REG)
+
/* Select a register mode required for caller save of hard regno REGNO. */
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
mips_hard_regno_caller_save_mode (REGNO, NREGS, MODE)
+2015-08-18 Robert Suchanek <robert.suchanek@imgtec.com>
+
+ * gcc.target/mips/interrupt_handler-bug-1.c: New test.
+
2015-08-18 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/tree-ssa/loop-bound-1.c: New test.
--- /dev/null
+/* { dg-options "-funroll-loops" } */
+int foo;
+int bar;
+
+void __attribute__ ((interrupt))
+isr (void)
+{
+ if (!foo)
+ while (bar & 0xFF30);
+}
+/* { dg-final { scan-assembler-not "^isr:.*\\\$8.*isr" } } */