Commit: RL78: Fix poping of registers in G10 mode
Nick Clifton
nickc@redhat.com
Fri Sep 19 07:47:00 GMT 2014
Hi Guys,
I am applying the patch below to fix a problem with the RL78's popping
of pushed registers in G10 mode. The problem was that the pop uses a
two instruction sequence and dead code elimination was deleting the
second instruction (the move of the popped value from register A to
the correct register) because the popped values were never used.
Cheers
Nick
gcc/ChangeLog
2014-09-19 Nick Clifton <nickc@redhat.com>
* config/rl78/rl78.c (rl78_expand_epilogue): Generate a USE of the
pop'ed registers so that DCE does not eliminate them.
Index: gcc/config/rl78/rl78.c
===================================================================
RCS file: /cvs/cvsfiles/gnupro/gcc/config/rl78/rl78.c,v
retrieving revision 1.7.4.2
diff -u -3 -p -r1.7.4.2 rl78.c
@@ -1219,10 +1219,19 @@ rl78_expand_epilogue (void)
for (i = 15; i >= 0; i--)
if (cfun->machine->need_to_push [i])
{
+ rtx dest = gen_rtx_REG (HImode, i * 2);
+
if (TARGET_G10)
{
- emit_insn (gen_pop (gen_rtx_REG (HImode, 0)));
- emit_move_insn (gen_rtx_REG (HImode, i*2), gen_rtx_REG (HImode, 0));
+ rtx ax = gen_rtx_REG (HImode, 0);
+
+ emit_insn (gen_pop (ax));
+ if (i != 0)
+ {
+ emit_move_insn (dest, ax);
+ /* Generate a USE of the pop'd register so that DCE will not eliminate the move. */
+ emit_insn (gen_use (dest));
+ }
}
else
{
@@ -1233,7 +1242,7 @@ rl78_expand_epilogue (void)
emit_insn (gen_sel_rb (GEN_INT (need_bank)));
rb = need_bank;
}
- emit_insn (gen_pop (gen_rtx_REG (HImode, i * 2)));
+ emit_insn (gen_pop (dest));
}
}
More information about the Gcc-patches
mailing list