X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCClrange.c;h=7d5646cd452abb78dca96109a73b5eb72cc329d1;hb=b1f85c08d3a6ead57a1cc5f14b57c3adf806204a;hp=96287420938c673a72f8b208fad8b4c28330ba7d;hpb=dec372f618bbd9132102c850d5e97e86b8a08b0d;p=fw%2Fsdcc diff --git a/src/SDCClrange.c b/src/SDCClrange.c index 96287420..7d5646cd 100644 --- a/src/SDCClrange.c +++ b/src/SDCClrange.c @@ -29,6 +29,7 @@ int iCodeSeq = 0; hTab *liveRanges = NULL; hTab *iCodehTab = NULL; +hTab *iCodeSeqhTab = NULL; /*-----------------------------------------------------------------*/ /* sequenceiCode - creates a sequence number for the iCode & add */ @@ -48,6 +49,7 @@ sequenceiCode (eBBlock ** ebbs, int count) ic->seq = ++iCodeSeq; ic->depth = ebbs[i]->depth; hTabAddItem (&iCodehTab, ic->key, ic); + hTabAddItem (&iCodeSeqhTab, ic->seq, ic); } ebbs[i]->lSeq = iCodeSeq; } @@ -278,7 +280,9 @@ useDefLoopCheck (operand * op, iCode * ic) OP_SYMBOL (op)->name, ic->filename, ic->lineno); } +#if 0 // this will create a segfault: bug #498971 OP_SYMBOL (op)->isspilt = 1; +#endif } } @@ -309,7 +313,7 @@ operandLUse (operand * op, eBBlock ** ebbs, if (lic->op == CALL || lic->op == PCALL) break; } /* found it : mark */ - if (lic) torange = lic->seq; + if (lic) torange = lic->prev->seq; } /* if this is the last use then if this block belongs to a loop & some definition comes into the loop @@ -576,10 +580,13 @@ rlivePoint (eBBlock ** ebbs, int count) /* if it is live then add the lrange to ic->rlive */ if (lrange->liveFrom <= ic->seq && lrange->liveTo >= ic->seq) { - lrange->isLiveFcall |= (ic->op == CALL || ic->op == PCALL || ic->op == SEND); + lrange->isLiveFcall |= ((lrange->liveFrom < ic->seq) && + (ic->op == CALL || ic->op == PCALL || ic->op == SEND)); + if (ic->op == CALL && lrange->liveFrom == ic->seq) continue; ic->rlive = bitVectSetBit (ic->rlive, lrange->key); } } +#if 0 /* overlapping live ranges should be eliminated */ if (ASSIGN_ITEMP_TO_ITEMP (ic)) { if (SPIL_LOC(IC_RIGHT(ic)) == SPIL_LOC(IC_RESULT(ic)) && /* left & right share the same spil location */ @@ -590,6 +597,7 @@ rlivePoint (eBBlock ** ebbs, int count) SPIL_LOC(IC_RIGHT(ic)) = NULL; /* then cannot share */ } } +#endif } } } @@ -663,6 +671,8 @@ computeLiveRanges (eBBlock ** ebbs, int count) iCodeSeq = 0; setToNull ((void **) &iCodehTab); iCodehTab = newHashTable (iCodeKey); + setToNull ((void **) &iCodeSeqhTab); + iCodeSeqhTab = newHashTable (iCodeKey); sequenceiCode (ebbs, count); /* call routine to mark the from & to live ranges for