/* if we need ptr regs for the right side
then mark it */
- if (POINTER_GET(ic) && getSize(OP_SYMBOL(IC_LEFT(ic))->type)
+ if (POINTER_GET(ic) && IS_SYMOP(IC_LEFT(ic))
+ && getSize(OP_SYMBOL(IC_LEFT(ic))->type)
<= PTRSIZE)
{
mcs51_ptrRegReq++;
/*-----------------------------------------------------------------*/
static int packRegsForAssign (iCode *ic,eBBlock *ebp)
{
- iCode *dic, *sic;
-
+ iCode *dic, *sic;
+ link *etype = operandType(IC_RIGHT(ic));
+
if (!IS_ITEMP(IC_RIGHT(ic)) ||
OP_SYMBOL(IC_RIGHT(ic))->isind ||
- OP_LIVETO(IC_RIGHT(ic)) > ic->seq) {
+ OP_LIVETO(IC_RIGHT(ic)) > ic->seq ||
+ IS_BITFIELD(etype)) {
return 0;
}
if (!dic)
return 0 ; /* did not find */
-
+
+ /* if assignment then check that right is not a bit */
+ if (ASSIGNMENT(dic) && !POINTER_SET(dic)) {
+ link *etype = operandType(IC_RIGHT(dic));
+ if (IS_BITFIELD(etype)) return 0;
+ }
/* if the result is on stack or iaccess then it must be
the same atleast one of the operands */
if (OP_SYMBOL(IC_RESULT(ic))->onStack ||
(IC_RIGHT(dic) &&
IC_RESULT(ic)->key == IC_RIGHT(dic)->key)))
return 0;
- }
+ }
pack:
/* found the definition */
/* replace the result with the result of */
the result of that operation is not on stack then
we can leave the result of this operation in acc:b
combination */
- if ((IS_ARITHMETIC_OP(ic)
-
- || IS_BITWISE_OP(ic)
-
+ if ((IS_ARITHMETIC_OP(ic)
+ || IS_BITWISE_OP(ic)
|| ic->op == LEFT_OP || ic->op == RIGHT_OP
-
+ || (ic->op == ADDRESS_OF && isOperandOnStack(IC_LEFT(ic)))
) &&
IS_ITEMP(IC_RESULT(ic)) &&
getSize(operandType(IC_RESULT(ic))) <= 2)