* src/pic/gen.c (genPointerGet): handle pointers to CONST values
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Jul 2005 15:31:05 +0000 (15:31 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 4 Jul 2005 15:31:05 +0000 (15:31 +0000)
  like CODE pointers, fixes #1115683
* src/pic/pcode.c (DoBankSelect): forget LastRegIdx during function
  call, fixes bugs #1232211, #1228110,
  fixed wrong casts to pCodeFlow from pCodeInstructions

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

ChangeLog
src/pic/gen.c
src/pic/pcode.c

index 5687854c25554a583b79c71f88a5b11f76ecbdb2..e6d57df42cdf69c7ed2e7a4a2493a6cb4b89451c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-04 Raphael Neider <rneider AT web.de>
+
+       * src/pic/gen.c (genPointerGet): handle pointers to CONST values
+         like CODE pointers, fixes #1115683
+       * src/pic/pcode.c (DoBankSelect): forget LastRegIdx during function
+         call, fixes bugs #1232211, #1228110,
+         fixed wrong casts to pCodeFlow from pCodeInstructions
+
 2005-07-04 Raphael Neider <rneider AT web.de>
 
        * src/pic/gen.c (popGet): changed assert to allow for
index 5d1e22ba1f483fc508c466aecbc8ae1167f149c5..903927211512f3d8b765bf73d05d324854ed520d 100644 (file)
@@ -8827,7 +8827,7 @@ static void genPointerGet (iCode *ic)
                break;
                
        case GPOINTER:
-               if (IS_CODEPTR(type) || IS_PTR_CONST(type))
+               if (IS_CODEPTR(type) || IS_PTR_CONST(type) || SPEC_CONST(etype))
                        genConstPointerGet (left,result,ic);
                else
                        genGenPointerGet (left,result,ic);
index 4e226db9c1b3a20b130aaf164ab0805217418604..e956863cf059fc7c5a1b7aad1705c6fede77bb68 100644 (file)
@@ -4515,9 +4515,11 @@ static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg)
                }
        }
        
+#if 1
        if (LastRegIdx == reg->rIdx) // If this is the same register as last time then it is in same bank
                return cur_bank;
        LastRegIdx = reg->rIdx;
+#endif
        
        if (reg->isFixed) {
                bank = REG_BANK(reg);
@@ -4628,6 +4630,7 @@ static int DoBankSelect(pCode *pc, int cur_bank) {
        
        if (isCALL(pc)) {
                pCode *pcf = findFunction(get_op_from_instruction(PCI(pc)));
+               LastRegIdx = -1; /* do not know which register is touched in the called function... */
                if (pcf && isPCF(pcf)) {
                        pCode *pcfr;
                        int rbank = 'U'; // Undetermined
@@ -4637,9 +4640,9 @@ static int DoBankSelect(pCode *pc, int cur_bank) {
                                if (isPCI(pcfr)) {
                                        if ((PCI(pcfr)->op==POC_RETURN) || (PCI(pcfr)->op==POC_RETLW)) {
                                                if (rbank == 'U')
-                                                       rbank = PCFL(pcfr)->lastBank;
+                                                       rbank = PCI(pcfr)->pcflow->lastBank;
                                                else
-                                                       if (rbank != PCFL(pcfr)->lastBank)
+                                                       if (rbank != PCI(pcfr)->pcflow->lastBank)
                                                                return -1; // Unknown bank - multiple returns with different banks
                                        }
                                }
@@ -4651,6 +4654,8 @@ static int DoBankSelect(pCode *pc, int cur_bank) {
                        /* Extern functions may use registers in different bank - must call banksel */
                        return -1; /* Unknown bank */
                }
+               /* play safe... */
+               return -1;
        }
        
        if ((isPCI(pc)) && (PCI(pc)->op == POC_BANKSEL)) {