From 319c3bf6f214b06c2b7518e5ecf791e7ab3b7d99 Mon Sep 17 00:00:00 2001 From: johanknol Date: Mon, 30 Jul 2001 12:03:15 +0000 Subject: [PATCH] final fix for bug 444507 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1110 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/gen.c | 12 +++++++++--- src/ds390/ralloc.c | 12 ------------ src/mcs51/gen.c | 12 +++++++++--- src/mcs51/ralloc.c | 39 +-------------------------------------- 4 files changed, 19 insertions(+), 56 deletions(-) diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 333e688c..0481331e 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -5353,9 +5353,15 @@ genAnd (iCode * ic, iCode * ifx) emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE, FALSE)); } else { - MOVA (aopGet (AOP (right), offset, FALSE, FALSE, TRUE)); - emitcode ("anl", "a,%s", - aopGet (AOP (left), offset, FALSE, FALSE, FALSE)); + if (AOP_TYPE(left)==AOP_ACC) { + emitcode("mov", "b,a"); + MOVA (aopGet (AOP (right), offset, FALSE, FALSE, TRUE)); + emitcode("anl", "a,b"); + }else { + MOVA (aopGet (AOP (right), offset, FALSE, FALSE, TRUE)); + emitcode ("anl", "a,%s", + aopGet (AOP (left), offset, FALSE, FALSE, FALSE)); + } } emitcode ("jnz", "%05d$", tlbl->key + 100); offset++; diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 2ff9574e..a9a66cea 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -1619,24 +1619,12 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) we cannot */ for (dic = ic->prev; dic; dic = dic->prev) { -#if 0 // jwk 20010410, the JanVanBelle case - /* if there is a function call and this is - a parameter & not my parameter then don't pack it */ - if ((dic->op == CALL || dic->op == PCALL) && - (OP_SYMBOL (IC_RESULT (ic))->_isparm && - !OP_SYMBOL (IC_RESULT (ic))->ismyparm)) - { - dic = NULL; - break; - } -#else /* if there is a function call then don't pack it */ if ((dic->op == CALL || dic->op == PCALL)) { dic = NULL; break; } -#endif if (SKIP_IC2 (dic)) continue; diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 90cb2c0d..2e64ad21 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -4596,9 +4596,15 @@ genAnd (iCode * ic, iCode * ifx) emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE)); } else { - MOVA (aopGet (AOP (right), offset, FALSE, FALSE)); - emitcode ("anl", "a,%s", - aopGet (AOP (left), offset, FALSE, FALSE)); + if (AOP_TYPE(left)==AOP_ACC) { + emitcode("mov", "b,a"); + MOVA (aopGet (AOP (right), offset, FALSE, FALSE)); + emitcode("anl", "a,b"); + }else { + MOVA (aopGet (AOP (right), offset, FALSE, FALSE)); + emitcode ("anl", "a,%s", + aopGet (AOP (left), offset, FALSE, FALSE)); + } } emitcode ("jnz", "%05d$", tlbl->key + 100); offset++; diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index f1a4e1dd..aa49eebf 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1583,7 +1583,7 @@ static int packRegsForAssign (iCode * ic, eBBlock * ebp) { iCode *dic, *sic; - sym_link *etype = operandType (IC_RIGHT (ic)); + //sym_link *etype = operandType (IC_RIGHT (ic)); if (!IS_ITEMP (IC_RIGHT (ic)) || OP_SYMBOL (IC_RIGHT (ic))->isind || @@ -1595,43 +1595,21 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) /* if the true symbol is defined in far space or on stack then we should not since this will increase register pressure */ -#if 0 - if (isOperandInFarSpace (IC_RESULT (ic))) - { - if ((dic = farSpacePackable (ic))) - goto pack; - else - return 0; - } -#else if (isOperandInFarSpace(IC_RESULT(ic)) && !farSpacePackable(ic)) { return 0; } -#endif /* find the definition of iTempNN scanning backwards if we find a a use of the true symbol in before we find the definition then we cannot */ for (dic = ic->prev; dic; dic = dic->prev) { -#if 0 // jwk 20010410 - /* if there is a function call and this is - a parameter & not my parameter then don't pack it */ - if ((dic->op == CALL || dic->op == PCALL) && - (OP_SYMBOL (IC_RESULT (ic))->_isparm && - !OP_SYMBOL (IC_RESULT (ic))->ismyparm)) - { - dic = NULL; - break; - } -#else /* if there is a function call then don't pack it */ if ((dic->op == CALL || dic->op == PCALL)) { dic = NULL; break; } -#endif if (SKIP_IC2 (dic)) continue; @@ -2340,20 +2318,6 @@ packRegisters (eBBlock * ebp) } } -#if 0 - /* if the condition of an if instruction - is defined in the previous instruction then - mark the itemp as a conditional */ - if ((IS_CONDITIONAL (ic) || - (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic))) && - ic->next && ic->next->op == IFX && - isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) && - OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq) - { - OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND; - continue; - } -#else /* if the condition of an if instruction is defined in the previous instruction and this is the only usage then @@ -2368,7 +2332,6 @@ packRegisters (eBBlock * ebp) OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND; continue; } -#endif /* reduce for support function calls */ if (ic->supportRtn || ic->op == '+' || ic->op == '-') -- 2.47.2