/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-static void insertBankSel(pCodeInstruction *pci, const char *name)
+static int insertBankSel(pCodeInstruction *pci, const char *name)
{
pCode *new_pc;
pCodeOp *pcop;
// Never BANKSEL STATUS, this breaks all kinds of code (e.g., interrupt handlers).
- if (!strcmp("STATUS", name) || !strcmp("_STATUS", name)) return;
+ if (!strcmp("STATUS", name) || !strcmp("_STATUS", name)) return 0;
pcop = popCopyReg(PCOR(pci->pcop));
pcop->type = PO_GPR_REGISTER; // Sometimes the type is set to legacy 8051 - so override it
new_pc = newpCode(POC_BANKSEL, pcop);
insertPCodeInstruction(pci, PCI(new_pc));
+ return 1;
}
/*
// XXX: We can do better with fixed registers.
if (allRAMmshared && reg && (reg->type != REG_SFR) && (!reg->isFixed)) {
// no BANKSEL required
- addpCodeComment(pc->prev, "BANKOPT1b BANKSEL dropped; %s present in all of %s's banks", new_bank, cur_bank);
+ addpCodeComment(pc->prev, "BANKOPT1b BANKSEL dropped; %s present in all (of %s's) banks", new_bank, cur_bank);
continue;
}
- // restrict cur_mask to cover only the banks this register
- // is in (as well as the previous registers)
- cur_mask &= new_mask;
-
if (sameBank(reg, previous_reg, new_bank, cur_bank, max_mask)) {
// no BANKSEL required
addpCodeComment(pc->prev, "BANKOPT2 BANKSEL dropped; %s present in same bank as %s", new_bank, cur_bank);
}
} // if
- cur_mask = new_mask;
- cur_bank = new_bank;
- previous_reg = reg;
- insertBankSel(pci, cur_bank);
+ if (insertBankSel(pci, new_bank)) {
+ cur_mask = new_mask;
+ cur_bank = new_bank;
+ previous_reg = reg;
+ } // if
} // if
} // if
} // for
}
}
+#if 0
/*-----------------------------------------------------------------*/
/* printCallTree - writes the call tree to a file */
/* */
}
+#endif
#if 0
/*-----------------------------------------------------------------*/