From fc80ea735e067b91fb3e0c84cc07e9abfc57a52f Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Thu, 30 Sep 1999 07:00:53 +0000 Subject: [PATCH] h8300.c (WORD_REG_USED): Update to avoid useless register saves in interrupt functions and functions... * h8300.c (WORD_REG_USED): Update to avoid useless register saves in interrupt functions and functions which never return. From-SVN: r29724 --- gcc/ChangeLog | 3 +++ gcc/config/h8300/h8300.c | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 801b235..44b00e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -10,6 +10,9 @@ Thu Sep 30 00:13:27 1999 Dirk Zoller Wed Sep 29 23:43:39 1999 Jeffrey A Law (law@cygnus.com) + * h8300.c (WORD_REG_USED): Update to avoid useless register + saves in interrupt functions and functions which never return. + * cse.c (struct set): Delete inner_dest_loc field. (cse_insn): Remove assignments to inner_dest_loc field. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 8710e23..ede0839 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -124,11 +124,21 @@ byte_reg (x, b) /* REGNO must be saved/restored across calls if this macro is true. */ #define WORD_REG_USED(regno) \ - (regno < 7 && \ - (interrupt_handler \ - || pragma_saveall \ - || (regno == FRAME_POINTER_REGNUM && regs_ever_live[regno]) \ - || (regs_ever_live[regno] && !call_used_regs[regno]))) + (regno < 7 \ + /* No need to save registers if this function will not return.*/\ + && ! TREE_THIS_VOLATILE (current_function_decl) \ + && (pragma_saveall \ + /* Save any call saved register that was used. */ \ + || (regs_ever_live[regno] && !call_used_regs[regno]) \ + /* Save the frame pointer if it was used. */ \ + || (regno == FRAME_POINTER_REGNUM && regs_ever_live[regno])\ + /* Save any register used in an interrupt handler. */ \ + || (interrupt_handler && regs_ever_live[regno]) \ + /* Save call clobbered registers in non-leaf interrupt \ + handlers. */ \ + || (interrupt_handler \ + && call_used_regs[regno] \ + && !current_function_is_leaf))) /* Output assembly language to FILE for the operation OP with operand size SIZE to adjust the stack pointer. */ -- 2.7.4