From: tecodev Date: Sun, 15 Oct 2006 00:57:40 +0000 (+0000) Subject: * src/pic/pcode.c (InsertBankSel): suppress BANKSELs for one bank X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5b0663a7e051dce4f36557fff2418155d063baf1;p=fw%2Fsdcc * src/pic/pcode.c (InsertBankSel): suppress BANKSELs for one bank devices, (BankSelect): emit BANKSEL before touching linker-placed regs, fixes #1570934 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4409 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index d5732d62..d19b2c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-15 Raphael Neider + + * src/pic/pcode.c (InsertBankSel): suppress BANKSELs for one bank + devices, + (BankSelect): emit BANKSEL before touching linker-placed regs, + fixes #1570934 + 2006-10-10 Raphael Neider * src/SDCCmain.c (optionsTable): accept --stack-size for PICs, diff --git a/src/pic/pcode.c b/src/pic/pcode.c index d29b62e4..1951de07 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -4556,7 +4556,12 @@ static void insertBankSel(pCodeInstruction *pci, const char *name) { pCode *new_pc; - pCodeOp *pcop = popCopyReg(PCOR(pci->pcop)); + pCodeOp *pcop; + + // This is a NOP for single-banked devices. + if (pic14_getMaxRam() < 0x80) return; + + pcop = popCopyReg(PCOR(pci->pcop)); pcop->type = PO_GPR_REGISTER; // Sometimes the type is set to legacy 8051 - so override it if (pcop->name == 0) pcop->name = strdup(name); @@ -4609,11 +4614,7 @@ static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg) } else { bank = 'L'; // Unfixed local registers are allocated by the linker therefore its bank is unknown } - if ((cur_bank == 'L')&&(bank == 'L')) { // If current bank and new bank are both allocated locally by the linker, then assume it is in same bank. - return 'L'; // Local registers are presumed to be in same linker assigned bank - } else if ((bank == 'L')&&(cur_bank != 'L')) { // Reg is now local and linker to assign bank - insertBankSel(pci, reg->name); // Let linker choose the bank selection - } else if (bank == 'E') { // Reg is now extern and linker to assign bank + if (bank == 'E' || bank == 'L') { // Reg is now extern and linker to assign bank insertBankSel(pci, reg->name); // Let linker choose the bank selection } else if ((cur_bank == -1)||(cur_bank == 'L')||(cur_bank == 'E')) { // Current bank unknown and new register bank is known then can set bank bits insertBankSwitch(pci, bank&1, PIC_RP0_BIT);