}
_G;
-static void saverbank (int, iCode *, bool);
+static void saveRBank (int, iCode *, bool);
#define RESULTONSTACK(x) \
(IC_RESULT(x) && IC_RESULT(x)->aop && \
}
detype = getSpec (operandType (IC_LEFT (ic)));
- if (/* why would we do this?: jwk20010511 */ 0 &&
- detype &&
+
+#if 0 // why should we do this here??? jwk20011105
+ if (detype &&
(SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
IS_ISR (currFunc->etype) &&
!ic->bankSaved)
- saverbank (SPEC_BANK (detype), ic, TRUE);
+ saveRBank (SPEC_BANK (detype), ic, TRUE);
+#endif
}
/*-----------------------------------------------------------------*/
}
/*-----------------------------------------------------------------*/
-/* unsaverbank - restores the resgister bank from stack */
+/* unsaveRBank - restores the resgister bank from stack */
/*-----------------------------------------------------------------*/
static void
-unsaverbank (int bank, iCode * ic, bool popPsw)
+unsaveRBank (int bank, iCode * ic, bool popPsw)
{
int i;
asmop *aop;
}
/*-----------------------------------------------------------------*/
-/* saverbank - saves an entire register bank on the stack */
+/* saveRBank - saves an entire register bank on the stack */
/*-----------------------------------------------------------------*/
static void
-saverbank (int bank, iCode * ic, bool pushPsw)
+saveRBank (int bank, iCode * ic, bool pushPsw)
{
int i;
asmop *aop;
genCall (iCode * ic)
{
sym_link *detype;
- int bankSwitched=0;
- D (emitcode (";", "genCall "););
+ D (emitcode (";", "genCall ");
+ );
- /* if we are calling a function that is not using
- the same register bank then we need to save the
- destination registers on the stack */
- detype = getSpec (operandType (IC_LEFT (ic)));
- if (detype &&
- (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
- IS_ISR (currFunc->etype) &&
- !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)
{
_G.sendSet = NULL;
}
- if (bankSwitched) {
- saverbank(SPEC_BANK(detype), ic, TRUE);
+ /* if we are calling a function that is not using
+ the same register bank then we need to save the
+ destination registers on the stack */
+ detype = getSpec (operandType (IC_LEFT (ic)));
+ if (detype &&
+ (SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)) &&
+ IS_ISR (currFunc->etype) &&
+ !ic->bankSaved) {
+ saveRBank (SPEC_BANK (detype), ic, TRUE);
+ } else /* no need to save if we just saved the whole bank */ {
+ /* if caller saves & we have not saved then */
+ if (!ic->regsSaved)
+ saveRegisters (ic);
}
/* make the call */
else
for (i = 0; i < ic->parmBytes; i++)
emitcode ("dec", "%s", spname);
+
}
/* if register bank was saved then pop them */
- if (bankSwitched) {
- unsaverbank (SPEC_BANK (detype), ic, TRUE);
- } else {
- /* if we have saved some registers then unsave them */
- if (ic->regsSaved && !(OP_SYMBOL (IC_LEFT (ic))->calleeSave))
- unsaveRegisters (ic);
- }
+ if (ic->bankSaved)
+ 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);
+
+
}
/*-----------------------------------------------------------------*/
D (emitcode (";", "genPcall ");
);
+
/* if caller saves & we have not saved then */
if (!ic->regsSaved)
saveRegisters (ic);
if (detype &&
IS_ISR (currFunc->etype) &&
(SPEC_BANK (currFunc->etype) != SPEC_BANK (detype)))
- saverbank (SPEC_BANK (detype), ic, TRUE);
+ saveRBank (SPEC_BANK (detype), ic, TRUE);
+
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
if (detype &&
(SPEC_BANK (currFunc->etype) !=
SPEC_BANK (detype)))
- unsaverbank (SPEC_BANK (detype), ic, TRUE);
+ unsaveRBank (SPEC_BANK (detype), ic, TRUE);
/* if we hade saved some registers then
unsave them */
else
{
/* this function has a function call cannot
- determines register usage so we will have the
+ determines register usage so we will have to push the
entire bank */
- saverbank (0, ic, FALSE);
+ saveRBank (0, ic, FALSE);
}
}
}
else
{
/* this function has a function call cannot
- determines register usage so we will have the
+ determines register usage so we will have to pop the
entire bank */
- unsaverbank (0, ic, FALSE);
+ unsaveRBank (0, ic, FALSE);
}
}
else
{
/* Since A is the last element of fReturn,
- * it is OK to clobber it in the aopGet.
+ * is is OK to clobber it in the aopGet.
*/
l = aopGet (AOP (IC_LEFT (ic)), offset,
FALSE, FALSE, TRUE);
if (strcmp (fReturn[offset], l))
- {
emitcode ("mov", "%s,%s", fReturn[offset++], l);
- }
}
}
_endLazyDPSEvaluation ();