OP_SYMBOL (op)->name,
ic->filename, ic->lineno);
}
+#if 0 // this will create a segfault: bug #498971
OP_SYMBOL (op)->isspilt = 1;
+#endif
}
}
!IS_STATIC (etype))
{
- if (bitVectIsZero (op->usesDefs))
+ if (bitVectIsZero (op->usesDefs) && OP_SYMBOL(op)->ival==NULL)
{
OP_SYMBOL (op)->isspilt = 1;
bitVect *defsUsed = NULL;
bitVect *defsNotUsed = NULL;
int i;
+
/* for all the instructions */
for (ic = ebp->sch; ic; ic = ic->next)
{
-
if (ic->op == CALL || ic->op == PCALL)
{
setFromRange (IC_RESULT (ic), ic->seq);
if (bitVectBitValue (defsNotUsed, i) &&
(dic = hTabItemWithKey (iCodehTab, i)))
{
-
setToRange (IC_RESULT (dic), (ebp->fSeq - 1), TRUE);
}
}
/* 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 */
SPIL_LOC(IC_RIGHT(ic)) = NULL; /* then cannot share */
}
}
+#endif
}
}
}
}
}
+/*-----------------------------------------------------------------*/
+/* allDefsOutOfRange - all definitions are out of a range */
+/*-----------------------------------------------------------------*/
+bool
+allDefsOutOfRange (bitVect * defs, int fseq, int toseq)
+{
+ int i;
+
+ if (!defs)
+ return TRUE;
+
+ for (i = 0; i < defs->size; i++)
+ {
+ iCode *ic;
+
+ if (bitVectBitValue (defs, i) &&
+ (ic = hTabItemWithKey (iCodehTab, i)) &&
+ (ic->seq >= fseq && ic->seq <= toseq))
+
+ return FALSE;
+
+ }
+
+ return TRUE;
+}
+
+/*-----------------------------------------------------------------*/
+/* notUsedInBlock - not used in this block */
+/*-----------------------------------------------------------------*/
+int
+notUsedInBlock (symbol * sym, eBBlock * ebp, iCode *ic)
+{
+ return (!bitVectBitsInCommon (sym->defs, ebp->usesDefs) &&
+ allDefsOutOfRange (sym->defs, ebp->fSeq, ebp->lSeq) &&
+ allDefsOutOfRange (sym->uses, ebp->fSeq, ebp->lSeq));
+}
+
+
/*-----------------------------------------------------------------*/
/* computeLiveRanges - computes the live ranges for variables */
/*-----------------------------------------------------------------*/
/* compute which overlaps with what */
computeClash();
}
+