static int
opIsGptr (operand * op)
{
- sym_link *type = operandType (op);
-
- if ((AOP_SIZE (op) == GPTRSIZE) && IS_GENPTR (type))
+ if (op && IS_GENPTR (operandType (op)) && (AOP_SIZE (op) == GPTRSIZE))
{
return 1;
}
static int
getDataSize (operand * op)
{
- int size;
- size = AOP_SIZE (op);
+ int size = AOP_SIZE (op);
+
if (size == GPTRSIZE)
{
sym_link *type = operandType (op);
}
if (opIsGptr (IC_RESULT (ic)) &&
- AOP_SIZE (IC_LEFT (ic)) < GPTRSIZE &&
- AOP_SIZE (IC_RIGHT (ic)) < GPTRSIZE &&
+ IC_LEFT (ic) && AOP_SIZE (IC_LEFT (ic)) < GPTRSIZE &&
+ IC_RIGHT (ic) && AOP_SIZE (IC_RIGHT (ic)) < GPTRSIZE &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_LEFT (ic))) &&
!sameRegs (AOP (IC_RESULT (ic)), AOP (IC_RIGHT (ic))))
{
}
/* object not on stack then we need the name */
- size = AOP_SIZE (IC_RESULT (ic));
+ size = getDataSize (IC_RESULT (ic));
offset = 0;
while (size--)
{
char s[SDCC_NAME_MAX];
- if (offset) {
+ if (offset)
+ {
switch (offset) {
case 1:
tsprintf(s, sizeof(s), "#!his",sym->rname);
tsprintf(s, sizeof(s), "#!hihihis",sym->rname);
break;
default: /* should not need this (just in case) */
- SNPRINTF (s, sizeof(s), "#(%s >> %d)",
- sym->rname,
- offset * 8);
+ SNPRINTF (s, sizeof(s), "#(%s >> %d)", sym->rname, offset * 8);
}
}
else
aopPut (IC_RESULT (ic), s, offset++);
}
+ if (opIsGptr (IC_RESULT (ic)))
+ {
+ char buffer[10];
+ SNPRINTF (buffer, sizeof(buffer), "#0x%02x",
+ pointerTypeToGPByte (pointerCode (getSpec (operandType (IC_LEFT (ic)))), NULL, NULL));
+ aopPut (IC_RESULT (ic), buffer, GPTRSIZE - 1);
+ }
release:
freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
/* bit variables done */
/* general case */
- size = AOP_SIZE (result);
+ size = getDataSize (result);
offset = 0;
if (AOP_TYPE (right) == AOP_LIT)
lit = ulFromVal (AOP (right)->aopu.aop_lit);
}
_endLazyDPSEvaluation ();
}
+ adjustArithmeticResult (ic);
release:
freeAsmop (result, NULL, ic, TRUE);