aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-09-19 07:45:22 +0000
committerNick Clifton <nickc@gcc.gnu.org>2014-09-19 07:45:22 +0000
commit553130b0bad4cca01e95a3e920bfb494b1b530c0 (patch)
tree13451f100b24bde222166caa84565955bdd64b0c
parent9d8fc086d1482135169d992ca21b33efd651ba4f (diff)
downloadgcc-553130b0bad4cca01e95a3e920bfb494b1b530c0.zip
gcc-553130b0bad4cca01e95a3e920bfb494b1b530c0.tar.gz
gcc-553130b0bad4cca01e95a3e920bfb494b1b530c0.tar.bz2
rl78.c (rl78_expand_epilogue): Generate a USE of the pop'ed registers so that DCE does not eliminate them.
* config/rl78/rl78.c (rl78_expand_epilogue): Generate a USE of the pop'ed registers so that DCE does not eliminate them. From-SVN: r215375
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/rl78/rl78.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0330a13..82dd613 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2014-09-18 Jan Hubicka <hubicka@ucw.cz>
PR lto/63298
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 5fe1f6f..5c2a9c6 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -1136,10 +1136,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
{
@@ -1150,7 +1159,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));
}
}