case AOP_CRY:
return TRUE;
case AOP_ACC:
+ if (offset)
+ return FALSE;
return TRUE;
case AOP_LIT:
return FALSE;
tlbl=newiTempLabel(NULL);
l = aopGet (AOP (IC_LEFT (ic)), offset++, FALSE, FALSE);
- if (AOP_TYPE (IC_LEFT (ic)) == AOP_ACC ||
+ if ((AOP_TYPE (IC_LEFT (ic)) == AOP_ACC && offset == 0) ||
AOP_TYPE (IC_LEFT (ic)) == AOP_REG ||
IS_AOP_PREG (IC_LEFT (ic)))
{
freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
}
- /* adjust the stack for parameters if
- required */
+ /* adjust the stack for parameters if required */
if (ic->parmBytes)
{
int i;
emitcode ("push", "acc");
accPushed = TRUE;
}
+
emitcode ("mov", "a,%s", spname);
emitcode ("add", "a,#0x%02x", (-ic->parmBytes) & 0xff);
emitcode ("mov", "%s,a", spname);
+
+ /* unsaveRegisters from xstack needs acc, but */
+ /* unsaveRegisters from stack needs this popped */
+ if (accPushed && !options.useXstack)
+ {
+ emitcode ("pop", "acc");
+ accPushed = FALSE;
+ }
}
else
for (i = 0; i < ic->parmBytes; i++)
{
if (accuse && !accPushed && options.useXstack)
{
+ /* xstack needs acc, but doesn't touch normal stack */
emitcode ("push", "acc");
accPushed = TRUE;
}
bitVect *regsUsed;
bitVect *regsUsedPrologue;
bitVect *regsUnneeded;
- int accIsFree = sym->recvSize < 4;
int idx;
_G.currentFunc = NULL;
emitcode ("mov", "ea,c");
}
- if ((IFFUNC_ISREENT (sym->type) || options.stackAuto))// && !options.useXstack)
- {
- emitcode ("mov", "sp,_bp");
- }
if ((IFFUNC_ISREENT (sym->type) || options.stackAuto))
{
+ emitcode ("mov", "sp,_bp");
+ emitcode ("pop", "_bp");
+
if (options.useXstack)
{
- emitcode ("pop", "_bp");
emitcode ("xch", "a,_bpx");
emitcode ("mov", "r0,a");
emitcode ("dec", "r0");
emitcode ("xch", "a,_bpx");
emitcode ("mov", "%s,r0", spname); //read before freeing stack space (interrupts)
}
- else
- {
- emitcode ("pop", "_bp");
- }
}
/* restore the register bank */
}
else
{
- if (AOP_TYPE (left) == AOP_ACC)
- emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ if (AOP_TYPE (left) == AOP_ACC && offset == 0)
+ {
+ emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
emitcode ("setb", "c");
while (sizer--)
{
- if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
- emitcode ("anl", "a,%s",
- aopGet (AOP (right), offset, FALSE, FALSE));
- } else {
- if (AOP_TYPE(left)==AOP_ACC) {
- bool pushedB = pushB ();
- emitcode("mov", "b,a");
- MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
- emitcode("anl", "a,b");
- popB (pushedB);
- }else {
+ if ((AOP_TYPE(right)==AOP_REG || IS_AOP_PREG(right) || AOP_TYPE(right)==AOP_DIR)
+ && AOP_TYPE(left)==AOP_ACC)
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("anl", "a,%s",
+ aopGet (AOP (right), offset, FALSE, FALSE));
+ } else {
+ if (AOP_TYPE(left)==AOP_ACC)
+ {
+ if (!offset)
+ {
+ bool pushedB = pushB ();
+ emitcode("mov", "b,a");
+ MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode("anl", "a,b");
+ popB (pushedB);
+ }
+ else
+ {
+ MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+ emitcode("anl", "a,b");
+ }
+ } else {
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
emitcode ("anl", "a,%s",
aopGet (AOP (left), offset, FALSE, FALSE));
aopPut (AOP (result), zero, offset, isOperandVolatile (result, FALSE));
continue;
}
+ else if (AOP_TYPE (left) == AOP_ACC)
+ {
+ if (!offset)
+ {
+ emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ aopPut (AOP (result), "a", offset, isOperandVolatile (result, FALSE));
+ continue;
+ }
+ else
+ {
+ emitcode ("anl", "b,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ aopPut (AOP (result), "b", offset, isOperandVolatile (result, FALSE));
+ continue;
+ }
+ }
}
// 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));
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("anl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
else
{
if (AOP_TYPE (left) == AOP_ACC)
- emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
while (sizer--)
{
if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+ if (offset)
+ emitcode("mov", "a,b");
emitcode ("orl", "a,%s",
aopGet (AOP (right), offset, FALSE, FALSE));
} else {
// 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));
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("orl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
else
{
if (AOP_TYPE (left) == AOP_ACC)
- emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
else
{
if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+ if (offset)
+ emitcode("mov", "a,b");
emitcode ("xrl", "a,%s",
aopGet (AOP (right), offset, FALSE, FALSE));
} else {
// 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));
+ {
+ if (offset)
+ emitcode("mov", "a,b");
+ emitcode ("xrl", "a,%s", aopGet (AOP (right), offset, FALSE, FALSE));
+ }
else
{
MOVA (aopGet (AOP (right), offset, FALSE, FALSE));