From f4afc413b4992bc80e9056af1ce32873e9c4605c Mon Sep 17 00:00:00 2001 From: epetrich Date: Tue, 10 Feb 2004 07:20:18 +0000 Subject: [PATCH] * src/ds390/gen.c (genNearPointerGet), * src/mcs51/gen.c (genNearPointerGet): allow the genDataPointerGet() optimization with bits, but not bitfields. * src/ds390/ralloc.c (packRegisters), * src/mcs51/ralloc.c (packRegisters): fixed bug #884453 & #880832 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3186 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 ++++++++ src/ds390/gen.c | 6 +++--- src/ds390/ralloc.c | 18 +++++++++++++----- src/mcs51/gen.c | 6 +++--- src/mcs51/ralloc.c | 18 +++++++++++++----- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb17b138..5c17827a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-02-10 Erik Petrich + + * src/ds390/gen.c (genNearPointerGet), + * src/mcs51/gen.c (genNearPointerGet): allow the genDataPointerGet() + optimization with bits, but not bitfields. + * src/ds390/ralloc.c (packRegisters), + * src/mcs51/ralloc.c (packRegisters): fixed bug #884453 & #880832 + 2004-02-09 Bernhard Held * src/SDCCcse.c (algebraicOpts): copy operands before modification diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 653fa3fb..1d70bcf3 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -9335,12 +9335,12 @@ genNearPointerGet (operand * left, aopOp (left, ic, FALSE, FALSE); /* if left is rematerialisable and - result is not bit variable type and + result is not bitfield variable type and the left is pointer to data space i.e lower 128 bytes of space */ if (AOP_TYPE (left) == AOP_IMMD && - !IS_BITVAR (retype) && - !IS_BITVAR (letype) && + !IS_BITFIELD (retype) && + !IS_BITFIELD (letype) && DCL_TYPE (ltype) == POINTER) { genDataPointerGet (left, result, ic); diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 8760bd7b..008e7e07 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -2907,23 +2907,31 @@ packRegisters (eBBlock * ebp) { /* if we are using a symbol on the stack then we should say ds390_ptrRegReq */ + if (options.useXstack && ic->parmPush + && (ic->op == IPUSH || ic->op == IPOP)) + ds390_ptrRegReq++; if (ic->op == IFX && IS_SYMOP (IC_COND (ic))) ds390_ptrRegReq += ((OP_SYMBOL (IC_COND (ic))->onStack ? !options.stack10bit : 0) + - OP_SYMBOL (IC_COND (ic))->iaccess); + OP_SYMBOL (IC_COND (ic))->iaccess + + (SPEC_OCLS(OP_SYMBOL (IC_COND (ic))->etype) == idata)); else if (ic->op == JUMPTABLE && IS_SYMOP (IC_JTCOND (ic))) ds390_ptrRegReq += ((OP_SYMBOL (IC_JTCOND (ic))->onStack ? !options.stack10bit : 0) + - OP_SYMBOL (IC_JTCOND (ic))->iaccess); + OP_SYMBOL (IC_JTCOND (ic))->iaccess + + (SPEC_OCLS(OP_SYMBOL (IC_JTCOND (ic))->etype) == idata)); else { if (IS_SYMOP (IC_LEFT (ic))) ds390_ptrRegReq += ((OP_SYMBOL (IC_LEFT (ic))->onStack ? !options.stack10bit : 0) + - OP_SYMBOL (IC_LEFT (ic))->iaccess); + OP_SYMBOL (IC_LEFT (ic))->iaccess + + (SPEC_OCLS(OP_SYMBOL (IC_LEFT (ic))->etype) == idata)); if (IS_SYMOP (IC_RIGHT (ic))) ds390_ptrRegReq += ((OP_SYMBOL (IC_RIGHT (ic))->onStack ? !options.stack10bit : 0) + - OP_SYMBOL (IC_RIGHT (ic))->iaccess); + OP_SYMBOL (IC_RIGHT (ic))->iaccess + + (SPEC_OCLS(OP_SYMBOL (IC_RIGHT (ic))->etype) == idata)); if (IS_SYMOP (IC_RESULT (ic))) ds390_ptrRegReq += ((OP_SYMBOL (IC_RESULT (ic))->onStack ? !options.stack10bit : 0) + - OP_SYMBOL (IC_RESULT (ic))->iaccess); + OP_SYMBOL (IC_RESULT (ic))->iaccess + + (SPEC_OCLS(OP_SYMBOL (IC_RESULT (ic))->etype) == idata)); } } diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index bd7049bc..cb4dea5c 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -135,7 +135,7 @@ emitcode (char *inst, const char *fmt,...) while (isspace (*lbp)) lbp++; - //printf ("%s\n", lb); + // printf ("%s\n", lb); if (lbp && *lbp) lineCurr = (lineCurr ? @@ -7572,11 +7572,11 @@ genNearPointerGet (operand * left, aopOp (left, ic, FALSE); /* if left is rematerialisable and - result is not bit variable type and + result is not bitfield variable type and the left is pointer to data space i.e lower 128 bytes of space */ if (AOP_TYPE (left) == AOP_IMMD && - !IS_BITVAR (retype) && + !IS_BITFIELD (retype) && DCL_TYPE (ltype) == POINTER) { genDataPointerGet (left, result, ic); diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index a8273950..0666ff52 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -2791,23 +2791,31 @@ packRegisters (eBBlock ** ebpp, int blockno) { /* if we are using a symbol on the stack then we should say mcs51_ptrRegReq */ + if (options.useXstack && ic->parmPush + && (ic->op == IPUSH || ic->op == IPOP)) + mcs51_ptrRegReq++; if (ic->op == IFX && IS_SYMOP (IC_COND (ic))) mcs51_ptrRegReq += ((OP_SYMBOL (IC_COND (ic))->onStack || - OP_SYMBOL (IC_COND (ic))->iaccess) ? 1 : 0); + OP_SYMBOL (IC_COND (ic))->iaccess || + SPEC_OCLS(OP_SYMBOL (IC_COND (ic))->etype) == idata) ? 1 : 0); else if (ic->op == JUMPTABLE && IS_SYMOP (IC_JTCOND (ic))) mcs51_ptrRegReq += ((OP_SYMBOL (IC_JTCOND (ic))->onStack || - OP_SYMBOL (IC_JTCOND (ic))->iaccess) ? 1 : 0); + OP_SYMBOL (IC_JTCOND (ic))->iaccess || + SPEC_OCLS(OP_SYMBOL (IC_JTCOND (ic))->etype) == idata) ? 1 : 0); else { if (IS_SYMOP (IC_LEFT (ic))) mcs51_ptrRegReq += ((OP_SYMBOL (IC_LEFT (ic))->onStack || - OP_SYMBOL (IC_LEFT (ic))->iaccess) ? 1 : 0); + OP_SYMBOL (IC_LEFT (ic))->iaccess || + SPEC_OCLS(OP_SYMBOL (IC_LEFT (ic))->etype) == idata) ? 1 : 0); if (IS_SYMOP (IC_RIGHT (ic))) mcs51_ptrRegReq += ((OP_SYMBOL (IC_RIGHT (ic))->onStack || - OP_SYMBOL (IC_RIGHT (ic))->iaccess) ? 1 : 0); + OP_SYMBOL (IC_RIGHT (ic))->iaccess || + SPEC_OCLS(OP_SYMBOL (IC_RIGHT (ic))->etype) == idata) ? 1 : 0); if (IS_SYMOP (IC_RESULT (ic))) mcs51_ptrRegReq += ((OP_SYMBOL (IC_RESULT (ic))->onStack || - OP_SYMBOL (IC_RESULT (ic))->iaccess) ? 1 : 0); + OP_SYMBOL (IC_RESULT (ic))->iaccess || + SPEC_OCLS(OP_SYMBOL (IC_RESULT (ic))->etype) == idata) ? 1 : 0); } } -- 2.47.2