sparc.c (output_function_prologue): In -mbroken-saverestore case, %sp = %fp - size.
authorDoug Evans <dje@gnu.org>
Wed, 24 Apr 1996 00:00:53 +0000 (00:00 +0000)
committerDoug Evans <dje@gnu.org>
Wed, 24 Apr 1996 00:00:53 +0000 (00:00 +0000)
* sparc/sparc.c (output_function_prologue): In -mbroken-saverestore
case, %sp = %fp - size.

From-SVN: r11872

gcc/config/sparc/sparc.c

index 3ccbbe6880b9bbb89d06d6e06d0f70f042a49eaa..1708b3717533891f578da1b7328e5ff403bd6abd 100644 (file)
@@ -3095,16 +3095,28 @@ output_function_prologue (file, size, leaf_function)
          fprintf (file, "\tsave %%sp,%%g1,%%sp\n");
        }
     }
-  else
+  else if (! leaf_function && TARGET_BROKEN_SAVERESTORE)
     {
-      /* If the target has a broken save insn (only handles save %g0,%g0,%g0),
-        do the save and then handle like a leaf function.
-        We assume the environment will properly handle or otherwise avoid
+      /* We assume the environment will properly handle or otherwise avoid
         trouble associated with an interrupt occuring after the `save' or
         trap occuring during it.  */
-      if (TARGET_BROKEN_SAVERESTORE)
-       fprintf (file, "\tsave\n");
+      fprintf (file, "\tsave\n");
 
+      if (actual_fsize <= 4096)
+       fprintf (file, "\tadd %%fp,-%d,%%sp\n", actual_fsize);
+      else if (actual_fsize <= 8192)
+       {
+         fprintf (file, "\tadd %%fp,-4096,%%sp\n");
+         fprintf (file, "\tadd %%fp,-%d,%%sp\n", actual_fsize - 4096);
+       }
+      else
+       {
+         build_big_number (file, -actual_fsize, "%g1");
+         fprintf (file, "\tadd %%fp,%%g1,%%sp\n");
+       }
+    }
+  else /* leaf function */
+    {
       if (actual_fsize <= 4096)
        fprintf (file, "\tadd %%sp,-%d,%%sp\n", actual_fsize);
       else if (actual_fsize <= 8192)