m68hc11.c (m68hc11_override_options): Don't use soft registers by default for 68HC12.
authorStephane Carrez <Stephane.Carrez@worldnet.fr>
Sat, 16 Mar 2002 13:03:59 +0000 (14:03 +0100)
committerStephane Carrez <ciceron@gcc.gnu.org>
Sat, 16 Mar 2002 13:03:59 +0000 (14:03 +0100)
* 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.

From-SVN: r50882

gcc/ChangeLog
gcc/config/m68hc11/m68hc11.c

index 87181f2fa8b5efd76efe06514991f625c3ea6457..36c51fec261c581cd2d7d1cba822611ac62fd247 100644 (file)
@@ -1,3 +1,13 @@
+2002-03-16  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+       * 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  <Stephane.Carrez@worldnet.fr>
 
        * config/m68hc11/m68hc11-protos.h (ix_reg): Declare.
index 041b596e2823d9bb18f8b5a4feb448ed66ca3f75..4927825fa61deacdba65b0c7413e0c3c00ec11ba 100644 (file)
@@ -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;
+    }
 }
 \f
 
@@ -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;
     }