for (i = 0; i < ds390_nRegs; i++)
{
if (bitVectBitValue (rsave, i))
- emitcode ("push", "%s ;jwk saveRegisters", ds390_regWithIdx (i)->dname);
+ emitcode ("push", "%s", ds390_regWithIdx (i)->dname);
}
detype = getSpec (operandType (IC_LEFT (ic)));
- if (detype &&
+ if (/* why would we do this?: jwk20010511 */ 0 &&
+ detype &&
(SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
IS_ISR (currFunc->etype) &&
!ic->bankSaved)
-
saverbank (SPEC_BANK (detype), ic, TRUE);
}
for (i = ds390_nRegs; i >= 0; i--)
{
if (bitVectBitValue (rsave, i))
- emitcode ("pop", "%s ;jwk unsaveRegisters", ds390_regWithIdx (i)->dname);
+ emitcode ("pop", "%s", ds390_regWithIdx (i)->dname);
}
}
MOVA (l);
l = "acc";
}
- emitcode ("push", "%s ;jwk genIpush: !parm", l);
+ emitcode ("push", "%s", l);
}
_endLazyDPSEvaluation ();
return;
emitcode ("push", "acc");
}
else
- emitcode ("push", "%s ;jwk genIpush", l);
+ emitcode ("push", "%s", l);
}
_endLazyDPSEvaluation ();
_startLazyDPSEvaluation ();
while (size--)
{
- emitcode ("pop", "%s ;jwk genIpop", aopGet (AOP (IC_LEFT (ic)), offset--,
+ emitcode ("pop", "%s", aopGet (AOP (IC_LEFT (ic)), offset--,
FALSE, TRUE, TRUE));
}
_endLazyDPSEvaluation ();
genCall (iCode * ic)
{
sym_link *detype;
+ int bankSwitched=0;
- D (emitcode (";", "genCall ");
- );
-
- /* if caller saves & we have not saved then */
- if (!ic->regsSaved)
- saveRegisters (ic);
+ D (emitcode (";", "genCall "););
/* if we are calling a function that is not using
the same register bank then we need to save the
if (detype &&
(SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
IS_ISR (currFunc->etype) &&
- !ic->bankSaved)
-
- saverbank (SPEC_BANK (detype), ic, TRUE);
-
+ !ic->bankSaved) {
+ bankSwitched=1;
+ }
+
+ /* if caller saves & we have not saved then */
+ if (!ic->regsSaved) {
+ if (bankSwitched) {
+ // no need to save if we switch banks
+ } else {
+ saveRegisters (ic);
+ }
+ }
+
/* if send set is not empty the assign */
if (_G.sendSet)
{
if (strcmp (l, fReturn[offset])) {
genSetDPTR(0);
_flushLazyDPS();
- emitcode ("mov", "%s,%s ;jwk lazy genCall",
+ emitcode ("mov", "%s,%s",
fReturn[offset],
l);
}
}
_G.sendSet = NULL;
}
+
+ if (bankSwitched) {
+ saverbank(SPEC_BANK(detype), ic, TRUE);
+ }
+
/* make the call */
emitcode ("lcall", "%s", (OP_SYMBOL (IC_LEFT (ic))->rname[0] ?
OP_SYMBOL (IC_LEFT (ic))->rname :
else
for (i = 0; i < ic->parmBytes; i++)
emitcode ("dec", "%s", spname);
-
}
/* if register bank was saved then pop them */
- if (ic->bankSaved)
+ if (bankSwitched) {
unsaverbank (SPEC_BANK (detype), ic, TRUE);
-
- /* if we hade saved some registers then unsave them */
- if (ic->regsSaved && !(OP_SYMBOL (IC_LEFT (ic))->calleeSave))
- unsaveRegisters (ic);
-
-
+ } else {
+ /* if we have saved some registers then unsave them */
+ if (ic->regsSaved && !(OP_SYMBOL (IC_LEFT (ic))->calleeSave))
+ unsaveRegisters (ic);
+ }
}
/*-----------------------------------------------------------------*/
D (emitcode (";", "genPcall ");
);
-
/* if caller saves & we have not saved then */
if (!ic->regsSaved)
saveRegisters (ic);
(SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)))
saverbank (SPEC_BANK (detype), ic, TRUE);
-
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
emitcode ("push", "acc");
l=aopGet(AOP(left),0,FALSE,FALSE,TRUE);
genSetDPTR(0);
_flushLazyDPS();
- emitcode ("mov", "dpl,%s ;jwk lazy genGenPointerGet", l);
+ emitcode ("mov", "dpl,%s", l);
l=aopGet(AOP(left),1,FALSE,FALSE,TRUE);
genSetDPTR(0);
_flushLazyDPS();
- emitcode ("mov", "dph,%s ;jwk lazy genGenPointerGet", l);
+ emitcode ("mov", "dph,%s", l);
l=aopGet(AOP(left),2,FALSE,FALSE,TRUE);
genSetDPTR(0);
_flushLazyDPS();
- emitcode ("mov", "dpx,%s ;jwk lazy genGenPointerGet", l);
+ emitcode ("mov", "dpx,%s", l);
emitcode ("mov", "b,%s", aopGet (AOP(left),3,FALSE,FALSE,TRUE));
} else {
emitcode ("mov", "dpl,%s", aopGet (AOP(left),0,FALSE,FALSE,TRUE));