From 2a6a00a8ffd9e23e9808890f109182aa2c0f1d5b Mon Sep 17 00:00:00 2001 From: johanknol Date: Sun, 9 Dec 2001 11:45:10 +0000 Subject: [PATCH] fixed bug #477835 for ds390-port git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1664 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/gen.c | 16 ++++++++-------- src/ds390/ralloc.c | 14 +++++++------- src/ds390/ralloc.h | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 9db62c56..6a073a73 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -1842,10 +1842,10 @@ saveRegisters (iCode * lic) rsave = bitVectSetBit(rsave,i); } } else { - /* find the registers in use at this time - and push them away to safety */ - rsave = bitVectCplAnd (bitVectCopy (ic->rMask), - ic->rUsed); + /* safe the registers in use at this time but skip the + ones for the result */ + rsave = bitVectCplAnd (bitVectCopy (ic->rMask), + ds390_rUmaskForOp (IC_RESULT(ic))); } ic->regsSaved = 1; if (options.useXstack) @@ -1896,10 +1896,10 @@ unsaveRegisters (iCode * ic) rsave = bitVectSetBit(rsave,i); } } else { - /* find the registers in use at this time - and push them away to safety */ - rsave = bitVectCplAnd (bitVectCopy (ic->rMask), - ic->rUsed); + /* restore the registers in use at this time but skip the + ones for the result */ + rsave = bitVectCplAnd (bitVectCopy (ic->rMask), + ds390_rUmaskForOp (IC_RESULT(ic))); } if (options.useXstack) { diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 8722a5c9..c0f472c9 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -1408,8 +1408,8 @@ static void fillGaps() /*-----------------------------------------------------------------*/ /* rUmaskForOp :- returns register mask for an operand */ /*-----------------------------------------------------------------*/ -static bitVect * -rUmaskForOp (operand * op) +bitVect * +ds390_rUmaskForOp (operand * op) { bitVect *rumask; symbol *sym; @@ -1449,7 +1449,7 @@ regsUsedIniCode (iCode * ic) if (ic->op == IFX) { rmask = bitVectUnion (rmask, - rUmaskForOp (IC_COND (ic))); + ds390_rUmaskForOp (IC_COND (ic))); goto ret; } @@ -1457,7 +1457,7 @@ regsUsedIniCode (iCode * ic) if (ic->op == JUMPTABLE) { rmask = bitVectUnion (rmask, - rUmaskForOp (IC_JTCOND (ic))); + ds390_rUmaskForOp (IC_JTCOND (ic))); goto ret; } @@ -1465,16 +1465,16 @@ regsUsedIniCode (iCode * ic) /* of all other cases */ if (IC_LEFT (ic)) rmask = bitVectUnion (rmask, - rUmaskForOp (IC_LEFT (ic))); + ds390_rUmaskForOp (IC_LEFT (ic))); if (IC_RIGHT (ic)) rmask = bitVectUnion (rmask, - rUmaskForOp (IC_RIGHT (ic))); + ds390_rUmaskForOp (IC_RIGHT (ic))); if (IC_RESULT (ic)) rmask = bitVectUnion (rmask, - rUmaskForOp (IC_RESULT (ic))); + ds390_rUmaskForOp (IC_RESULT (ic))); ret: return rmask; diff --git a/src/ds390/ralloc.h b/src/ds390/ralloc.h index 4e6116c3..4dde61b6 100644 --- a/src/ds390/ralloc.h +++ b/src/ds390/ralloc.h @@ -60,6 +60,8 @@ extern regs regs390[]; regs *ds390_regWithIdx (int); +bitVect *ds390_rUmaskForOp (operand * op); + extern int ds390_ptrRegReq; extern int ds390_nRegs; -- 2.39.5