+2003-05-29 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/pic/device.c: added 16F819, patch by "David I. Lehn" <dlehn@vt.edu>
+ * src/SDCCcse.c (algebraicOpts): fixed "c * 1"
+
2003-05-28 Bernhard Held <bernhard@bernhardheld.de>
* doc/sdccman.lyx: fix double dash and other minor things
/* if the result is volatile then return result */
if (IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
*opp = IC_RESULT (cdp->diCode);
- else
+ else
/* if this is a straight assignment and
left is a temp then prefer the temporary to the
true symbol */
iCode *lic;
for (lic = ic; lic ; lic = lic->prev) {
- if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
+ if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
return lic;
}
return NULL;
}
if (operandLitValue (IC_LEFT (ic)) == 1.0)
{
- ic->op = '=';
- IC_LEFT (ic) = NULL;
- SET_RESULT_RIGHT (ic);
- return;
+ /* '*' can have two unsigned chars as operands */
+ /* and an unsigned int as result. */
+ if (compareType (operandType (IC_RESULT (ic)),
+ operandType (IC_RIGHT (ic))) == 1)
+ {
+ ic->op = '=';
+ IC_LEFT (ic) = NULL;
+ SET_RESULT_RIGHT (ic);
+ }
+ else
+ {
+ ic->op = CAST;
+ IC_LEFT (ic)->type = TYPE;
+ setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+ }
}
}
if (operandLitValue (IC_RIGHT (ic)) == 1.0)
{
- ic->op = '=';
- IC_RIGHT (ic) = IC_LEFT (ic);
- IC_LEFT (ic) = NULL;
- SET_RESULT_RIGHT (ic);
+ /* '*' can have two unsigned chars as operands */
+ /* and an unsigned int as result. */
+ if (compareType (operandType (IC_RESULT (ic)),
+ operandType (IC_LEFT (ic))) == 1)
+ {
+ ic->op = '=';
+ IC_RIGHT (ic) = IC_LEFT (ic);
+ IC_LEFT (ic) = NULL;
+ SET_RESULT_RIGHT (ic);
+ }
+ else
+ {
+ operand *op;
+
+ ic->op = CAST;
+ op = IC_RIGHT (ic);
+ IC_RIGHT (ic) = IC_LEFT (ic);
+ IC_LEFT (ic) = op;
+ IC_LEFT (ic)->type = TYPE;
+ setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+ }
return;
}
}