mn10300.c (REG_SAVE_BYTES): Only reserve space for registers which will be saved.
authorJeffrey A Law <law@cygnus.com>
Wed, 12 Aug 1998 16:41:11 +0000 (16:41 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 12 Aug 1998 16:41:11 +0000 (10:41 -0600)
        * mn10300.c (REG_SAVE_BYTES): Only reserve space for registers
        which will be saved.
        * mn10300.md (prologue insn): Only save registers which need saving.
        (epilogue insn): Similarly.

From-SVN: r21687

gcc/ChangeLog
gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.md

index 726102a481ee487764cd9af07e4859fecdaad14c..5e90c3a76f9464bce8707c95903fc474947fe23b 100644 (file)
@@ -1,5 +1,10 @@
 Wed Aug 12 17:25:18 1998  Jeffrey A Law  (law@cygnus.com)
 
+       * mn10300.c (REG_SAVE_BYTES): Only reserve space for registers
+       which will be saved.
+       * mn10300.md (prologue insn): Only save registers which need saving.
+       (epilogue insn): Similarly.
+
        * mn10300.c, mn10300.h, mn10300.md: Remove "global zero register"
        optimizations.
 
index d1f71ef303ff1f0b2a6e4598e8a78a4143ff80c4..9f1ff842ab3c5da61bb403ec150a026f27b2d3a4 100644 (file)
@@ -39,7 +39,10 @@ Boston, MA 02111-1307, USA.  */
 /* The size of the callee register save area.  Right now we save everything
    on entry since it costs us nothing in code size.  It does cost us from a
    speed standpoint, so we want to optimize this sooner or later.  */
-#define REG_SAVE_BYTES (16)
+#define REG_SAVE_BYTES (4 * regs_ever_live[2] \
+                       + 4 * regs_ever_live[3] \
+                       + 4 * regs_ever_live[6] \
+                       + 4 * regs_ever_live[7])
 
 void
 asm_file_start (file)
index 8a652ebd97071e84470d6f52ba79de2d99efe5d6..d3061ad54b84367c63527cc264ace8cc59993093 100644 (file)
   ""
   "*
 {
-  return \"ret [d2,d3,a2,a3],%0\";
+  int i, need_comma;
+  int d2, d3, a2, a3;
+
+  need_comma = 0;
+  fputs (\"\\tret [\", asm_out_file);
+  if (regs_ever_live[2])
+    {
+      fputs (\"d2\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[3])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"d3\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[6])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"a2\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[7])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"a3\", asm_out_file);
+      need_comma = 1;
+    }
+  fprintf (asm_out_file, \"],%d\\n\", INTVAL (operands[0]));
+  return \"\";
 }"
   [(set_attr "cc" "clobber")])
 
   ""
   "*
 {
-  return \"movm [d2,d3,a2,a3],(sp)\";
+  int i, need_comma;
+  int d2, d3, a2, a3;
+
+  need_comma = 0;
+  fputs (\"\\tmovm [\", asm_out_file);
+  if (regs_ever_live[2])
+    {
+      fputs (\"d2\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[3])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"d3\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[6])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"a2\", asm_out_file);
+      need_comma = 1;
+    }
+  if (regs_ever_live[7])
+    {
+      if (need_comma)
+       fputc (',', asm_out_file); 
+      fputs (\"a3\", asm_out_file);
+      need_comma = 1;
+    }
+  fputs (\"],(sp)\\n\", asm_out_file);
+  return \"\";
 }"
   [(set_attr "cc" "clobber")])