(result = OP_SYMBOL (IC_RESULT (ic))) && /* has a result */
result->liveTo > ic->seq && /* and will live beyond this */
result->liveTo <= ebp->lSeq && /* does not go beyond this block */
+ result->liveFrom == ic->seq && /* does not start before here */
result->regType == sym->regType && /* same register types */
result->nRegs && /* which needs registers */
!result->isspilt && /* and does not already have them */
spillThis (sym);
continue;
}
+
+ /* If the live range preceeds the point of definition
+ then ideally we must take into account registers that
+ have been allocated after sym->liveFrom but freed
+ before ic->seq. This is complicated, so spill this
+ symbol instead and let fillGaps handle the allocation. */
+ if (sym->liveFrom < ic->seq) {
+ spillThis (sym);
+ continue;
+ }
/* if it has a spillocation & is used less than
all other live ranges then spill this */
if (sym->regType == REG_PTR)
sym->regs[j] = getRegPtr (ic, ebbs[i], sym);
else
- { /*
+ {
if (ic->op == CAST && IS_SYMOP (IC_RIGHT (ic)))
{
symbol * right = OP_SYMBOL (IC_RIGHT (ic));
if (right->regs[j])
sym->regs[j] = allocThisReg (right->regs[j]);
}
- if (!sym->regs[j]) */
+ if (!sym->regs[j])
sym->regs[j] = getRegGpr (ic, ebbs[i], sym);
}
bitVectBitValue(_G.totRegAssigned,i) == 0) /* and are still assigned to registers */
continue ;
- clr = hTabItemWithKey(liveRanges,i);
+ clr = hTabItemWithKey(liveRanges,i);
assert(clr);
/* mark these registers as used */
(ic = hTabItemWithKey (iCodehTab,
bitVectFirstBit (sym->defs))) &&
POINTER_GET (ic) &&
- !sym->noSpilLoc &&
- !IS_BITVAR (sym->etype))
+ !IS_BITVAR (sym->etype) &&
+ (aggrToPtrDclType (operandType (IC_LEFT (ic)), FALSE) == POINTER))
{
-
- /* and that pointer is remat in data space */
- if (IS_SYMOP (IC_LEFT (ic)) &&
- OP_SYMBOL (IC_LEFT (ic))->remat &&
- !IS_CAST_ICODE(OP_SYMBOL (IC_LEFT (ic))->rematiCode) &&
- DCL_TYPE (aggrToPtr (operandType(IC_LEFT(ic)), FALSE)) == POINTER)
+ if (ptrPseudoSymSafe (sym, ic))
{
- /* create a psuedo symbol & force a spil */
- symbol *psym = newSymbol (rematStr (OP_SYMBOL (IC_LEFT (ic))), 1);
- psym->type = sym->type;
- psym->etype = sym->etype;
-
- strcpy (psym->rname, psym->name);
- sym->isspilt = 1;
- sym->usl.spillLoc = psym;
-#if 0 // an alternative fix for bug #480076
- /* now this is a useless assignment to itself */
- remiCodeFromeBBlock (ebbs, ic);
-#else
- /* now this really is an assignment to itself, make it so;
- it will be optimized out later */
- ic->op='=';
- ReplaceOpWithCheaperOp(&IC_RIGHT(ic), IC_RESULT(ic));
- IC_LEFT(ic)=NULL;
-#endif
+ ptrPseudoSymConvert (sym, ic, rematStr (OP_SYMBOL (IC_LEFT (ic))));
continue;
}