static void
genNearPointerSet (operand * right,
operand * result,
- iCode * ic)
+ iCode * ic,
+ iCode * pi)
{
asmop *aop = NULL;
regs *preg = NULL;
else
rname = aopGet (AOP (result), 0, FALSE, FALSE, FALSE);
- freeAsmop (result, NULL, ic, TRUE);
aopOp (right, ic, FALSE, FALSE);
/* if bitfield then unpack the bits */
}
else
emitcode ("mov", "@%s,%s", rname, l);
- if (size)
+ if (size || pi)
emitcode ("inc", "%s", rname);
offset++;
}
if (aop)
{
/* we had to allocate for this iCode */
+ if (pi) aopPut (AOP (result),rname,0);
freeAsmop (NULL, aop, ic, TRUE);
}
else
if (AOP_SIZE (right) > 1 &&
!OP_SYMBOL (result)->remat &&
(OP_SYMBOL (result)->liveTo > ic->seq ||
- ic->depth))
+ ic->depth) &&
+ !pi)
{
int size = AOP_SIZE (right) - 1;
while (size--)
}
/* done */
+ if (pi) pi->generated = 1;
+ freeAsmop (result, NULL, ic, TRUE);
freeAsmop (right, NULL, ic, TRUE);
static void
genPagedPointerSet (operand * right,
operand * result,
- iCode * ic)
+ iCode * ic,
+ iCode *pi)
{
asmop *aop = NULL;
regs *preg = NULL;
else
rname = aopGet (AOP (result), 0, FALSE, FALSE, FALSE);
- freeAsmop (result, NULL, ic, TRUE);
aopOp (right, ic, FALSE, FALSE);
/* if bitfield then unpack the bits */
MOVA (l);
emitcode ("movx", "@%s,a", rname);
- if (size)
+ if (size || pi)
emitcode ("inc", "%s", rname);
offset++;
/* now some housekeeping stuff */
if (aop)
{
+ if (pi) aopPut (AOP (result),rname,0);
/* we had to allocate for this iCode */
freeAsmop (NULL, aop, ic, TRUE);
}
if (AOP_SIZE (right) > 1 &&
!OP_SYMBOL (result)->remat &&
(OP_SYMBOL (result)->liveTo > ic->seq ||
- ic->depth))
+ ic->depth) &&
+ !pi)
{
int size = AOP_SIZE (right) - 1;
while (size--)
}
/* done */
+ if (pi) pi->generated = 1;
+ freeAsmop (result, NULL, ic, TRUE);
freeAsmop (right, NULL, ic, TRUE);
/*-----------------------------------------------------------------*/
static void
genFarPointerSet (operand * right,
- operand * result, iCode * ic)
+ operand * result, iCode * ic, iCode *pi)
{
int size, offset;
sym_link *retype = getSpec (operandType (right));
}
}
/* so dptr know contains the address */
- freeAsmop (result, NULL, ic, TRUE);
aopOp (right, ic, FALSE, TRUE);
/* if bit then unpack */
_flushLazyDPS ();
emitcode ("movx", "@dptr,a");
- if (size)
+ if (size || pi)
emitcode ("inc", "dptr");
}
_endLazyDPSEvaluation ();
}
+ if (pi && AOP_TYPE (result) != AOP_STR && AOP_TYPE (result) != AOP_IMMD) {
+ aopPut (AOP(result),"dpl",0);
+ aopPut (AOP(result),"dph",1);
+ if (options.model == MODEL_FLAT24)
+ aopPut (AOP(result),"dpx",2);
+ pi->generated=1;
+ }
+ freeAsmop (result, NULL, ic, TRUE);
freeAsmop (right, NULL, ic, TRUE);
}
/*-----------------------------------------------------------------*/
static void
genGenPointerSet (operand * right,
- operand * result, iCode * ic)
+ operand * result, iCode * ic, iCode *pi)
{
int size, offset;
sym_link *retype = getSpec (operandType (right));
_endLazyDPSEvaluation ();
}
/* so dptr know contains the address */
- freeAsmop (result, NULL, ic, TRUE);
aopOp (right, ic, FALSE, TRUE);
/* if bit then unpack */
_flushLazyDPS ();
emitcode ("lcall", "__gptrput");
- if (size)
+ if (size || pi)
emitcode ("inc", "dptr");
}
_endLazyDPSEvaluation ();
}
+ if (pi && AOP_TYPE (result) != AOP_STR && AOP_TYPE (result) != AOP_IMMD) {
+ aopPut (AOP(result),"dpl",0);
+ aopPut (AOP(result),"dph",1);
+ if (options.model == MODEL_FLAT24) {
+ aopPut (AOP(result),"dpx",2);
+ aopPut (AOP(result),"b",3);
+ } else {
+ aopPut (AOP(result),"b",2);
+ }
+ pi->generated=1;
+ }
+ freeAsmop (result, NULL, ic, TRUE);
freeAsmop (right, NULL, ic, TRUE);
}
case POINTER:
case IPOINTER:
- genNearPointerSet (right, result, ic);
+ genNearPointerSet (right, result, ic, pi);
break;
case PPOINTER:
- genPagedPointerSet (right, result, ic);
+ genPagedPointerSet (right, result, ic, pi);
break;
case FPOINTER:
- genFarPointerSet (right, result, ic);
+ genFarPointerSet (right, result, ic, pi);
break;
case GPOINTER:
- genGenPointerSet (right, result, ic);
+ genGenPointerSet (right, result, ic, pi);
break;
}