* src/SDCClrange.c (rlivePoint): need to mark IC_RESULT used if POINTER_GET op
* src/SDCCopt.c (eBBlockFromiCode),
* src/SDCClrange.c (hashiCodeKeys, sequenceiCode, computeLiveRanges): seperated
the creation of the key hash table from the sequencing so it can be used
earlier (for some GCSE bug fixes still pending)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3021
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2003-11-19 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+ * src/SDCCcse.c (algebraicOpts): fixed bug #773153
+ * src/SDCClrange.c (rlivePoint): need to mark IC_RESULT used if POINTER_GET op
+ * src/SDCCopt.c (eBBlockFromiCode),
+ * src/SDCClrange.c (hashiCodeKeys, sequenceiCode, computeLiveRanges): seperated
+ the creation of the key hash table from the sequencing so it can be used
+ earlier (for some GCSE bug fixes still pending)
+
2003-11-15 Frieder Ferlemann <Frieder.Ferlemann@web.de>
* src/mcs51/gen.c (genPlus): generate shortcut for adding 0xab00
return;
}
/* if addition then check if one of them is a zero */
- /* if yes turn it into assignmnt */
+ /* if yes turn it into assignmnt or cast */
if (IS_OP_LITERAL (IC_LEFT (ic)) &&
operandLitValue (IC_LEFT (ic)) == 0.0)
{
-
- ic->op = '=';
- IC_LEFT (ic) = NULL;
+ if (compareType (operandType (IC_RESULT (ic)),
+ operandType (IC_RIGHT (ic)))<0)
+ {
+ ic->op = CAST;
+ IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
+ }
+ else
+ {
+ ic->op = '=';
+ IC_LEFT (ic) = NULL;
+ }
SET_ISADDR (IC_RESULT (ic), 0);
SET_ISADDR (IC_RIGHT (ic), 0);
return;
if (IS_OP_LITERAL (IC_RIGHT (ic)) &&
operandLitValue (IC_RIGHT (ic)) == 0.0)
{
-
- ic->op = '=';
- IC_RIGHT (ic) = IC_LEFT (ic);
- IC_LEFT (ic) = 0;
+ if (compareType (operandType (IC_RESULT (ic)),
+ operandType (IC_LEFT (ic)))<0)
+ {
+ ic->op = CAST;
+ IC_RIGHT (ic) = IC_LEFT (ic);
+ IC_LEFT (ic) = operandFromLink (operandType (IC_RESULT (ic)));
+ }
+ else
+ {
+ ic->op = '=';
+ IC_RIGHT (ic) = IC_LEFT (ic);
+ IC_LEFT (ic) = NULL;
+ }
SET_ISADDR (IC_RIGHT (ic), 0);
SET_ISADDR (IC_RESULT (ic), 0);
return;
hTab *iCodehTab = NULL;
hTab *iCodeSeqhTab = NULL;
+/*-----------------------------------------------------------------*/
+/* hashiCodeKeys - add all iCodes to the hash table */
+/*-----------------------------------------------------------------*/
+void
+hashiCodeKeys (eBBlock ** ebbs, int count)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ iCode *ic;
+ for (ic = ebbs[i]->sch; ic; ic = ic->next)
+ hTabAddItem (&iCodehTab, ic->key, ic);
+ }
+}
+
/*-----------------------------------------------------------------*/
/* sequenceiCode - creates a sequence number for the iCode & add */
/*-----------------------------------------------------------------*/
{
ic->seq = ++iCodeSeq;
ic->depth = ebbs[i]->depth;
- hTabAddItem (&iCodehTab, ic->key, ic);
+ //hTabAddItem (&iCodehTab, ic->key, ic);
hTabAddItem (&iCodeSeqhTab, ic->seq, ic);
}
ebbs[i]->lSeq = iCodeSeq;
}
}
+ if (POINTER_SET(ic) && IS_SYMOP(IC_RESULT(ic)))
+ incUsed (ic, IC_RESULT(ic));
+
if (IS_ITEMP(IC_RESULT(ic)))
{
unvisitBlocks(ebbs, count);
iCodeSeq = 0;
setToNull ((void *) &iCodehTab);
iCodehTab = newHashTable (iCodeKey);
+ hashiCodeKeys (ebbs, count);
setToNull ((void *) &iCodeSeqhTab);
iCodeSeqhTab = newHashTable (iCodeKey);
sequenceiCode (ebbs, count);
ebbs = iCodeBreakDown (ic, &count);
saveCount = count;
+ /* hash the iCode keys so that we can quickly index */
+ /* them in the rest of the optimization steps */
+ setToNull ((void *) &iCodehTab);
+ iCodehTab = newHashTable (iCodeKey);
+ hashiCodeKeys (ebbs, count);
+
/* compute the control flow */
computeControlFlow (ebbs, count, 0);