From 6d1159eb64fb1632f8d02c27bb820cbd548b340e Mon Sep 17 00:00:00 2001 From: law Date: Fri, 15 Nov 1996 00:26:51 +0000 Subject: [PATCH] * h8300/h8300.c (dosize): Don't clobber the static chain register if it's needed by the current function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13158 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/h8300/h8300.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 440b219a847..a8f973606e7 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -170,7 +170,27 @@ dosize (file, op, size) break; default: if (TARGET_H8300) - fprintf (file, "\tmov.w\t#%d,r3\n\t%s.w\tr3,sp\n", size, op); + { + if (current_function_needs_context + && strcmp (op, "sub") == 0) + { + /* Egad. We don't have a temporary to hold the + size of the frame in the prologue! Just inline + the bastard since this shouldn't happen often. */ + while (size >= 2) + { + fprintf (file, "\tsubs\t#2,sp\n"); + size -= 2; + } + + if (size) + fprintf (file, "\tsubs\t#1,sp\n"); + + size = 0; + } + else + fprintf (file, "\tmov.w\t#%d,r3\n\t%s.w\tr3,sp\n", size, op); + } else fprintf (file, "\t%s\t#%d,sp\n", op, size); size = 0; -- 2.11.4.GIT