From 5f4241d584de5cc88ad85c5d3497929435bbb69f Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 24 Apr 1996 00:00:53 +0000 Subject: [PATCH] sparc.c (output_function_prologue): In -mbroken-saverestore case, %sp = %fp - size. * sparc/sparc.c (output_function_prologue): In -mbroken-saverestore case, %sp = %fp - size. From-SVN: r11872 --- gcc/config/sparc/sparc.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 3ccbbe6880b..1708b371753 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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) -- 2.30.2