case '*':
if (IS_OP_LITERAL (IC_LEFT (ic)))
{
+ double leftValue = operandLitValue (IC_LEFT (ic));
- if (operandLitValue (IC_LEFT (ic)) == 0.0)
+ if (leftValue == 0.0)
{
ic->op = '=';
IC_RIGHT (ic) = IC_LEFT (ic);
SET_RESULT_RIGHT (ic);
return;
}
- if (operandLitValue (IC_LEFT (ic)) == 1.0)
+ if (leftValue == 1.0)
{
/* '*' can have two unsigned chars as operands */
/* and an unsigned int as result. */
}
return;
}
+ if (leftValue == -1.0)
+ {
+ /* convert -1 * x to -x */
+ ic->op = UNARYMINUS;
+ IC_LEFT (ic) = IC_RIGHT (ic);
+ IC_RIGHT (ic) = NULL;
+ return;
+ }
}
if (IS_OP_LITERAL (IC_RIGHT (ic)))
{
+ double rightValue = operandLitValue (IC_RIGHT (ic));
- if (operandLitValue (IC_RIGHT (ic)) == 0.0)
+ if (rightValue == 0.0)
{
ic->op = '=';
IC_LEFT (ic) = NULL;
return;
}
- if (operandLitValue (IC_RIGHT (ic)) == 1.0)
+ if (rightValue == 1.0)
{
/* '*' can have two unsigned chars as operands */
/* and an unsigned int as result. */
}
return;
}
+ if (rightValue == -1.0)
+ {
+ /* convert x * -1 to -x */
+ ic->op = UNARYMINUS;
+ IC_RIGHT (ic) = NULL;
+ return;
+ }
}
break;
case '/':
{
iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
}
{
iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
}
default:
return;
}
- if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
+ if (((unsigned) double2ul (operandLitValue (IC_RIGHT (ic))) & val) == val)
{
ic->op = '=';
IC_RIGHT (ic) = IC_LEFT (ic);
{
iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
}
default:
return;
}
- if (((unsigned) operandLitValue (IC_RIGHT (ic)) & val) == val)
+ if (((unsigned) double2ul (operandLitValue (IC_RIGHT (ic))) & val) == val)
{
if (IS_OP_VOLATILE (IC_LEFT (ic)))
{
iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
}
{
iCode *newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
newic = newiCode (DUMMY_READ_VOLATILE, NULL, IC_LEFT (ic));
IC_RESULT (newic) = IC_LEFT (ic);
+ newic->filename = ic->filename;
newic->lineno = ic->lineno;
addiCodeToeBBlock (ebp, newic, ic->next);
}
/* and also iTemps derived from globals */
deleteItemIf (&cseSet, ifFromGlobal);
-
+
/* Delete iTemps derived from symbols whose address */
/* has been taken */
deleteItemIf (&cseSet, ifFromAddrTaken);
mine and type is a pointer then delete
pointerGets to take care of aliasing */
if (ASSIGNMENT (ic) &&
- IS_SYMOP (IC_RESULT (ic)) &&
+ IS_SYMOP (IC_RESULT (ic)) &&
OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic))) &&
IS_PTR (operandType (IC_RESULT (ic))))
{