diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87181f2fa8b..36c51fec261 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-03-16 Stephane Carrez + + * config/m68hc11/m68hc11.c (m68hc11_override_options): Don't use + soft registers by default for 68HC12. + (m68hc11_conditional_register_usage): Don't use Z register for 68HC12 + when compiling with -fomit-frame-pointer. + (expand_prologue): Use push/pop to allocate 4-bytes of locals on 68HC12. + (expand_epilogue): Likewise. + (m68hc11_gen_rotate): Use exg when rotating by 8. + 2002-03-16 Stephane Carrez * config/m68hc11/m68hc11-protos.h (ix_reg): Declare. diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 041b596e282..4927825fa61 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -246,6 +246,8 @@ m68hc11_override_options () if (TARGET_DEFAULT != MASK_M6811) target_flags &= ~TARGET_DEFAULT; + if (!TARGET_M6812) + target_flags &= ~TARGET_AUTO_INC_DEC; m68hc11_cost = &m6811_cost; m68hc11_min_offset = 0; m68hc11_max_offset = 256; @@ -278,7 +280,7 @@ m68hc11_override_options () target_flags &= ~MASK_M6811; target_flags |= MASK_NO_DIRECT_MODE; if (m68hc11_soft_reg_count == 0) - m68hc11_soft_reg_count = "2"; + m68hc11_soft_reg_count = "0"; } return 0; } @@ -301,6 +303,14 @@ m68hc11_conditional_register_usage () fixed_regs[i] = 1; call_used_regs[i] = 1; } + + /* For 68HC12, the Z register emulation is not necessary when the + frame pointer is not used. The frame pointer is eliminated and + replaced by the stack register (which is a BASE_REG_CLASS). */ + if (TARGET_M6812 && flag_omit_frame_pointer && optimize) + { + fixed_regs[HARD_Z_REGNUM] = 1; + } } @@ -1664,7 +1674,7 @@ expand_prologue () emit_move_after_reload (stack_push_word, hard_frame_pointer_rtx, scratch); /* Allocate local variables. */ - if (TARGET_M6812 && size >= 2) + if (TARGET_M6812 && (size > 4 || size == 3)) { emit_insn (gen_addhi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-size))); @@ -1752,7 +1762,7 @@ expand_epilogue () } /* de-allocate auto variables */ - if (TARGET_M6812 && size >= 2) + if (TARGET_M6812 && (size > 4 || size == 3)) { emit_insn (gen_addhi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (size))); @@ -3716,9 +3726,14 @@ m68hc11_gen_rotate (code, insn, operands) /* Rotate by 8-bits if the shift is within [5..11]. */ if (val >= 5 && val <= 11) { - output_asm_insn ("psha", operands); - output_asm_insn ("tba", operands); - output_asm_insn ("pulb", operands); + if (TARGET_M6812) + output_asm_insn ("exg\ta,b", operands); + else + { + output_asm_insn ("psha", operands); + output_asm_insn ("tba", operands); + output_asm_insn ("pulb", operands); + } val -= 8; }