diff options
author | Nick Clifton <nickc@cygnus.com> | 2000-01-08 20:15:56 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2000-01-08 20:15:56 +0000 |
commit | 0e668396250723eb11d4b45d234afe1ac7a696c5 (patch) | |
tree | 9e38a7bfe0b5836a99682f9bb6919f71cabbbc0f | |
parent | 69d4f56db177ddbacc02c21a6b69735fa70f7c81 (diff) | |
download | gcc-0e668396250723eb11d4b45d234afe1ac7a696c5.zip gcc-0e668396250723eb11d4b45d234afe1ac7a696c5.tar.gz gcc-0e668396250723eb11d4b45d234afe1ac7a696c5.tar.bz2 |
Fix bug restoring stack from interrupt handler.
From-SVN: r31287
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/v850/v850.c | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f750369d..f61f6eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 8 12:12:46 2000 Nick Clifton <nickc@cygnus.com> + + * config/v850/v850.c (expand_epilogue): Interrupt functions no + longer allocate extra stack for function calls. + 2000-01-08 Michael Hayes <m.hayes@elec.canterbury.ac.nz> * config/c4x/c4x.md (*subqf3_set): Fix typo. diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 4e205a5..7acd9d9 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -1495,7 +1495,7 @@ expand_prologue () actual_fsize = compute_frame_size (size, ®_saved); - /* Save/setup global registers for interrupt functions right now */ + /* Save/setup global registers for interrupt functions right now. */ if (interrupt_handler) { emit_insn (gen_save_interrupt ()); @@ -1527,7 +1527,7 @@ expand_prologue () } } - /* Identify all of the saved registers */ + /* Identify all of the saved registers. */ num_save = 0; default_stack = 0; for (i = 1; i < 31; i++) @@ -1716,7 +1716,7 @@ expand_epilogue () if (frame_pointer_needed) emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx); - /* Identify all of the saved registers */ + /* Identify all of the saved registers. */ num_restore = 0; default_stack = 0; for (i = 1; i < 31; i++) @@ -1736,7 +1736,9 @@ expand_epilogue () /* See if we have an insn that restores the particular registers we want to. */ restore_all = NULL_RTX; - if (TARGET_PROLOG_FUNCTION && num_restore > 0 + + if (TARGET_PROLOG_FUNCTION + && num_restore > 0 && actual_fsize >= default_stack && !interrupt_handler) { @@ -1748,7 +1750,7 @@ expand_epilogue () if (unalloc_stack) restore_func_len += CONST_OK_FOR_J (unalloc_stack) ? 2 : 4; - /* see if we would have used ep to restore the registers */ + /* See if we would have used ep to restore the registers. */ if (TARGET_EP && num_restore > 3 && (unsigned)actual_fsize < 255) restore_normal_len = (3 * 2) + (2 * num_restore); else @@ -1781,6 +1783,7 @@ expand_epilogue () } code = recog (restore_all, NULL_RTX, NULL_PTR); + if (code >= 0) { rtx insn; @@ -1818,7 +1821,7 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n", } /* If no epilog save function is available, restore the registers the - old fashioned way (one by one). */ + old fashioned way (one by one). */ if (!restore_all) { /* If the stack is large, we need to cut it down in 2 pieces. */ @@ -1827,15 +1830,13 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n", else init_stack_free = actual_fsize; - /* Deallocate the rest of the stack if it is > 32K or if extra stack - was allocated for an interrupt handler that makes a call. */ - if (actual_fsize > init_stack_free - || (interrupt_handler && actual_fsize)) + /* Deallocate the rest of the stack if it is > 32K. */ + if (actual_fsize > init_stack_free) { int diff; diff = actual_fsize - ((interrupt_handler) ? 0 : init_stack_free); - + if (CONST_OK_FOR_K (diff)) emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, @@ -1858,7 +1859,7 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n", } else { - /* Restore registers from the beginning of the stack frame */ + /* Restore registers from the beginning of the stack frame. */ offset = init_stack_free - 4; /* Restore the return pointer first. */ @@ -1879,6 +1880,7 @@ Saved %d bytes via epilogue function (%d vs. %d) in function %s\n", plus_constant (stack_pointer_rtx, offset))); + emit_insn (gen_rtx_USE (VOIDmode, restore_regs[i])); offset -= 4; } |