From f6943692bcb9620217f07b81187d618817c9757c Mon Sep 17 00:00:00 2001 From: johanknol Date: Wed, 1 Aug 2001 11:34:14 +0000 Subject: [PATCH] fixed bug #444971 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1119 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/gen.c | 6 ++---- src/ds390/ralloc.c | 10 ++++++++++ src/mcs51/gen.c | 8 ++++++++ src/mcs51/ralloc.c | 10 ++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 0481331e..6be8ac2a 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -2943,9 +2943,7 @@ genEndFunction (iCode * ic) emitcode ("setb", "ea"); /* if debug then send end of function */ -/* if (options.debug && currFunc) */ - if (currFunc) - { + if (options.debug && currFunc) { _G.debugLine = 1; emitcode ("", "C$%s$%d$%d$%d ==.", FileBaseName (ic->filename), currFunc->lastLine, @@ -2983,7 +2981,7 @@ genEndFunction (iCode * ic) } /* if debug then send end of function */ - if (currFunc) + if (options.debug && currFunc) { _G.debugLine = 1; emitcode ("", "C$%s$%d$%d$%d ==.", diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index a9a66cea..c9307ee3 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -1920,6 +1920,16 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp) bitVectFirstBit (OP_DEFS (op))))) return NULL; + /* if that only usage is a cast */ + if (dic->op == CAST) { + /* to a bigger type */ + if (getSize(OP_SYM_TYPE(IC_RESULT(dic))) > + getSize(OP_SYM_TYPE(IC_RIGHT(dic)))) { + /* than we can not, since we cannot predict the usage of b & acc */ + return NULL; + } + } + /* found the definition now check if it is local */ if (dic->seq < ebp->fSeq || dic->seq > ebp->lSeq) diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 78725f19..2c38a068 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -28,6 +28,9 @@ Made everything static -------------------------------------------------------------------------*/ +#define D +//#define D(x) x + #include #include #include @@ -1611,6 +1614,8 @@ genIpush (iCode * ic) int size, offset = 0; char *l; + D(emitcode (";", "genIpush")); + /* if this is not a parm push : ie. it is spill push and spill push is always done on the local stack */ if (!ic->parmPush) @@ -1839,6 +1844,7 @@ genCall (iCode * ic) bool restoreBank = FALSE; bool swapBanks = FALSE; + D(emitcode(";", "genCall")); /* if send set is not empty the assign */ if (_G.sendSet) { @@ -8146,6 +8152,8 @@ genCast (iCode * ic) operand *right = IC_RIGHT (ic); int size, offset; + D(emitcode(";", "genCast")); + /* if they are equivalent then do nothing */ if (operandsEqu (IC_RESULT (ic), IC_RIGHT (ic))) return; diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index aa49eebf..6b9c977a 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1902,6 +1902,16 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp) bitVectFirstBit (OP_DEFS (op))))) return NULL; + /* if that only usage is a cast */ + if (dic->op == CAST) { + /* to a bigger type */ + if (getSize(OP_SYM_TYPE(IC_RESULT(dic))) > + getSize(OP_SYM_TYPE(IC_RIGHT(dic)))) { + /* than we can not, since we cannot predict the usage of b & acc */ + return NULL; + } + } + /* found the definition now check if it is local */ if (dic->seq < ebp->fSeq || dic->seq > ebp->lSeq) -- 2.47.2