ifx condition
(genNearPointerGet, genPagedPointerGet, genFarPointerGet,
genCodePointerGet, genGenPointerGet): cleanup aop before generating
ifxJump to fix bug
1838000
* src/SDCCsymt.c (aggregateToPointer): fix problem for xstack
* support/regression/tests/bug1838000.c: new, added
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5054
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-02-27 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/mcs51/gen.c (genUnpackBits): don't generate ifxJump, instead return
+ ifx condition
+ (genNearPointerGet, genPagedPointerGet, genFarPointerGet,
+ genCodePointerGet, genGenPointerGet): cleanup aop before generating
+ ifxJump to fix bug 1838000
+ * src/SDCCsymt.c (aggregateToPointer): fix problem for xstack
+ * support/regression/tests/bug1838000.c: new, added
+
2008-02-25 Maarten Brock <sourceforge.brock AT dse.nl>
* src/mcs51/ralloc.c (isSpiltOnStack): fixed bug 1565152
2008-02-25 Maarten Brock <sourceforge.brock AT dse.nl>
* src/mcs51/ralloc.c (isSpiltOnStack): fixed bug 1565152
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
- * support/regression/tests/bugs-1596270-1736867.c: Regression test for #1596270, #1736867
+ * support/regression/tests/bugs-1596270-1736867.c: Regression test for
+ #1596270, #1736867
2008-02-20 Maarten Brock <sourceforge.brock AT dse.nl>
2008-02-20 Maarten Brock <sourceforge.brock AT dse.nl>
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
- * src/z80/gen.c: fixed bug in register pair loading when swapping register contents,
- mostly fixes #1596270
+ * src/z80/gen.c: fixed bug in register pair loading when swapping register
+ contents, mostly fixes #1596270
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
* src/z80/peeph.def,
2008-02-20 Philipp Klaus Krause <pkk AT spth.de>
* src/z80/peeph.def,
- * src/z80/peeph-z80.def: moved peephole that breaks gbz80 to z80-specific peepholes,
- fixes #1806565
+ * src/z80/peeph-z80.def: moved peephole that breaks gbz80 to z80-specific
+ peepholes, fixes #1806565
2008-02-20 Maarten Brock <sourceforge.brock AT dse.nl>
2008-02-20 Maarten Brock <sourceforge.brock AT dse.nl>
+ DCL_TYPE (val->type) = PTR_TYPE(SPEC_OCLS(val->etype));
+ break;
case S_DATA:
case S_REGISTER:
DCL_TYPE (val->type) = POINTER;
case S_DATA:
case S_REGISTER:
DCL_TYPE (val->type) = POINTER;
/*-----------------------------------------------------------------*/
/* genUnpackBits - generates code for unpacking bits */
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
/* genUnpackBits - generates code for unpacking bits */
/*-----------------------------------------------------------------*/
genUnpackBits (operand * result, char *rname, int ptype, iCode *ifx)
{
int offset = 0; /* result byte offset */
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 */
sym_link *etype; /* bitfield type information */
int blen; /* bitfield length */
int bstr; /* bitfield starting bit within byte */
+ static char* const accBits[] = {"acc.0", "acc.1", "acc.2", "acc.3",
+ "acc.4", "acc.5", "acc.6", "acc.7"};
D(emitcode (";", "genUnpackBits"));
D(emitcode (";", "genUnpackBits"));
emitPtrByteGet (rname, ptype, FALSE);
if (blen == 1)
{
emitPtrByteGet (rname, ptype, FALSE);
if (blen == 1)
{
- SNPRINTF (buffer, sizeof(buffer),
- "acc.%d", bstr);
- genIfxJump (ifx, buffer, NULL, NULL, NULL);
}
else
{
if (blen < 8)
emitcode ("anl", "a,#0x%02x",
(((unsigned char) -1) >> (8 - blen)) << bstr);
}
else
{
if (blen < 8)
emitcode ("anl", "a,#0x%02x",
(((unsigned char) -1) >> (8 - blen)) << bstr);
- genIfxJump (ifx, "a", NULL, NULL, NULL);
while (rsize--)
aopPut (result, source, offset++);
}
while (rsize--)
aopPut (result, source, offset++);
}
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
sym_link *rtype, *retype;
sym_link *ltype = operandType (left);
sym_link *rtype, *retype;
sym_link *ltype = operandType (left);
D (emitcode (";", "genNearPointerGet"));
D (emitcode (";", "genNearPointerGet"));
+ //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)))
/* 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);
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))
/* 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
{
/* we have can just get the values */
SNPRINTF (buffer, sizeof(buffer), "@%s", rname);
aopPut (result, buffer, offset);
}
SNPRINTF (buffer, sizeof(buffer), "@%s", rname);
aopPut (result, buffer, offset);
}
if (ifx && !ifx->generated)
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
asmop *aop = NULL;
regs *preg = NULL;
char *rname;
sym_link *rtype, *retype;
D (emitcode (";", "genPagedPointerGet"));
sym_link *rtype, *retype;
D (emitcode (";", "genPagedPointerGet"));
+ aopOp (result, ic, FALSE);
+
/* if the value is already in a pointer register
then don't need anything more */
if (!AOP_INPREG (AOP (left)))
/* 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);
else
rname = aopGet (left, 0, FALSE, FALSE);
- aopOp (result, ic, FALSE);
-
/* if bitfield then unpack the bits */
if (IS_BITFIELD (retype))
/* 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 */
else
{
/* we have can just get the values */
if (ifx && !ifx->generated)
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
operand * result, iCode * ic, iCode * pi, iCode * ifx)
{
int size, offset;
operand * result, iCode * ic, iCode * pi, iCode * ifx)
{
int size, offset;
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genFarPointerGet"));
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genFarPointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
/* if bit then unpack */
if (IS_BITFIELD (retype))
- genUnpackBits (result, "dptr", FPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", FPOINTER, ifx);
else
{
size = AOP_SIZE (result);
else
{
size = AOP_SIZE (result);
if (ifx && !ifx->generated)
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
}
freeAsmop (result, NULL, ic, TRUE);
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genCodePointerGet"));
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genCodePointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
/* if bit then unpack */
if (IS_BITFIELD (retype))
- genUnpackBits (result, "dptr", CPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", CPOINTER, ifx);
else
{
size = AOP_SIZE (result);
else
{
size = AOP_SIZE (result);
if (ifx && !ifx->generated)
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
}
freeAsmop (result, NULL, ic, TRUE);
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
operand * result, iCode * ic, iCode *pi, iCode *ifx)
{
int size, offset;
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genGenPointerGet"));
sym_link *retype = getSpec (operandType (result));
D (emitcode (";", "genGenPointerGet"));
/* if bit then unpack */
if (IS_BITFIELD (retype))
{
/* if bit then unpack */
if (IS_BITFIELD (retype))
{
- genUnpackBits (result, "dptr", GPOINTER, ifx);
+ ifxCond = genUnpackBits (result, "dptr", GPOINTER, ifx);
if (ifx && !ifx->generated)
{
if (ifx && !ifx->generated)
{
- genIfxJump (ifx, "a", left, NULL, result);
+ genIfxJump (ifx, ifxCond, left, NULL, result);
}
freeAsmop (result, NULL, ic, TRUE);
}
freeAsmop (result, NULL, ic, TRUE);
if size > 0 && this could be used again
we have to point it back to where it
belongs */
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)->remat &&
- (OP_SYMBOL (result)->liveTo > ic->seq ||
- ic->depth)) &&
+ (OP_SYMBOL (result)->liveTo > ic->seq || ic->depth) &&
!pi)
{
int size = AOP_SIZE (right) - 1;
!pi)
{
int size = AOP_SIZE (right) - 1;
--- /dev/null
+/*\r
+ bug 1838000\r
+*/\r
+\r
+#include <testfwk.h>\r
+\r
+#ifdef SDCC\r
+ #include <sdcc-lib.h>\r
+#else\r
+ #define _AUTOMEM\r
+ #define _STATMEM\r
+#endif\r
+\r
+typedef struct { char b:1; } t;\r
+t glbl = { 0 };\r
+t _STATMEM * gp = &glbl;\r
+\r
+void func(char _AUTOMEM *p)\r
+{\r
+ *p++ = gp->b ? 'A' : 'B';\r
+ *p = 'C';\r
+}\r
+\r
+void\r
+testBug(void)\r
+{\r
+ char x[2];\r
+ func(x);\r
+ ASSERT(x[0]=='B');\r
+}\r