From b0533dc50c9cbb43921d73557bb0ae5daf5641e0 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 29 Dec 2001 23:45:36 +0000 Subject: [PATCH] a) packRegsForSupport could mess up live information (Fixed) b) packRegsDPTRuse could be incorrect for left & right shift git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1749 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/ralloc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index b462b81b..696a699c 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -2039,11 +2039,14 @@ packRegsForSupport (iCode * ic, eBBlock * ebp) /* found it we need to remove it from the block */ - for (sic = dic; sic != ic; sic = sic->next) + for (sic = dic; sic != ic; sic = sic->next) { bitVectUnSetBit (sic->rlive, IC_LEFT (ic)->key); + sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key); + } IC_LEFT (ic)->operand.symOperand = IC_RIGHT (dic)->operand.symOperand; + OP_SYMBOL(IC_LEFT(ic))->liveTo = ic->seq; IC_LEFT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key; bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key); remiCodeFromeBBlock (ebp, dic); @@ -2073,13 +2076,15 @@ right: } /* found it we need to remove it from the block */ - for (sic = dic; sic != ic; sic = sic->next) + for (sic = dic; sic != ic; sic = sic->next) { bitVectUnSetBit (sic->rlive, IC_RIGHT (ic)->key); + sic->rlive = bitVectSetBit (sic->rlive, IC_RIGHT (dic)->key); + } IC_RIGHT (ic)->operand.symOperand = IC_RIGHT (dic)->operand.symOperand; IC_RIGHT (ic)->key = IC_RIGHT (dic)->operand.symOperand->key; - + OP_SYMBOL(IC_RIGHT(ic))->liveTo = ic->seq; remiCodeFromeBBlock (ebp, dic); bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key); hTabDeleteItem (&iCodehTab, dic->key, dic, DELETE_ITEM, NULL); @@ -2137,10 +2142,7 @@ packRegsDPTRuse (operand * op) if (OP_SYMBOL(IC_RESULT(ic))->liveTo == OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ; etype = getSpec(type = operandType(IC_RESULT(ic))); -#if 0 if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic))) -#endif - if (getSize(type) == 0) continue ; return NULL ; } @@ -2161,7 +2163,8 @@ packRegsDPTRuse (operand * op) getSize(operandType(IC_RESULT(ic))) > 1 ) return NULL; /* conditionals can destroy 'b' - make sure B wont be used in this one*/ - if ((IS_CONDITIONAL(ic) || ic->op == '*' || ic->op == '/' ) && + if ((IS_CONDITIONAL(ic) || ic->op == '*' || ic->op == '/' || + ic->op == LEFT_OP || ic->op == RIGHT_OP ) && getSize(operandType(op)) > 3) return NULL; /* general case */ @@ -2173,7 +2176,7 @@ packRegsDPTRuse (operand * op) if (IC_RIGHT(ic) && IS_SYMOP(IC_RIGHT(ic)) && !isOperandEqual(IC_RIGHT(ic),op) && - (OP_SYMBOL(IC_RIGHT(ic))->liveTo > ic->seq || + (OP_SYMBOL(IC_RIGHT(ic))->liveTo >= ic->seq || IS_TRUE_SYMOP(IC_RIGHT(ic)) || OP_SYMBOL(IC_RIGHT(ic))->ruonly) && ((isOperandInFarSpace(IC_RIGHT(ic)) && !isOperandInReg(IC_RIGHT(ic)))|| @@ -2590,11 +2593,9 @@ packRegisters (eBBlock * ebp) } #endif -#if 0 /* unsafe */ /* reduce for support function calls */ if (ic->supportRtn || ic->op == '+' || ic->op == '-') packRegsForSupport (ic, ebp); -#endif /* some cases the redundant moves can can be eliminated for return statements */ -- 2.47.2