aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-02-17 17:12:15 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-02-17 17:12:15 +0000
commit72b1de442d8ab221371ebaca87fbb0a9f13deb48 (patch)
tree3885069e6c57f74ff5238a7da922668907b5a753 /gcc/config
parentd150ccef5103a6460ba9e9f425450d7f40f60e9c (diff)
downloadgcc-72b1de442d8ab221371ebaca87fbb0a9f13deb48.zip
gcc-72b1de442d8ab221371ebaca87fbb0a9f13deb48.tar.gz
gcc-72b1de442d8ab221371ebaca87fbb0a9f13deb48.tar.bz2
h8300.c (h8300_emit_stack_adjustment): Don't generate insns by hand.
* config/h8300/h8300.c (h8300_emit_stack_adjustment): Don't generate insns by hand. From-SVN: r77954
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/h8300/h8300.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index ee735be..eedc1fb 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -370,6 +370,10 @@ byte_reg (rtx x, int b)
static void
h8300_emit_stack_adjustment (int sign, unsigned int size)
{
+ /* If the frame size is 0, we don't have anything to do. */
+ if (size == 0)
+ return 0;
+
/* H8/300 cannot add/subtract a large constant with a single
instruction. If a temporary register is available, load the
constant to it and then do the addition. */
@@ -378,11 +382,10 @@ h8300_emit_stack_adjustment (int sign, unsigned int size)
&& !h8300_current_function_interrupt_function_p ()
&& !(current_function_needs_context && sign < 0))
{
- rtx new_sp;
rtx r3 = gen_rtx_REG (Pmode, 3);
- emit_insn (gen_rtx_SET (Pmode, r3, GEN_INT (sign * size)));
- new_sp = gen_rtx_PLUS (Pmode, stack_pointer_rtx, r3);
- emit_insn (gen_rtx_SET (Pmode, stack_pointer_rtx, new_sp));
+ emit_insn (gen_movhi (r3, GEN_INT (sign * size)));
+ emit_insn (gen_addhi3 (stack_pointer_rtx,
+ stack_pointer_rtx, r3));
}
else
{
@@ -390,8 +393,12 @@ h8300_emit_stack_adjustment (int sign, unsigned int size)
splitter. In case of H8/300, the splitter always splits the
addition emitted here to make the adjustment
interrupt-safe. */
- rtx new_sp = plus_constant (stack_pointer_rtx, sign * size);
- emit_insn (gen_rtx_SET (Pmode, stack_pointer_rtx, new_sp));
+ if (Pmode == HImode)
+ emit_insn (gen_addhi3 (stack_pointer_rtx,
+ stack_pointer_rtx, GEN_INT (sign * size)));
+ else
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx, GEN_INT (sign * size)));
}
}