* src/pic/pcode.c (BankSelect): another fix on (partial) BANKSELs,
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 16 Oct 2006 08:26:54 +0000 (08:26 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 16 Oct 2006 08:26:54 +0000 (08:26 +0000)
  fixes #1577882, removes close to all banking optimizations

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4411 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/pic/pcode.c

index cd969b3bfee7a4849356ffe4cd674a8be652e009..844ff84241a8b5fcdf9746bce0a1af5412a813b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-16 Raphael Neider <rneider AT web.de>
+
+       * src/pic/pcode.c (BankSelect): another fix on (partial) BANKSELs,
+         fixes #1577882, removes close to all banking optimizations
+
 2006-10-15 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/SDCCsymt.c (checkSClass): no error for uninitialised absolute
index 1951de072bf6f28e090b024d7add965c29bda5b3..fe75ecf7e7baa54739a394cf50c3e9e388577b68 100644 (file)
@@ -4541,6 +4541,7 @@ static void insertPCodeInstruction(pCodeInstruction *pci, pCodeInstruction *new_
 
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
+#if 0
 static void insertBankSwitch(pCodeInstruction *pci, int Set_Clear, int RP_BankBit)
 {
        pCode *new_pc;
@@ -4549,7 +4550,7 @@ static void insertBankSwitch(pCodeInstruction *pci, int Set_Clear, int RP_BankBi
        
        insertPCodeInstruction(pci, PCI(new_pc));
 }
-
+#endif
 /*-----------------------------------------------------------------*/
 /*-----------------------------------------------------------------*/
 static void insertBankSel(pCodeInstruction  *pci, const char *name)
@@ -4583,6 +4584,12 @@ static void insertBankSel(pCodeInstruction  *pci, const char *name)
 static int LastRegIdx = -1; /* If the previous register is the same one again then no need to change bank. */
 static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg)
 {
+#if 1
+       /* Always insert BANKSELs rather than try to be clever:
+        * Too many bugs in optimized banksels... */
+       insertBankSel(pci, reg->name); // Let linker choose the bank selection
+       return 'L';
+#else
        int bank;
        int a = reg->alias>>7;
        if ((a&3) == 3) {
@@ -4607,6 +4614,8 @@ static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg)
        LastRegIdx = reg->rIdx;
 #endif
        
+       /* Optimized code---unfortunately this turns out to be buggy
+        * (at least on devices with more than two banks). */
        if (reg->isFixed) {
                bank = REG_BANK(reg);
        } else if (reg->isExtern) {
@@ -4639,6 +4648,7 @@ static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg)
        }
        
        return bank;
+#endif
 }
 
 /*-----------------------------------------------------------------*/