{
if (!n)
{
- emitcode(";", "Select standard DPTR");
emitcode("mov", "dps, #0x00");
}
else
{
- emitcode(";", "Select alternate DPTR");
emitcode("mov", "dps, #0x01");
}
}
/*-----------------------------------------------------------------*/
/* aopGet - for fetching value of the aop */
+/*
+ * Set canClobberACC if you are aure it is OK to clobber the value
+ * in the accumulator. Set it FALSE otherwise; FALSE is always safe,
+ * just less efficient.
/*-----------------------------------------------------------------*/
-static char *aopGet (asmop *aop, int offset, bool bit16, bool dname)
+
+static char *aopGet (asmop *aop,
+ int offset,
+ bool bit16,
+ bool dname,
+ bool canClobberACC)
{
char *s = buffer ;
char *rs;
if (aop->type == AOP_DPTR2)
{
genSetDPTR(1);
- emitcode("xch", "a, ap");
+
+#ifndef KEVIN_BROKE_IT
+ if (!canClobberACC)
+#endif
+ {
+ emitcode("xch", "a, ap");
+ }
}
while (offset > aop->coff) {
if (aop->type == AOP_DPTR2)
{
- emitcode("xch", "a, ap");
- genSetDPTR(0);
- return "ap";
+ genSetDPTR(0);
+
+#ifndef KEVIN_BROKE_IT
+ if (!canClobberACC)
+#endif
+ {
+ emitcode("xch", "a, ap");
+ return "ap";
+ }
}
return (dname ? "acc" : "a");
* thus avoiding touching A right before the div. \
*/ \
D(emitcode(";", "DS80C390 div bug: rearranged ops.");); \
- L = aopGet(AOP(LEFT),0,FALSE,FALSE); \
+ L = aopGet(AOP(LEFT),0,FALSE,FALSE,TRUE); \
MOVA(L); \
- emitcode("mov","b,%s",aopGet(AOP(RIGHT),0,FALSE,FALSE));\
+ emitcode("mov","b,%s",aopGet(AOP(RIGHT),0,FALSE,FALSE,FALSE));\
} \
else \
{ \
/* Just stuff in a nop after loading A. */ \
- emitcode("mov","b,%s",aopGet(AOP(RIGHT),0,FALSE,FALSE));\
- L = aopGet(AOP(LEFT),0,FALSE,FALSE); \
+ emitcode("mov","b,%s",aopGet(AOP(RIGHT),0,FALSE,FALSE,FALSE));\
+ L = aopGet(AOP(LEFT),0,FALSE,FALSE,TRUE); \
MOVA(L); \
emitcode("nop", "; workaround for DS80C390 div bug."); \
}
size = AOP_SIZE(op) - 1;
offset = 1;
- l = aopGet(op->aop,offset++,FALSE,FALSE);
+ l = aopGet(op->aop,offset++,FALSE,FALSE,TRUE);
MOVA(l);
while(size--) {
emitcode("orl","a,%s",
aopGet(op->aop,
- offset++,FALSE,FALSE));
+ offset++,FALSE,FALSE,FALSE));
}
tlbl = newiTempLabel(NULL);
if (AOP_NEEDSACC(oper))
{
emitcode("push", "b");
- emitcode("mov", "b, %s", aopGet(AOP(oper),0,FALSE,FALSE));
+ emitcode("mov", "b, %s", aopGet(AOP(oper),0,FALSE,FALSE,FALSE));
}
else
{
- MOVA(aopGet(AOP(oper),0,FALSE,FALSE));
+ MOVA(aopGet(AOP(oper),0,FALSE,FALSE,TRUE));
}
while (size--)
{
if (AOP_NEEDSACC(oper))
{
- emitcode("orl","b,%s",aopGet(AOP(oper),offset++,FALSE,FALSE));
+ emitcode("orl","b,%s",aopGet(AOP(oper),offset++,FALSE,FALSE,FALSE));
}
else
{
- emitcode("orl","a,%s",aopGet(AOP(oper),offset++,FALSE,FALSE));
+ emitcode("orl","a,%s",aopGet(AOP(oper),offset++,FALSE,FALSE,FALSE));
}
}
size = AOP_SIZE(IC_RESULT(ic));
while (size--) {
- char *l = aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE);
+ char *l = aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("cpl","a");
aopPut(AOP(IC_RESULT(ic)),"a",offset++);
char *l;
/* for this we just need to flip the
first it then copy the rest in place */
- size = AOP_SIZE(op) - 1;
- l = aopGet(AOP(op),3,FALSE,FALSE);
-
D(emitcode(";", "genUminusFloat"););
-
+
+ size = AOP_SIZE(op) - 1;
+ l = aopGet(AOP(op),3,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("cpl","acc.7");
while(size--) {
aopPut(AOP(result),
- aopGet(AOP(op),offset,FALSE,FALSE),
+ aopGet(AOP(op),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
offset = 0 ;
//CLRC ;
while(size--) {
- char *l = aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE);
+ char *l = aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,TRUE);
if (!strcmp(l,"a")) {
if (offset==0)
SETC;
{
int offset = 0;
while (size--) {
- char *l = aopGet(AOP(oper),offset++,FALSE,TRUE);
+ char *l = aopGet(AOP(oper),offset++,FALSE,TRUE,FALSE);
if (AOP_TYPE(oper) != AOP_REG &&
AOP_TYPE(oper) != AOP_DIR &&
strcmp(l,"a") ) {
while(size--) {
char *l = aopGet(AOP(IC_LEFT(ic)),
- offset++,FALSE,FALSE);
+ offset++,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("movx","@%s,a",r->name);
emitcode("inc","%s",r->name);
size = AOP_SIZE(IC_LEFT(ic));
/* push it on the stack */
while(size--) {
- l = aopGet(AOP(IC_LEFT(ic)),offset++,FALSE,TRUE);
+ l = aopGet(AOP(IC_LEFT(ic)),offset++,FALSE,TRUE,TRUE);
if (*l == '#') {
MOVA(l);
l = "acc";
size = AOP_SIZE(IC_LEFT(ic));
while (size--) {
- l = aopGet(AOP(IC_LEFT(ic)),offset++,FALSE,TRUE);
+ l = aopGet(AOP(IC_LEFT(ic)),offset++,FALSE,TRUE,FALSE);
if (AOP_TYPE(IC_LEFT(ic)) != AOP_REG &&
AOP_TYPE(IC_LEFT(ic)) != AOP_DIR &&
strcmp(l,"a") ) {
offset = (size-1);
while (size--)
emitcode("pop","%s",aopGet(AOP(IC_LEFT(ic)),offset--,
- FALSE,TRUE));
+ FALSE,TRUE,TRUE));
freeAsmop(IC_LEFT(ic),NULL,ic,TRUE);
}
size = AOP_SIZE(IC_LEFT(sic));
while (size--) {
char *l = aopGet(AOP(IC_LEFT(sic)),offset,
- FALSE, FALSE);
+ FALSE, FALSE, FALSE);
if (strcmp(l,fReturn[offset]))
emitcode("mov","%s,%s",
fReturn[offset],
size = AOP_SIZE(IC_LEFT(sic));
while (size--) {
char *l = aopGet(AOP(IC_LEFT(sic)),offset,
- FALSE,FALSE);
+ FALSE,FALSE,FALSE);
if (strcmp(l,fReturn[offset]))
emitcode("mov","%s,%s",
fReturn[offset],
while (size--) {
char *l ;
if (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR) {
- /* #NOCHANGE */
l = aopGet(AOP(IC_LEFT(ic)),offset++,
- FALSE,TRUE);
+ FALSE,TRUE,FALSE);
emitcode("push","%s",l);
pushed++;
} else {
l = aopGet(AOP(IC_LEFT(ic)),offset,
- FALSE,FALSE);
+ FALSE,FALSE,FALSE);
if (strcmp(fReturn[offset],l))
emitcode("mov","%s,%s",fReturn[offset++],l);
}
tlbl = newiTempLabel(NULL);
emitTlbl = 1;
}
- emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE));
+ emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE));
if(AOP_TYPE(IC_RESULT(ic)) == AOP_REG ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0x00,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE)
,tlbl->key+100);
else {
emitcode("clr","a");
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE)
,tlbl->key+100);
}
- emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE));
+ emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE));
if (size > 2)
{
if(AOP_TYPE(IC_RESULT(ic)) == AOP_REG ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0x00,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE)
,tlbl->key+100);
else
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE)
,tlbl->key+100);
- emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE));
+ emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE));
}
if (size > 3)
{
if(AOP_TYPE(IC_RESULT(ic)) == AOP_REG ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0x00,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE)
,tlbl->key+100);
else{
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE)
,tlbl->key+100);
}
- emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB32,FALSE,FALSE));
+ emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB32,FALSE,FALSE,FALSE));
}
if (emitTlbl)
sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) ) {
if (icount > 3) {
- MOVA(aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE));
+ MOVA(aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE,TRUE));
emitcode("add","a,#0x%02x",((char) icount) & 0xff);
aopPut(AOP(IC_RESULT(ic)),"a",0);
} else {
while (icount--)
- emitcode ("inc","%s",aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE));
+ emitcode ("inc","%s",aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE,FALSE));
}
return TRUE ;
}
}
-
-
-#if 0
-/* This is the original version of this code.
- *
- * This is being kept around for reference,
- * because I am not entirely sure I got it right...
- */
-static void adjustArithmeticResult(iCode *ic)
-{
- if (AOP_SIZE(IC_RESULT(ic)) == 3 &&
- AOP_SIZE(IC_LEFT(ic)) == 3 &&
- !sameRegs(AOP(IC_RESULT(ic)),AOP(IC_LEFT(ic))))
- aopPut(AOP(IC_RESULT(ic)),
- aopGet(AOP(IC_LEFT(ic)),2,FALSE,FALSE),
- 2);
-
- if (AOP_SIZE(IC_RESULT(ic)) == 3 &&
- AOP_SIZE(IC_RIGHT(ic)) == 3 &&
- !sameRegs(AOP(IC_RESULT(ic)),AOP(IC_RIGHT(ic))))
- aopPut(AOP(IC_RESULT(ic)),
- aopGet(AOP(IC_RIGHT(ic)),2,FALSE,FALSE),
- 2);
-
- if (AOP_SIZE(IC_RESULT(ic)) == 3 &&
- AOP_SIZE(IC_LEFT(ic)) < 3 &&
- AOP_SIZE(IC_RIGHT(ic)) < 3 &&
- !sameRegs(AOP(IC_RESULT(ic)),AOP(IC_LEFT(ic))) &&
- !sameRegs(AOP(IC_RESULT(ic)),AOP(IC_RIGHT(ic)))) {
- char buffer[5];
- sprintf(buffer,"#%d",pointerCode(getSpec(operandType(IC_LEFT(ic)))));
- aopPut(AOP(IC_RESULT(ic)),buffer,2);
- }
-}
-#else
-/* This is the pure and virtuous version of this code.
- * I'm pretty certain it's right, but not enough to toss the old
- * code just yet...
- */
static void adjustArithmeticResult(iCode *ic)
{
if (opIsGptr(IC_RESULT(ic)) &&
!sameRegs(AOP(IC_RESULT(ic)),AOP(IC_LEFT(ic))))
{
aopPut(AOP(IC_RESULT(ic)),
- aopGet(AOP(IC_LEFT(ic)), GPTRSIZE - 1,FALSE,FALSE),
+ aopGet(AOP(IC_LEFT(ic)), GPTRSIZE - 1,FALSE,FALSE,FALSE),
GPTRSIZE - 1);
}
!sameRegs(AOP(IC_RESULT(ic)),AOP(IC_RIGHT(ic))))
{
aopPut(AOP(IC_RESULT(ic)),
- aopGet(AOP(IC_RIGHT(ic)),GPTRSIZE - 1,FALSE,FALSE),
+ aopGet(AOP(IC_RIGHT(ic)),GPTRSIZE - 1,FALSE,FALSE,FALSE),
GPTRSIZE - 1);
}
aopPut(AOP(IC_RESULT(ic)),buffer,GPTRSIZE - 1);
}
}
-#endif
#define AOP_OP_3(ic) \
aopOp (IC_LEFT(ic),ic,FALSE, FALSE); \
} else {
size = getDataSize(IC_RESULT(ic));
while (size--) {
- MOVA(aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE,TRUE));
emitcode("addc","a,#00");
aopPut(AOP(IC_RESULT(ic)),"a",offset++);
}
while(size--){
if (AOP_TYPE(IC_LEFT(ic)) == AOP_ACC) {
- MOVA(aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,TRUE));
if(offset == 0)
emitcode("add","a,%s",
- aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE));
+ aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE,FALSE));
else
emitcode("addc","a,%s",
- aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE));
+ aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE,FALSE));
} else {
- MOVA(aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE,TRUE));
if(offset == 0)
emitcode("add","a,%s",
- aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE));
+ aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,FALSE));
else
emitcode("addc","a,%s",
- aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE));
+ aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,FALSE));
}
if (!pushResult)
{
emitTlbl = 1;
}
- emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE));
+ emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE));
if(AOP_TYPE(IC_RESULT(ic)) == AOP_REG ||
AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0xff,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE)
,tlbl->key+100);
else{
emitcode("mov","a,#0xff");
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),LSB,FALSE,FALSE,FALSE)
,tlbl->key+100);
}
- emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE));
+ emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE));
if (size > 2)
{
if(AOP_TYPE(IC_RESULT(ic)) == AOP_REG ||
AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0xff,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE)
,tlbl->key+100);
else{
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE,FALSE,FALSE)
,tlbl->key+100);
}
- emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE));
+ emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE));
}
if (size > 3)
{
AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR ||
IS_AOP_PREG(IC_RESULT(ic)))
emitcode("cjne","%s,#0xff,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE)
,tlbl->key+100);
else{
emitcode("cjne","a,%s,%05d$"
- ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE)
+ ,aopGet(AOP(IC_RESULT(ic)),MSB24,FALSE,FALSE,FALSE)
,tlbl->key+100);
}
- emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB32,FALSE,FALSE));
+ emitcode("dec","%s",aopGet(AOP(IC_RESULT(ic)),MSB32,FALSE,FALSE,FALSE));
}
if (emitTlbl)
{
sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic)))) {
while (icount--)
- emitcode ("dec","%s",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
+ emitcode ("dec","%s",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE,FALSE));
return TRUE ;
}
/* if literal, add a,#-lit, else normal subb */
while (size--) {
- MOVA(aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE,TRUE));
if (AOP_TYPE(IC_RIGHT(ic)) != AOP_LIT)
emitcode("subb","a,%s",
- aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE));
+ aopGet(AOP(IC_RIGHT(ic)),offset,FALSE,FALSE,FALSE));
else{
/* first add without previous c */
if(!offset)
size = AOP_SIZE(result);
/* signed or unsigned */
- emitcode("mov","b,%s", aopGet(AOP(right),0,FALSE,FALSE));
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ emitcode("mov","b,%s", aopGet(AOP(right),0,FALSE,FALSE,FALSE));
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("mul","ab");
/* if result size = 1, mul signed = mul unsigned */
/* AND literal negative */
if((int) floatFromVal (AOP(right)->aopu.aop_lit) < 0){
/* adjust MSB (c==0 after mul) */
- emitcode("subb","a,%s", aopGet(AOP(left),0,FALSE,FALSE));
+ emitcode("subb","a,%s", aopGet(AOP(left),0,FALSE,FALSE,FALSE));
}
}
else{
lbl = newiTempLabel(NULL);
- emitcode("xch","a,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("xch","a,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("cjne","a,#0x80,%05d$", (lbl->key+100));
emitcode("","%05d$:",(lbl->key+100));
- emitcode("xch","a,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("xch","a,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
lbl = newiTempLabel(NULL);
emitcode("jc","%05d$",(lbl->key+100));
- emitcode("subb","a,%s", aopGet(AOP(left),0,FALSE,FALSE));
+ emitcode("subb","a,%s", aopGet(AOP(left),0,FALSE,FALSE,FALSE));
emitcode("","%05d$:",(lbl->key+100));
}
lbl = newiTempLabel(NULL);
- emitcode("xch","a,%s",aopGet(AOP(left),0,FALSE,FALSE));
+ emitcode("xch","a,%s",aopGet(AOP(left),0,FALSE,FALSE,FALSE));
emitcode("cjne","a,#0x80,%05d$", (lbl->key+100));
emitcode("","%05d$:",(lbl->key+100));
- emitcode("xch","a,%s",aopGet(AOP(left),0,FALSE,FALSE));
+ emitcode("xch","a,%s",aopGet(AOP(left),0,FALSE,FALSE,FALSE));
lbl = newiTempLabel(NULL);
emitcode("jc","%05d$",(lbl->key+100));
- emitcode("subb","a,%s", aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("subb","a,%s", aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("","%05d$:",(lbl->key+100));
aopPut(AOP(result),"a",1);
/* signed is a little bit more difficult */
/* save the signs of the operands */
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
- emitcode("xrl","a,%s",aopGet(AOP(right),0,FALSE,TRUE));
+ emitcode("xrl","a,%s",aopGet(AOP(right),0,FALSE,TRUE,FALSE));
emitcode("push","acc"); /* save it on the stack */
/* now sign adjust for both left & right */
- l = aopGet(AOP(right),0,FALSE,FALSE);
+ l = aopGet(AOP(right),0,FALSE,FALSE,TRUE);
MOVA(l);
lbl = newiTempLabel(NULL);
emitcode("jnb","acc.7,%05d$",(lbl->key+100));
emitcode("mov","b,a");
/* sign adjust left side */
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
lbl = newiTempLabel(NULL);
/* signed is a little bit more difficult */
/* save the signs of the operands */
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
- emitcode("xrl","a,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("xrl","a,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("push","acc"); /* save it on the stack */
/* now sign adjust for both left & right */
- l = aopGet(AOP(right),0,FALSE,FALSE);
+ l = aopGet(AOP(right),0,FALSE,FALSE,TRUE);
MOVA(l);
lbl = newiTempLabel(NULL);
emitcode("mov","b,a");
/* sign adjust left side */
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
lbl = newiTempLabel(NULL);
(AOP_TYPE(right) == AOP_LIT && AOP_TYPE(left) != AOP_DIR )){
symbol *lbl = newiTempLabel(NULL);
emitcode("cjne","%s,%s,%05d$",
- aopGet(AOP(left),offset,FALSE,FALSE),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
lbl->key+100);
emitcode("","%05d$:",lbl->key+100);
} else {
CLRC;
}
else{
- MOVA(aopGet(AOP(left),AOP_SIZE(left)-1,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),AOP_SIZE(left)-1,FALSE,FALSE,TRUE));
if(!(AOP_TYPE(result) == AOP_CRY && AOP_SIZE(result)) && ifx){
genIfxJump (ifx,"acc.7");
return;
while (size--)
{
emitcode(";", "genCmp #1: %d/%d/%d", size, sign, offset);
- MOVA(aopGet(AOP(left),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offset,FALSE,FALSE,TRUE));
emitcode(";", "genCmp #2");
if (sign && (size == 0))
{
emitcode("push", "acc");
}
emitcode("mov","b,%s",aopGet(AOP(right),offset++,
- FALSE,FALSE));
+ FALSE,FALSE,FALSE));
emitcode("xrl","b,#0x80");
if (AOP_NEEDSACC(right))
{
/* Yuck!! */
emitcode(";", "genCmp #4.1");
emitcode("xch", "a, b");
- MOVA(aopGet(AOP(right),offset++,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset++,FALSE,FALSE,TRUE));
emitcode("xch", "a, b");
s = "b";
}
else
{
emitcode(";", "genCmp #4.2");
- s = aopGet(AOP(right),offset++,FALSE,FALSE);
+ s = aopGet(AOP(right),offset++,FALSE,FALSE,FALSE);
}
emitcode("subb","a,%s",s);
if (AOP_TYPE(right) == AOP_LIT &&
AOP_TYPE(left) != AOP_DIR ) {
while (size--) {
- char *l = aopGet(AOP(left), offset, FALSE, FALSE);
+ char *l = aopGet(AOP(left), offset, FALSE, FALSE,TRUE);
MOVA(l);
emitcode("cjne","a,%s,%05d$",
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
lbl->key+100);
offset++;
}
(AOP_TYPE(left) == AOP_DIR && AOP_TYPE(right) == AOP_LIT) ||
(IS_AOP_PREG(left) && !IS_AOP_PREG(right))) {
while (size--) {
- MOVA(aopGet(AOP(left),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offset,FALSE,FALSE,TRUE));
if((AOP_TYPE(left) == AOP_DIR && AOP_TYPE(right) == AOP_LIT) &&
((unsigned int)((lit >> (offset*8)) & 0x0FFL) == 0))
emitcode("jnz","%05d$",lbl->key+100);
else
emitcode("cjne","a,%s,%05d$",
- aopGet(AOP(right),offset,FALSE,TRUE),
+ aopGet(AOP(right),offset,FALSE,TRUE,FALSE),
lbl->key+100);
offset++;
}
} else {
/* right is a pointer reg need both a & b */
while(size--) {
- char *l = aopGet(AOP(left),offset,FALSE,FALSE);
+ char *l = aopGet(AOP(left),offset,FALSE,FALSE,TRUE);
if(strcmp(l,"b"))
emitcode("mov","b,%s",l);
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("cjne","a,b,%05d$",lbl->key+100);
offset++;
}
emitcode("anl","c,%s",AOP(left)->aopu.aop_dir);
} else {
// c = bit & val;
- MOVA(aopGet(AOP(right),0,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),0,FALSE,FALSE,TRUE));
// c = lsb
emitcode("rrc","a");
emitcode("anl","c,%s",AOP(left)->aopu.aop_dir);
/* left & 2^n */
if(posbit){
posbit--;
- MOVA(aopGet(AOP(left),posbit>>3,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),posbit>>3,FALSE,FALSE,TRUE));
// bit = left & 2^n
if(size)
emitcode("mov","c,acc.%d",posbit&0x07);
emitcode("setb","c");
while(sizel--){
if((bytelit = ((lit >> (offset*8)) & 0x0FFL)) != 0x0L){
- MOVA( aopGet(AOP(left),offset,FALSE,FALSE));
+ MOVA( aopGet(AOP(left),offset,FALSE,FALSE,TRUE));
// byte == 2^n ?
if((posbit = isLiteralBit(bytelit)) != 0)
emitcode("jb","acc.%d,%05d$",(posbit-1)&0x07,tlbl->key+100);
else{
if(bytelit != 0x0FFL)
emitcode("anl","a,%s",
- aopGet(AOP(right),offset,FALSE,TRUE));
+ aopGet(AOP(right),offset,FALSE,TRUE,FALSE));
emitcode("jnz","%05d$",tlbl->key+100);
}
}
aopPut(AOP(result),zero,offset);
else
if (IS_AOP_PREG(result)) {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
- emitcode("anl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
+ emitcode("anl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("anl","%s,%s",
- aopGet(AOP(left),offset,FALSE,TRUE),
- aopGet(AOP(right),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
} else {
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("anl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("anl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
if (IS_AOP_PREG(result)) {
- emitcode("anl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ emitcode("anl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("anl","%s,a",
- aopGet(AOP(left),offset,FALSE,TRUE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
}
}
}
if(size)
emitcode("setb","c");
while(sizer--){
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("anl","a,%s",
- aopGet(AOP(left),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
emitcode("jnz","%05d$",tlbl->key+100);
offset++;
}
if(AOP_TYPE(right) == AOP_LIT){
if((bytelit = (int)((lit >> (offset*8)) & 0x0FFL)) == 0x0FF){
aopPut(AOP(result),
- aopGet(AOP(left),offset,FALSE,FALSE),
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE),
offset);
continue;
} else if(bytelit == 0){
// faster than result <- left, anl result,right
// and better if result is SFR
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("anl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("anl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("anl","a,%s",
- aopGet(AOP(left),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
}
aopPut(AOP(result),"a",offset);
}
continue;
else
if (IS_AOP_PREG(left)) {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
- emitcode("orl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
+ emitcode("orl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("orl","%s,%s",
- aopGet(AOP(left),offset,FALSE,TRUE),
- aopGet(AOP(right),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
} else {
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("orl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("orl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
if (IS_AOP_PREG(left)) {
- emitcode("orl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ emitcode("orl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("orl","%s,a",
- aopGet(AOP(left),offset,FALSE,TRUE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
}
}
}
if(size)
emitcode("setb","c");
while(sizer--){
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("orl","a,%s",
- aopGet(AOP(left),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
emitcode("jnz","%05d$",tlbl->key+100);
offset++;
}
if(AOP_TYPE(right) == AOP_LIT){
if(((lit >> (offset*8)) & 0x0FFL) == 0x00L){
aopPut(AOP(result),
- aopGet(AOP(left),offset,FALSE,FALSE),
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE),
offset);
continue;
}
// faster than result <- left, anl result,right
// and better if result is SFR
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("orl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("orl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("orl","a,%s",
- aopGet(AOP(left),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
}
aopPut(AOP(result),"a",offset);
}
// if val>>1 != 0, result = 1
emitcode("setb","c");
while(sizer){
- MOVA(aopGet(AOP(right),sizer-1,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),sizer-1,FALSE,FALSE,TRUE));
if(sizer == 1)
// test the msb of the lsb
emitcode("anl","a,#0xfe");
continue;
else
if (IS_AOP_PREG(left)) {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
- emitcode("xrl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
+ emitcode("xrl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("xrl","%s,%s",
- aopGet(AOP(left),offset,FALSE,TRUE),
- aopGet(AOP(right),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
} else {
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("xrl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("xrl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
if (IS_AOP_PREG(left)) {
- emitcode("xrl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE));
+ emitcode("xrl","a,%s",aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
aopPut(AOP(result),"a",offset);
} else
emitcode("xrl","%s,a",
- aopGet(AOP(left),offset,FALSE,TRUE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
}
}
}
while(sizer--){
if((AOP_TYPE(right) == AOP_LIT) &&
(((lit >> (offset*8)) & 0x0FFL) == 0x00L)){
- MOVA(aopGet(AOP(left),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offset,FALSE,FALSE,TRUE));
} else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("xrl","a,%s",
- aopGet(AOP(left),offset,FALSE,FALSE));
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
}
emitcode("jnz","%05d$",tlbl->key+100);
offset++;
if(AOP_TYPE(right) == AOP_LIT){
if(((lit >> (offset*8)) & 0x0FFL) == 0x00L){
aopPut(AOP(result),
- aopGet(AOP(left),offset,FALSE,FALSE),
+ aopGet(AOP(left),offset,FALSE,FALSE,FALSE),
offset);
continue;
}
// faster than result <- left, anl result,right
// and better if result is SFR
if (AOP_TYPE(left) == AOP_ACC)
- emitcode("xrl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE));
+ emitcode("xrl","a,%s",aopGet(AOP(right),offset,FALSE,FALSE,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE,FALSE));
+ MOVA(aopGet(AOP(right),offset,FALSE,FALSE,TRUE));
emitcode("xrl","a,%s",
- aopGet(AOP(left),offset,FALSE,TRUE));
+ aopGet(AOP(left),offset,FALSE,TRUE,FALSE));
}
aopPut(AOP(result),"a",offset);
}
offset = size - 1 ;
CLRC;
while (size--) {
- l = aopGet(AOP(left),offset,FALSE,FALSE);
+ l = aopGet(AOP(left),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rrc","a");
if (AOP_SIZE(result) > 1)
/* now we need to put the carry into the
highest order byte of the result */
if (AOP_SIZE(result) > 1) {
- l = aopGet(AOP(result),AOP_SIZE(result)-1,FALSE,FALSE);
+ l = aopGet(AOP(result),AOP_SIZE(result)-1,FALSE,FALSE,TRUE);
MOVA(l);
}
emitcode("mov","acc.7,c");
size = AOP_SIZE(result);
offset = 0 ;
if (size--) {
- l = aopGet(AOP(left),offset,FALSE,FALSE);
+ l = aopGet(AOP(left),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("add","a,acc");
if (AOP_SIZE(result) > 1)
aopPut(AOP(result),"a",offset++);
while (size--) {
- l = aopGet(AOP(left),offset,FALSE,FALSE);
+ l = aopGet(AOP(left),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rlc","a");
if (AOP_SIZE(result) > 1)
/* now we need to put the carry into the
highest order byte of the result */
if (AOP_SIZE(result) > 1) {
- l = aopGet(AOP(result),0,FALSE,FALSE);
+ l = aopGet(AOP(result),0,FALSE,FALSE,TRUE);
MOVA(l);
}
emitcode("mov","acc.0,c");
D(emitcode(";", "genGetHbit "););
/* get the highest order byte into a */
- MOVA(aopGet(AOP(left),AOP_SIZE(left) - 1,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),AOP_SIZE(left) - 1,FALSE,FALSE,TRUE));
if(AOP_TYPE(result) == AOP_CRY){
emitcode("rlc","a");
outBitC(result);
operand *result, int offr,
int shCount, int sign)
{
- MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl,FALSE,FALSE,TRUE));
/* shift right accumulator */
if(sign)
AccSRsh(shCount);
operand *result, int offr, int shCount)
{
char *l;
- l = aopGet(AOP(left),offl,FALSE,FALSE);
+ l = aopGet(AOP(left),offl,FALSE,FALSE,TRUE);
MOVA(l);
/* shift left accumulator */
AccLsh(shCount);
{
char *l;
if(!sameRegs(AOP(left),AOP(result)) || (offl != offr)){
- l = aopGet(AOP(left),offl,FALSE,FALSE);
+ l = aopGet(AOP(left),offl,FALSE,FALSE,FALSE);
if (*l == '@' && (IS_AOP_PREG(result))) {
emitcode("mov","a,%s",l);
if(sameRegs(AOP(result), AOP(left)) &&
((offl + MSB16) == offr)){
/* don't crash result[offr] */
- MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
- emitcode("xch","a,%s", aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl,FALSE,FALSE,TRUE));
+ emitcode("xch","a,%s", aopGet(AOP(left),offl+MSB16,FALSE,FALSE,FALSE));
} else {
movLeft2Result(left,offl, result, offr, 0);
- MOVA(aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl+MSB16,FALSE,FALSE,TRUE));
}
/* ax << shCount (x = lsb(result))*/
- AccAXLsh( aopGet(AOP(result),offr,FALSE,FALSE) , shCount);
+ AccAXLsh( aopGet(AOP(result),offr,FALSE,FALSE,FALSE), shCount);
aopPut(AOP(result),"a",offr+MSB16);
}
if(sameRegs(AOP(result), AOP(left)) &&
((offl + MSB16) == offr)){
/* don't crash result[offr] */
- MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
- emitcode("xch","a,%s", aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl,FALSE,FALSE,TRUE));
+ emitcode("xch","a,%s", aopGet(AOP(left),offl+MSB16,FALSE,FALSE,FALSE));
} else {
movLeft2Result(left,offl, result, offr, 0);
- MOVA(aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl+MSB16,FALSE,FALSE,TRUE));
}
/* a:x >> shCount (x = lsb(result))*/
if(sign)
- AccAXRshS( aopGet(AOP(result),offr,FALSE,FALSE) , shCount);
+ AccAXRshS( aopGet(AOP(result),offr,FALSE,FALSE,FALSE) , shCount);
else
- AccAXRsh( aopGet(AOP(result),offr,FALSE,FALSE) , shCount);
+ AccAXRsh( aopGet(AOP(result),offr,FALSE,FALSE,FALSE) , shCount);
if(getDataSize(result) > 1)
aopPut(AOP(result),"a",offr+MSB16);
}
static void shiftLLeftOrResult (operand *left, int offl,
operand *result, int offr, int shCount)
{
- MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl,FALSE,FALSE,TRUE));
/* shift left accumulator */
AccLsh(shCount);
/* or with result */
- emitcode("orl","a,%s", aopGet(AOP(result),offr,FALSE,FALSE));
+ emitcode("orl","a,%s", aopGet(AOP(result),offr,FALSE,FALSE,FALSE));
/* back to result */
aopPut(AOP(result),"a",offr);
}
static void shiftRLeftOrResult (operand *left, int offl,
operand *result, int offr, int shCount)
{
- MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),offl,FALSE,FALSE,TRUE));
/* shift right accumulator */
AccRsh(shCount);
/* or with result */
- emitcode("orl","a,%s", aopGet(AOP(result),offr,FALSE,FALSE));
+ emitcode("orl","a,%s", aopGet(AOP(result),offr,FALSE,FALSE,FALSE));
/* back to result */
aopPut(AOP(result),"a",offr);
}
int size = AOP_SIZE(result);
if(size >= LSB+offr){
- l = aopGet(AOP(left),LSB,FALSE,FALSE);
+ l = aopGet(AOP(left),LSB,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("add","a,acc");
if (sameRegs(AOP(left),AOP(result)) &&
size >= MSB16+offr && offr != LSB )
emitcode("xch","a,%s",
- aopGet(AOP(left),LSB+offr,FALSE,FALSE));
+ aopGet(AOP(left),LSB+offr,FALSE,FALSE,FALSE));
else
aopPut(AOP(result),"a",LSB+offr);
}
if(size >= MSB16+offr){
if (!(sameRegs(AOP(result),AOP(left)) && size >= MSB16+offr && offr != LSB) ) {
- l = aopGet(AOP(left),MSB16,FALSE,FALSE);
+ l = aopGet(AOP(left),MSB16,FALSE,FALSE,TRUE);
MOVA(l);
}
emitcode("rlc","a");
if (sameRegs(AOP(left),AOP(result)) &&
size >= MSB24+offr && offr != LSB)
emitcode("xch","a,%s",
- aopGet(AOP(left),MSB16+offr,FALSE,FALSE));
+ aopGet(AOP(left),MSB16+offr,FALSE,FALSE,FALSE));
else
aopPut(AOP(result),"a",MSB16+offr);
}
if(size >= MSB24+offr){
if (!(sameRegs(AOP(left),AOP(left)) && size >= MSB24+offr && offr != LSB)) {
- l = aopGet(AOP(left),MSB24,FALSE,FALSE);
+ l = aopGet(AOP(left),MSB24,FALSE,FALSE,TRUE);
MOVA(l);
}
emitcode("rlc","a");
if (sameRegs(AOP(left),AOP(result)) &&
size >= MSB32+offr && offr != LSB )
emitcode("xch","a,%s",
- aopGet(AOP(left),MSB24+offr,FALSE,FALSE));
+ aopGet(AOP(left),MSB24+offr,FALSE,FALSE,FALSE));
else
aopPut(AOP(result),"a",MSB24+offr);
}
if(size > MSB32+offr){
if (!(sameRegs(AOP(result),AOP(left)) && size >= MSB32+offr && offr != LSB)) {
- l = aopGet(AOP(left),MSB32,FALSE,FALSE);
+ l = aopGet(AOP(left),MSB32,FALSE,FALSE,TRUE);
MOVA(l);
}
emitcode("rlc","a");
more that 32 bits make no sense anyway, ( the
largest size of an object can be only 32 bits ) */
- emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("inc","b");
freeAsmop (right,NULL,ic,TRUE);
aopOp(left,ic,FALSE, FALSE);
size = AOP_SIZE(result);
offset=0;
while (size--) {
- l = aopGet(AOP(left),offset,FALSE,TRUE);
+ l = aopGet(AOP(left),offset,FALSE,TRUE,FALSE);
if (*l == '@' && (IS_AOP_PREG(result))) {
emitcode("mov","a,%s",l);
if (size == 1) {
symbol *tlbl1 = newiTempLabel(NULL);
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("sjmp","%05d$",tlbl1->key+100);
emitcode("","%05d$:",tlbl->key+100);
emitcode("sjmp","%05d$",tlbl1->key+100);
emitcode("","%05d$:",tlbl->key+100);
- l = aopGet(AOP(result),offset,FALSE,FALSE);
+ l = aopGet(AOP(result),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("add","a,acc");
aopPut(AOP(result),"a",offset++);
while (--size) {
- l = aopGet(AOP(result),offset,FALSE,FALSE);
+ l = aopGet(AOP(result),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rlc","a");
aopPut(AOP(result),"a",offset++);
{
if(!sign)
emitcode("clr","c");
- MOVA(aopGet(AOP(left),MSB32,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),MSB32,FALSE,FALSE,TRUE));
if(sign)
emitcode("mov","c,acc.7");
emitcode("rrc","a");
/* add sign of "a" */
addSign(result, MSB32, sign);
- MOVA(aopGet(AOP(left),MSB24,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),MSB24,FALSE,FALSE,TRUE));
emitcode("rrc","a");
aopPut(AOP(result),"a",MSB24-offl);
- MOVA(aopGet(AOP(left),MSB16,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),MSB16,FALSE,FALSE,TRUE));
emitcode("rrc","a");
aopPut(AOP(result),"a",MSB16-offl);
if(offl == LSB){
- MOVA(aopGet(AOP(left),LSB,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),LSB,FALSE,FALSE,TRUE));
emitcode("rrc","a");
aopPut(AOP(result),"a",LSB);
}
else if(shCount >= (size * 8)){
if(sign)
/* get sign in acc.7 */
- MOVA(aopGet(AOP(left),size-1,FALSE,FALSE));
+ MOVA(aopGet(AOP(left),size-1,FALSE,FALSE,TRUE));
addSign(result, LSB, sign);
} else{
switch (size) {
more that 32 bits make no sense anyway, ( the
largest size of an object can be only 32 bits ) */
- emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("inc","b");
freeAsmop (right,NULL,ic,TRUE);
aopOp(left,ic,FALSE, FALSE);
size = AOP_SIZE(result);
offset=0;
while (size--) {
- l = aopGet(AOP(left),offset,FALSE,TRUE);
+ l = aopGet(AOP(left),offset,FALSE,TRUE,FALSE);
if (*l == '@' && IS_AOP_PREG(result)) {
emitcode("mov","a,%s",l);
size = AOP_SIZE(result);
offset = size - 1;
- emitcode("mov","a,%s",aopGet(AOP(left),offset,FALSE,FALSE));
+ emitcode("mov","a,%s",aopGet(AOP(left),offset,FALSE,FALSE,FALSE));
emitcode("rlc","a");
emitcode("mov","ov,c");
/* if it is only one byte then */
if (size == 1) {
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("sjmp","%05d$",tlbl1->key+100);
emitcode("","%05d$:",tlbl->key+100);
emitcode("","%05d$:",tlbl->key+100);
emitcode("mov","c,ov");
while (size--) {
- l = aopGet(AOP(result),offset,FALSE,FALSE);
+ l = aopGet(AOP(result),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rrc","a");
aopPut(AOP(result),"a",offset--);
more that 32 bits make no sense anyway, ( the
largest size of an object can be only 32 bits ) */
- emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE));
+ emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE,FALSE));
emitcode("inc","b");
freeAsmop (right,NULL,ic,TRUE);
aopOp(left,ic,FALSE, FALSE);
size = AOP_SIZE(result);
offset=0;
while (size--) {
- l = aopGet(AOP(left),offset,FALSE,TRUE);
+ l = aopGet(AOP(left),offset,FALSE,TRUE,FALSE);
if (*l == '@' && IS_AOP_PREG(result)) {
emitcode("mov","a,%s",l);
/* if it is only one byte then */
if (size == 1) {
- l = aopGet(AOP(left),0,FALSE,FALSE);
+ l = aopGet(AOP(left),0,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("sjmp","%05d$",tlbl1->key+100);
emitcode("","%05d$:",tlbl->key+100);
emitcode("","%05d$:",tlbl->key+100);
CLRC;
while (size--) {
- l = aopGet(AOP(result),offset,FALSE,FALSE);
+ l = aopGet(AOP(result),offset,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rrc","a");
aopPut(AOP(result),"a",offset--);
aopOp(result,ic,TRUE, FALSE);
/* get the string representation of the name */
- l = aopGet(AOP(left),0,FALSE,TRUE);
+ l = aopGet(AOP(left),0,FALSE,TRUE,FALSE);
size = AOP_SIZE(result);
while (size--) {
if (offset)
preg = getFreePtr(ic,&aop,FALSE);
emitcode("mov","%s,%s",
preg->name,
- aopGet(AOP(left),0,FALSE,TRUE));
+ aopGet(AOP(left),0,FALSE,TRUE,FALSE));
rname = preg->name ;
} else
- rname = aopGet(AOP(left),0,FALSE,FALSE);
+ rname = aopGet(AOP(left),0,FALSE,FALSE,FALSE);
freeAsmop(left,NULL,ic,TRUE);
aopOp (result,ic,FALSE, FALSE);
preg = getFreePtr(ic,&aop,FALSE);
emitcode("mov","%s,%s",
preg->name,
- aopGet(AOP(left),0,FALSE,TRUE));
+ aopGet(AOP(left),0,FALSE,TRUE,FALSE));
rname = preg->name ;
} else
- rname = aopGet(AOP(left),0,FALSE,FALSE);
+ rname = aopGet(AOP(left),0,FALSE,FALSE,FALSE);
freeAsmop(left,NULL,ic,TRUE);
aopOp (result,ic,FALSE, FALSE);
/* if this is remateriazable */
if (AOP_TYPE(left) == AOP_IMMD)
{
- emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE));
+ emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE,FALSE));
}
else
{
/* we need to get it byte by byte */
if (AOP_TYPE(left) != AOP_DPTR)
{
- emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE));
- emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE));
+ emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE,TRUE));
+ emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE,TRUE));
if (options.model == MODEL_FLAT24)
{
- emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE,TRUE));
}
}
else
{
/* We need to generate a load to DPTR indirect through DPTR. */
D(emitcode(";", "genFarPointerGet -- indirection special case."););
- emitcode("push", "%s", aopGet(AOP(left),0,FALSE,TRUE));
- emitcode("push", "%s", aopGet(AOP(left),1,FALSE,TRUE));
- emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE));
+ emitcode("push", "%s", aopGet(AOP(left),0,FALSE,TRUE,TRUE));
+ emitcode("push", "%s", aopGet(AOP(left),1,FALSE,TRUE,TRUE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE,TRUE));
emitcode("pop", "dph");
emitcode("pop", "dpl");
}
if (AOP_TYPE(left) != AOP_STR) {
/* if this is remateriazable */
if (AOP_TYPE(left) == AOP_IMMD)
- emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE));
+ emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE,FALSE));
else { /* we need to get it byte by byte */
- emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE));
- emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE));
+ emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE,TRUE));
+ emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE,TRUE));
if (options.model == MODEL_FLAT24)
{
- emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE,TRUE));
}
}
}
if (AOP_TYPE(left) != AOP_STR) {
/* if this is remateriazable */
if (AOP_TYPE(left) == AOP_IMMD) {
- emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE));
+ emitcode("mov","dptr,%s",aopGet(AOP(left),0,TRUE,FALSE,FALSE));
emitcode("mov","b,#%d",pointerCode(retype));
}
else { /* we need to get it byte by byte */
- emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE));
- emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE));
+ emitcode("mov","dpl,%s",aopGet(AOP(left),0,FALSE,FALSE,TRUE));
+ emitcode("mov","dph,%s",aopGet(AOP(left),1,FALSE,FALSE,TRUE));
if (options.model == MODEL_FLAT24)
{
- emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE));
- emitcode("mov","b,%s",aopGet(AOP(left),3,FALSE,FALSE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(left),2,FALSE,FALSE,TRUE));
+ emitcode("mov","b,%s",aopGet(AOP(left),3,FALSE,FALSE,TRUE));
}
else
{
- emitcode("mov","b,%s",aopGet(AOP(left),2,FALSE,FALSE));
+ emitcode("mov","b,%s",aopGet(AOP(left),2,FALSE,FALSE,TRUE));
}
}
}
blen = SPEC_BLEN(etype);
bstr = SPEC_BSTR(etype);
- l = aopGet(AOP(right),offset++,FALSE,FALSE);
+ l = aopGet(AOP(right),offset++,FALSE,FALSE,TRUE);
MOVA(l);
/* if the bit lenth is less than or */
/* now generate for lengths greater than one byte */
while (1) {
- l = aopGet(AOP(right),offset++,FALSE,TRUE);
+ l = aopGet(AOP(right),offset++,FALSE,TRUE,FALSE);
rLen -= 8 ;
if (rLen <= 0 )
aopOp(right,ic,FALSE, FALSE);
- l = aopGet(AOP(result),0,FALSE,TRUE);
+ l = aopGet(AOP(result),0,FALSE,TRUE,FALSE);
size = AOP_SIZE(right);
while (size--) {
if (offset)
else
sprintf(buffer,"%s",l+1);
emitcode("mov","%s,%s",buffer,
- aopGet(AOP(right),offset++,FALSE,FALSE));
+ aopGet(AOP(right),offset++,FALSE,FALSE,FALSE));
}
freeAsmop(right,NULL,ic,TRUE);
preg = getFreePtr(ic,&aop,FALSE);
emitcode("mov","%s,%s",
preg->name,
- aopGet(AOP(result),0,FALSE,TRUE));
+ aopGet(AOP(result),0,FALSE,TRUE,FALSE));
rname = preg->name ;
} else
- rname = aopGet(AOP(result),0,FALSE,FALSE);
+ rname = aopGet(AOP(result),0,FALSE,FALSE,FALSE);
freeAsmop(result,NULL,ic,TRUE);
aopOp (right,ic,FALSE, FALSE);
int offset = 0 ;
while (size--) {
- l = aopGet(AOP(right),offset,FALSE,TRUE);
+ l = aopGet(AOP(right),offset,FALSE,TRUE,FALSE);
if (*l == '@' ) {
MOVA(l);
emitcode("mov","@%s,a",rname);
preg = getFreePtr(ic,&aop,FALSE);
emitcode("mov","%s,%s",
preg->name,
- aopGet(AOP(result),0,FALSE,TRUE));
+ aopGet(AOP(result),0,FALSE,TRUE,FALSE));
rname = preg->name ;
} else
- rname = aopGet(AOP(result),0,FALSE,FALSE);
+ rname = aopGet(AOP(result),0,FALSE,FALSE,FALSE);
freeAsmop(result,NULL,ic,TRUE);
aopOp (right,ic,FALSE, FALSE);
int offset = 0 ;
while (size--) {
- l = aopGet(AOP(right),offset,FALSE,TRUE);
+ l = aopGet(AOP(right),offset,FALSE,TRUE,TRUE);
MOVA(l);
emitcode("movx","@%s,a",rname);
if (AOP_TYPE(result) != AOP_STR) {
/* if this is remateriazable */
if (AOP_TYPE(result) == AOP_IMMD)
- emitcode("mov","dptr,%s",aopGet(AOP(result),0,TRUE,FALSE));
+ emitcode("mov","dptr,%s",aopGet(AOP(result),0,TRUE,FALSE,FALSE));
else
{
/* we need to get it byte by byte */
if (AOP_TYPE(result) != AOP_DPTR)
{
- emitcode("mov","dpl,%s",aopGet(AOP(result),0,FALSE,FALSE));
- emitcode("mov","dph,%s",aopGet(AOP(result),1,FALSE,FALSE));
+ emitcode("mov","dpl,%s",aopGet(AOP(result),0,FALSE,FALSE,TRUE));
+ emitcode("mov","dph,%s",aopGet(AOP(result),1,FALSE,FALSE,TRUE));
if (options.model == MODEL_FLAT24)
{
- emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE,TRUE));
}
}
else
{
/* We need to generate a load to DPTR indirect through DPTR. */
D(emitcode(";", "genFarPointerSet -- indirection special case."););
- emitcode("push", "%s", aopGet(AOP(result),0,FALSE,TRUE));
- emitcode("push", "%s", aopGet(AOP(result),1,FALSE,TRUE));
- emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE));
+ emitcode("push", "%s", aopGet(AOP(result),0,FALSE,TRUE,TRUE));
+ emitcode("push", "%s", aopGet(AOP(result),1,FALSE,TRUE,TRUE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE,TRUE));
emitcode("pop", "dph");
emitcode("pop", "dpl");
}
offset = 0 ;
while (size--) {
- char *l = aopGet(AOP(right),offset++,FALSE,FALSE);
+ char *l = aopGet(AOP(right),offset++,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("movx","@dptr,a");
if (size)
if (AOP_TYPE(result) != AOP_STR) {
/* if this is remateriazable */
if (AOP_TYPE(result) == AOP_IMMD) {
- emitcode("mov","dptr,%s",aopGet(AOP(result),0,TRUE,FALSE));
- emitcode("mov","b,%s + 1",aopGet(AOP(result),0,TRUE,FALSE));
+ emitcode("mov","dptr,%s",aopGet(AOP(result),0,TRUE,FALSE,FALSE));
+ emitcode("mov","b,%s + 1",aopGet(AOP(result),0,TRUE,FALSE,FALSE));
}
else { /* we need to get it byte by byte */
- emitcode("mov","dpl,%s",aopGet(AOP(result),0,FALSE,FALSE));
- emitcode("mov","dph,%s",aopGet(AOP(result),1,FALSE,FALSE));
+ emitcode("mov","dpl,%s",aopGet(AOP(result),0,FALSE,FALSE,TRUE));
+ emitcode("mov","dph,%s",aopGet(AOP(result),1,FALSE,FALSE,TRUE));
if (options.model == MODEL_FLAT24)
{
- emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE));
- emitcode("mov","b,%s",aopGet(AOP(result),3,FALSE,FALSE));
+ emitcode("mov", "dpx,%s",aopGet(AOP(result),2,FALSE,FALSE,TRUE));
+ emitcode("mov","b,%s",aopGet(AOP(result),3,FALSE,FALSE,TRUE));
}
else
{
- emitcode("mov","b,%s",aopGet(AOP(result),2,FALSE,FALSE));
+ emitcode("mov","b,%s",aopGet(AOP(result),2,FALSE,FALSE,TRUE));
}
}
}
offset = 0 ;
while (size--) {
- char *l = aopGet(AOP(right),offset++,FALSE,FALSE);
+ char *l = aopGet(AOP(right),offset++,FALSE,FALSE,TRUE);
MOVA(l);
emitcode("lcall","__gptrput");
if (size)
char *l ;
/* first push the right side on to the stack */
while (size--) {
- l = aopGet(AOP(right),offset++,FALSE,FALSE);
+ l = aopGet(AOP(right),offset++,FALSE,FALSE,TRUE);
MOVA(l);
emitcode ("push","acc");
}
aopPut(AOP(result),"a",size);
else
aopPut(AOP(result),
- aopGet(AOP(right),size,FALSE,FALSE),
+ aopGet(AOP(right),size,FALSE,FALSE,FALSE),
size);
}
} else {
while (size--) {
aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
aopOp(IC_JTCOND(ic),ic,FALSE, FALSE);
/* get the condition into accumulator */
- l = aopGet(AOP(IC_JTCOND(ic)),0,FALSE,FALSE);
+ l = aopGet(AOP(IC_JTCOND(ic)),0,FALSE,FALSE,TRUE);
MOVA(l);
/* multiply by four! */
emitcode("add","a,acc");
offset = 0 ;
while (size--) {
aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
offset = 0 ;
while (size--) {
aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
offset = 0 ;
while (size--) {
aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
offset = 0 ;
while (size--) {
aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
+ aopGet(AOP(right),offset,FALSE,FALSE,FALSE),
offset);
offset++;
}
} else {
/* we need to extend the sign :{ */
char *l = aopGet(AOP(right),AOP_SIZE(right) - 1,
- FALSE,FALSE);
+ FALSE,FALSE,TRUE);
MOVA(l);
emitcode("rlc","a");
emitcode("subb","a,acc");
if (IS_AOP_PREG(IC_RESULT(ic))) {
emitcode("dec","%s",
- aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
- emitcode("mov","a,%s",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
+ aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE,FALSE));
+ emitcode("mov","a,%s",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE,FALSE));
emitcode("jnz","%05d$",lbl->key+100);
} else {
- emitcode ("djnz","%s,%05d$",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE),
+ emitcode ("djnz","%s,%05d$",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE,FALSE),
lbl->key+100);
}
emitcode ("sjmp","%05d$",lbl1->key+100);