aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2009-07-02 01:18:42 +0000
committerAnthony Green <green@gcc.gnu.org>2009-07-02 01:18:42 +0000
commit9df748c0ca2682d3aee12c1819d5981fc5176c83 (patch)
treed81d23335fb74f88ae451168cbb38a8234ab7fb3 /gcc/config
parentb0f0c817838b52f1c5a769d6a6b38be9669e7988 (diff)
downloadgcc-9df748c0ca2682d3aee12c1819d5981fc5176c83.zip
gcc-9df748c0ca2682d3aee12c1819d5981fc5176c83.tar.gz
gcc-9df748c0ca2682d3aee12c1819d5981fc5176c83.tar.bz2
Tweak moxie prologue and epilogue code.
From-SVN: r149163
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/moxie/moxie.c58
-rw-r--r--gcc/config/moxie/moxie.md6
2 files changed, 37 insertions, 27 deletions
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 0ed8ad1..897717b 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -273,14 +273,25 @@ moxie_expand_prologue (void)
if (cfun->machine->size_for_adjusting_sp > 0)
{
- insn =
- emit_insn (gen_movsi (gen_rtx_REG (Pmode, MOXIE_R12),
- GEN_INT (-cfun->machine->size_for_adjusting_sp)));
- RTX_FRAME_RELATED_P (insn) = 1;
- insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx,
- gen_rtx_REG (Pmode, MOXIE_R12)));
- RTX_FRAME_RELATED_P (insn) = 1;
+ if (cfun->machine->size_for_adjusting_sp <= 255)
+ {
+ insn = emit_insn (gen_subsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT (cfun->machine->size_for_adjusting_sp)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+ else
+ {
+ insn =
+ emit_insn (gen_movsi
+ (gen_rtx_REG (Pmode, MOXIE_R12),
+ GEN_INT (-cfun->machine->size_for_adjusting_sp)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ gen_rtx_REG (Pmode, MOXIE_R12)));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
}
}
@@ -293,26 +304,25 @@ moxie_expand_epilogue (void)
if (cfun->machine->callee_saved_reg_size != 0)
{
reg = gen_rtx_REG (Pmode, MOXIE_R12);
- emit_move_insn (reg,
- GEN_INT (-cfun->machine->callee_saved_reg_size));
- emit_insn (gen_addsi3 (reg, reg, hard_frame_pointer_rtx));
- insn = emit_move_insn (stack_pointer_rtx, reg);
- RTX_FRAME_RELATED_P (insn) = 1;
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (stack_pointer_rtx,
- cfun->machine->callee_saved_reg_size));
+ if (cfun->machine->callee_saved_reg_size <= 255)
+ {
+ emit_move_insn (reg, hard_frame_pointer_rtx);
+ emit_insn (gen_subsi3
+ (reg, reg,
+ GEN_INT (cfun->machine->callee_saved_reg_size)));
+ }
+ else
+ {
+ emit_move_insn (reg,
+ GEN_INT (-cfun->machine->callee_saved_reg_size));
+ emit_insn (gen_addsi3 (reg, reg, hard_frame_pointer_rtx));
+ }
for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; )
if (!fixed_regs[regno] && !call_used_regs[regno]
&& df_regs_ever_live_p (regno))
{
- reg = gen_rtx_REG (Pmode, regno);
- insn = emit_insn (gen_movsi_pop (reg));
- RTX_FRAME_RELATED_P (insn) = 1;
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
- gen_rtx_SET (VOIDmode, stack_pointer_rtx,
- plus_constant (stack_pointer_rtx,
- UNITS_PER_WORD)));
- add_reg_note (insn, REG_CFA_RESTORE, reg);
+ rtx preg = gen_rtx_REG (Pmode, regno);
+ insn = emit_insn (gen_movsi_pop (reg, preg));
}
}
diff --git a/gcc/config/moxie/moxie.md b/gcc/config/moxie/moxie.md
index 7f3729f..02072f4 100644
--- a/gcc/config/moxie/moxie.md
+++ b/gcc/config/moxie/moxie.md
@@ -195,10 +195,10 @@
;; Pop a register from the stack
(define_insn "movsi_pop"
- [(set:SI (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (post_inc:SI (reg:SI 1))))]
+ [(set:SI (match_operand:SI 1 "register_operand" "=r")
+ (mem:SI (post_inc:SI (match_operand:SI 0 "register_operand" "r"))))]
""
- "pop $sp, %0")
+ "pop %0, %1")
(define_expand "movsi"
[(set (match_operand:SI 0 "general_operand" "")