/*-----------------------------------------------------------------*/
/* genUnpackBits - generates code for unpacking bits */
/*-----------------------------------------------------------------*/
-static void
+static char*
genUnpackBits (operand * result, char *rname, int ptype, iCode *ifx)
{
int offset = 0; /* result byte offset */
sym_link *etype; /* bitfield type information */
int blen; /* bitfield length */
int bstr; /* bitfield starting bit within byte */
- char buffer[10];
+ static char* const accBits[] = {"acc.0", "acc.1", "acc.2", "acc.3",
+ "acc.4", "acc.5", "acc.6", "acc.7"};
D(emitcode (";", "genUnpackBits"));
emitPtrByteGet (rname, ptype, FALSE);
if (blen == 1)
{
- SNPRINTF (buffer, sizeof(buffer),
- "acc.%d", bstr);
- genIfxJump (ifx, buffer, NULL, NULL, NULL);
+ return accBits[bstr];;
}
else
{
if (blen < 8)
emitcode ("anl", "a,#0x%02x",
(((unsigned char) -1) >> (8 - blen)) << bstr);
- genIfxJump (ifx, "a", NULL, NULL, NULL);
+ return "a";
}
- return;
}
wassert (!ifx);
while (rsize--)
aopPut (result, source, offset++);
}
+ return NULL;
}
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
+ char *ifxCond = "a";
sym_link *rtype, *retype;
sym_link *ltype = operandType (left);
- char buffer[80];
D (emitcode (";", "genNearPointerGet"));
return;
}
+ //aopOp (result, ic, FALSE);
+ aopOp (result, ic, result?TRUE:FALSE);
+
/* if the value is already in a pointer register
then don't need anything more */
if (!AOP_INPREG (AOP (left)))
else
rname = aopGet (left, 0, FALSE, FALSE);
- //aopOp (result, ic, FALSE);
- aopOp (result, ic, result?TRUE:FALSE);
-
/* if bitfield then unpack the bits */
if (IS_BITFIELD (retype))
- genUnpackBits (result, rname, POINTER, ifx);
+ ifxCond = genUnpackBits (result, rname, POINTER, ifx);
else
{
/* we have can just get the values */
}
else
{
+ char buffer[80];
+
SNPRINTF (buffer, sizeof(buffer), "@%s", rname);
aopPut (result, buffer, offset);
}
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
/* done */
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
+ char *ifxCond = "a";
sym_link *rtype, *retype;
D (emitcode (";", "genPagedPointerGet"));
aopOp (left, ic, FALSE);
+ aopOp (result, ic, FALSE);
+
/* if the value is already in a pointer register
then don't need anything more */
if (!AOP_INPREG (AOP (left)))
else
rname = aopGet (left, 0, FALSE, FALSE);
- aopOp (result, ic, FALSE);
-
/* if bitfield then unpack the bits */
if (IS_BITFIELD (retype))
- genUnpackBits (result, rname, PPOINTER, ifx);
+ ifxCond = genUnpackBits (result, rname, PPOINTER, ifx);
else
{
/* we have can just get the values */
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
/* done */
operand * result, iCode * ic, iCode * pi, iCode * ifx)
{
int size, offset;
+ char *ifxCond = "a";
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genFarPointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
- genUnpackBits (result, "dptr", FPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", FPOINTER, ifx);
else
{
size = AOP_SIZE (result);
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
+ char *ifxCond = "a";
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genCodePointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
- genUnpackBits (result, "dptr", CPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", CPOINTER, ifx);
else
{
size = AOP_SIZE (result);
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
+ char *ifxCond = "a";
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genGenPointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
{
- genUnpackBits (result, "dptr", GPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", GPOINTER, ifx);
}
else
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
if size > 0 && this could be used again
we have to point it back to where it
belongs */
- if ((AOP_SIZE (right) > 1 &&
+ if (AOP_SIZE (right) > 1 &&
!OP_SYMBOL (result)->remat &&
- (OP_SYMBOL (result)->liveTo > ic->seq ||
- ic->depth)) &&
+ (OP_SYMBOL (result)->liveTo > ic->seq || ic->depth) &&
!pi)
{
int size = AOP_SIZE (right) - 1;