/* setToRange - set the range to for an operand */
/*-----------------------------------------------------------------*/
void
-setToRange (operand * op, int to, bool check, int fromLevel)
+setToRange (operand * op, int to, bool check)
{
/* only for compiler defined temps */
if (!IS_ITEMP (op))
return;
- if (fromLevel > OP_SYMBOL(op)->level) {
- // this is from an inner block and thus has no authority
- return;
- }
-
OP_SYMBOL (op)->key = op->key;
hTabAddItemIfNotP (&liveRanges, op->key, OP_SYMBOL (op));
/* found it : mark */
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
+ then extend the live range to the end of the loop */
+ if (ebp->partOfLoop
+ && hasIncomingDefs (ebp->partOfLoop, op))
+ {
+ torange = findLoopEndSeq (ebp->partOfLoop);
+ }
+
op = operandFromOperand (op);
- setToRange (op, torange, FALSE, ebp->entryLabel->level);
+ setToRange (op, torange, FALSE);
}
ic->uses = bitVectSetBit (ic->uses, op->key);
and take it away from the defs for the block */
if (bitVectIsZero (OP_SYMBOL (IC_RESULT (ic))->uses))
{
- setToRange (IC_RESULT (ic), ic->seq, FALSE,
- ebp->entryLabel->level);
+ setToRange (IC_RESULT (ic), ic->seq, FALSE);
bitVectUnSetBit (ebp->defSet, ic->key);
}
}
defUsedAfterLoop (IC_RESULT (dic), ebp->lSeq))
continue;
- setToRange (IC_RESULT (dic), (ebp->lSeq), FALSE,
- ebp->entryLabel->level);
+ setToRange (IC_RESULT (dic), (ebp->lSeq), FALSE);
}
}
}
if (bitVectBitValue (defsNotUsed, i) &&
(dic = hTabItemWithKey (iCodehTab, i)))
{
- setToRange (IC_RESULT (dic), (ebp->fSeq - 1), TRUE,
- ebp->entryLabel->level);
+ setToRange (IC_RESULT (dic), (ebp->fSeq - 1), TRUE);
}
}
}