void ReplaceOpWithCheaperOp(operand **op, operand *cop) {
#ifdef RANGEHUNT
- printf ("ReplaceOpWithCheaperOp %s with %s: ",
- IS_SYMOP((*op)) ? OP_SYMBOL((*op))->name : "!SYM",
- IS_SYMOP(cop) ? OP_SYMBOL(cop)->name : "!SYM");
+ printf ("ReplaceOpWithCheaperOp\n\t");
+ printOperand (*op, stdout);
+ printf ("\nwith\t");
+ printOperand (cop, stdout);
+
// if op is a register equivalent
if (IS_ITEMP(cop) && IS_SYMOP((*op)) && OP_SYMBOL((*op))->isreqv) {
operand **rop = &OP_SYMBOL((*op))->usl.spillLoc->reqv;
{
iCode *lic;
+#ifdef RANGEHUNT
+ printf ("replaceAllSymBySym\n\t");
+ printOperand (from, stdout);
+ printf ("\nwith\t");
+ printOperand (to, stdout);
+ printf ("\n");
+#endif
for (lic = ic; lic; lic = lic->next)
{
int siaddr;
(*opp)->isaddr = cop->isaddr;
}
+ /* copy signedness to literal operands */
+ if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp))
+ && isOperandLiteral(*opp)
+ && SPEC_NOUN(operandType(*opp)) == SPEC_NOUN(operandType(cop))
+ && SPEC_USIGN(operandType(*opp)) != SPEC_USIGN(operandType(cop)))
+ {
+ SPEC_USIGN(operandType(*opp)) = SPEC_USIGN(operandType(cop));
+ }
+
if (IS_SPEC(operandType (cop)) && IS_SPEC(operandType (*opp)) &&
SPEC_NOUN(operandType(cop)) != SPEC_NOUN(operandType(*opp)))
{
getSize (operandType (IC_RIGHT (cdp->diCode))) ==
getSize (operandType (rop)))
{
+ if (IS_SPEC (operandType (IC_RIGHT (cdp->diCode))) &&
+ SPEC_USIGN (operandType (IC_RIGHT (cdp->diCode))) !=
+ SPEC_USIGN (operandType (rop)))
+ {
+ /* bug #1493710
+ Reminder for Bernhard: check of signedness
+ could be unnecessary together with 'checkSign', if
+ signedness of operation is stored in ic */
+ return 0;
+ }
*opp = IC_RIGHT (cdp->diCode);
return 1;
}