From c140e58cb55fe9f639c063494cf8f457b552d398 Mon Sep 17 00:00:00 2001 From: sandeep Date: Tue, 11 Dec 2001 21:53:41 +0000 Subject: [PATCH] DPTR use fixed for add to remat. iTemps used in return statements can be assigned tp DPTR git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1674 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/ralloc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index c0f472c9..a3385230 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -1302,7 +1302,7 @@ static void fillGaps() /* First try to do DPTRuse once more since now we know what got into registers */ -#if 1 + for (sym = hTabFirstItem(liveRanges,&key) ; sym ; sym = hTabNextItem(liveRanges,&key)) { @@ -1322,7 +1322,7 @@ static void fillGaps() } } } -#endif + /* look for livernages that was spilt by the allocator */ for (sym = hTabFirstItem(liveRanges,&key) ; sym ; sym = hTabNextItem(liveRanges,&key)) { @@ -2110,20 +2110,21 @@ packRegsDPTRuse (operand * op) /* if PCALL cannot be sure give up */ if (ic->op == PCALL) return NULL; - /* if CALL then make sure it is VOID || return value not used */ + /* if CALL then make sure it is VOID || return value not used + or the return value is assigned to this one */ if (ic->op == CALL) { if (OP_SYMBOL(IC_RESULT(ic))->liveTo == OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ; etype = getSpec(type = operandType(IC_RESULT(ic))); - if (getSize(type) == 0) continue ; + if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic))) continue ; return NULL ; } /* special case of add with a [remat] */ if (ic->op == '+' && OP_SYMBOL(IC_LEFT(ic))->remat && - (!isOperandInFarSpace(IC_RIGHT(ic)) || - isOperandInReg(IC_RIGHT(ic)))) continue ; + (isOperandInFarSpace(IC_RIGHT(ic)) && + !isOperandInReg(IC_RIGHT(ic)))) return NULL ; /* special cases */ /* pointerGet */ @@ -2506,6 +2507,9 @@ packRegisters (eBBlock * ebp) if (POINTER_GET (ic)) OP_SYMBOL (IC_LEFT (ic))->uptr = 1; + if (ic->op == RETURN && IS_SYMOP (IC_LEFT(ic))) + OP_SYMBOL (IC_LEFT (ic))->uptr = 1; + if (!SKIP_IC2 (ic)) { /* if we are using a symbol on the stack -- 2.47.2