This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: RL78: Always select register bank 0 at the start of an ISR
- From: Nick Clifton <nickc at redhat dot com>
- To: dj at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 03 Jan 2013 12:45:15 +0000
- Subject: RFA: RL78: Always select register bank 0 at the start of an ISR
Hi DJ,
Since interrupts can happen at any time, it is possible for a ISR to
be called when register bank 0 is not the currently selected bank.
Hence the prologue for an interrupt handler should always select bank
0 before saving any registers. The patch below makes sure that this
happens.
No regressions with a rl78-elf toolchain.
OK to apply ?
Cheers
Nick
gcc/ChangeLog
2013-01-03 Nick Clifton <nickc@redhat.com>
* config/rl78/rl78.c (rl78_expand_prologue): Always select
register bank 0 at the start of an interrupt handler.
Index: gcc/config/rl78/rl78.c
===================================================================
--- gcc/config/rl78/rl78.c (revision 194833)
+++ gcc/config/rl78/rl78.c (working copy)
@@ -839,6 +839,9 @@
if (flag_stack_usage_info)
current_function_static_stack_size = cfun->machine->framesize;
+ if (is_interrupt_func (cfun->decl))
+ emit_insn (gen_sel_rb (GEN_INT (0)));
+
for (i = 0; i < 16; i++)
if (cfun->machine->need_to_push [i])
{