From 3f26b7d9381cd2399e95d2ccb88ecc77ae0458d0 Mon Sep 17 00:00:00 2001 From: johanknol Date: Mon, 25 Jun 2001 15:33:46 +0000 Subject: [PATCH] fixed the ---reent stack restoration git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@943 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCopt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/SDCCopt.c b/src/SDCCopt.c index 0a21e032..cb7c6bc3 100644 --- a/src/SDCCopt.c +++ b/src/SDCCopt.c @@ -58,6 +58,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp) operand *right; symbol *func = NULL; int lineno = ic->lineno; + int bytesPushed=0; ip = ic->next; /* insertion point */ /* remove it from the iCode */ @@ -144,6 +145,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp) { newic = newiCode (IPUSH, right, NULL); newic->parmPush = 1; + bytesPushed+=4; } addiCodeToeBBlock (ebp, newic, ip); @@ -158,6 +160,7 @@ cnvToFcall (iCode * ic, eBBlock * ebp) { newic = newiCode (IPUSH, left, NULL); newic->parmPush = 1; + bytesPushed+=4; } addiCodeToeBBlock (ebp, newic, ip); newic->lineno = lineno; @@ -165,8 +168,9 @@ cnvToFcall (iCode * ic, eBBlock * ebp) /* insert the call */ newic = newiCode (CALL, operandFromSymbol (func), NULL); IC_RESULT (newic) = IC_RESULT (ic); - addiCodeToeBBlock (ebp, newic, ip); newic->lineno = lineno; + newic->parmBytes+=bytesPushed; + addiCodeToeBBlock (ebp, newic, ip); } /*-----------------------------------------------------------------*/ @@ -319,6 +323,8 @@ convilong (iCode * ic, eBBlock * ebp, sym_link * type, int op) int lineno = ic->lineno; int bwd; int su; + int bytesPushed=0; + remiCodeFromeBBlock (ebp, ic); /* depending on the type */ @@ -380,6 +386,7 @@ found: { newic = newiCode (IPUSH, IC_RIGHT (ic), NULL); newic->parmPush = 1; + bytesPushed=getSize(type); } addiCodeToeBBlock (ebp, newic, ip); newic->lineno = lineno; @@ -391,6 +398,7 @@ found: { newic = newiCode (IPUSH, IC_LEFT (ic), NULL); newic->parmPush = 1; + bytesPushed=getSize(type); } addiCodeToeBBlock (ebp, newic, ip); newic->lineno = lineno; @@ -400,9 +408,9 @@ found: /* for the result */ newic = newiCode (CALL, operandFromSymbol (func), NULL); IC_RESULT (newic) = IC_RESULT (ic); - addiCodeToeBBlock (ebp, newic, ip); newic->lineno = lineno; - + newic->parmBytes+=bytesPushed; // to clear the stack after the call + addiCodeToeBBlock (ebp, newic, ip); } /*-----------------------------------------------------------------*/ -- 2.30.2