aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1996-11-14 17:26:51 -0700
committerJeff Law <law@gcc.gnu.org>1996-11-14 17:26:51 -0700
commitbc8c93e48084f3594882331ac877f0e30e01546c (patch)
treea45aae65c11618a7f58bec550754530f9a35e69f
parent8762df168991b646310a3a2839ebafafc9d4a802 (diff)
downloadgcc-bc8c93e48084f3594882331ac877f0e30e01546c.zip
gcc-bc8c93e48084f3594882331ac877f0e30e01546c.tar.gz
gcc-bc8c93e48084f3594882331ac877f0e30e01546c.tar.bz2
h8300.c (dosize): Don't clobber the static chain register if it's needed by the current function.
* h8300/h8300.c (dosize): Don't clobber the static chain register if it's needed by the current function. From-SVN: r13158
-rw-r--r--gcc/config/h8300/h8300.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 440b219..a8f9736 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;