* src/pic16/glue.c,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 Sep 2007 15:46:07 +0000 (15:46 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 Sep 2007 15:46:07 +0000 (15:46 +0000)
* src/pic/glue.c,
* src/SDCCmem.h: removed maxRegBank
* src/SDCCmem.c (allocVariables): removed maxRegBank and moved setting
  RegBankUsed[] to checkFunction() in SDCCsymt.c to fix bug 1759839
* src/SDCCsymt.c (checkFunction): set RegBankUsed[] here

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

ChangeLog
src/SDCCmem.c
src/SDCCmem.h
src/SDCCsymt.c
src/pic/glue.c
src/pic16/glue.c

index bf0217c514c5d8a2663ce2a6e9737d98c675c5d0..83c5d08f22b0a2b2bfd896201c06014f69e4903c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-09-04 Maarten Brock <sourceforge.brock AT dse.nl>
 
+       * src/pic16/glue.c,
+       * src/pic/glue.c,
+       * src/SDCCmem.h: removed maxRegBank
+       * src/SDCCmem.c (allocVariables): removed maxRegBank and moved setting
+         RegBankUsed[] to checkFunction() in SDCCsymt.c to fix bug 1759839
+       * src/SDCCsymt.c (checkFunction): set RegBankUsed[] here
        * src/mcs51/peep.c (isCallerSaveFunc, termScanAtFunc): changed function
          name and behaviour to handle banked functions
          (scan4op): and use it to fix bug 1786213
index 183c572e3ed6f5641ecddf871d60d768c4f5817f..5bc6bb92c31ea1354df22ec3801954349b6dbacc 100644 (file)
@@ -33,7 +33,6 @@ memmap *home = NULL;            /* Unswitchable code bank      */
    symbols in a single overlay */
 set *ovrSetSets = NULL;
 
-int maxRegBank = 0;
 int fatalError = 0;             /* fatal error flag                   */
 
 /*-----------------------------------------------------------------*/
@@ -915,9 +914,9 @@ allocVariables (symbol * symChain)
 
           SPEC_EXTR (sym->etype) = 0;
           addSym (TypedefTab, sym, sym->name, sym->level, sym->block, 0);
-          continue;             /* go to the next one         */
+          continue;             /* go to the next one */
         }
-      /* make sure it already exist */
+      /* make sure it already exists */
       csym = findSymWithLevel (SymbolTab, sym);
       if (!csym || (csym && csym->level != sym->level))
         csym = sym;
@@ -925,21 +924,15 @@ allocVariables (symbol * symChain)
       /* check the declaration */
       checkDecl (csym,0);
 
-      /* if this is a function or a pointer to function */
-      /* then args  processing  */
+      /* if this is a function or a pointer to a */
+      /* function then do args processing        */
       if (funcInChain (csym->type))
         {
           processFuncArgs (csym);
-
-          /* if register bank specified then update maxRegBank */
-          if (maxRegBank < FUNC_REGBANK (csym->type))
-            maxRegBank = FUNC_REGBANK (csym->type);
-          /*JCF: Mark the register bank as used*/
-          RegBankUsed[FUNC_REGBANK(csym->type)]=1;
         }
 
       /* if this is a extern variable then change the */
-      /* level to zero temporarily                                    */
+      /* level to zero temporarily                    */
       if (IS_EXTERN (csym->etype) || IS_FUNC (csym->type))
         {
           saveLevel = csym->level;
@@ -951,7 +944,7 @@ allocVariables (symbol * symChain)
       if (IS_LITERAL (sym->etype))
         continue;
 
-      /* generate the actual declaration  */
+      /* generate the actual declaration */
       if (csym->level)
         {
           allocLocal (csym);
index c97e19138710705b71f08395518b617857a71122..c0f0633d418ec36c19d237dfa027520630e2b231 100644 (file)
@@ -13,20 +13,20 @@ struct eBBlock;
 
 typedef struct memmap
   {
-    unsigned char pageno;      /* page no for this variable  */
-    const char *sname;         /*   character prefix for map */
-    char dbName;               /* debugger address space name */
-    int ptrType;               /* pointer Type for this space */
-    int slbl;                  /* label counter for space    */
-    unsigned sloc;             /* starting location          */
-    unsigned fmap:1;           /* 1 = 16bit addressing reqd  */
-    unsigned paged:1;          /* this is a paged mem space  */
-    unsigned direct:1;         /* 1= indirect access only    */
-    unsigned bitsp:1;          /* 1 = bit addressable space  */
-    unsigned codesp:1;         /* 1 = code space             */
-    unsigned regsp:1;          /* 1= sfr space               */
-    struct dbuf_s oBuf;                /* object buffer associated   */
-    struct set *syms;          /* symbols defined in this segment */
+    unsigned char pageno;       /* page no for this variable  */
+    const char *sname;          /*   character prefix for map */
+    char dbName;                /* debugger address space name */
+    int ptrType;                /* pointer Type for this space */
+    int slbl;                   /* label counter for space    */
+    unsigned sloc;              /* starting location          */
+    unsigned fmap:1;            /* 1 = 16bit addressing reqd  */
+    unsigned paged:1;           /* this is a paged mem space  */
+    unsigned direct:1;          /* 1 = indirect access only   */
+    unsigned bitsp:1;           /* 1 = bit addressable space  */
+    unsigned codesp:1;          /* 1 = code space             */
+    unsigned regsp:1;           /* 1 = sfr space              */
+    struct dbuf_s oBuf;         /* object buffer associated   */
+    struct set *syms;           /* symbols defined in this segment */
   }
 memmap;
 
@@ -45,7 +45,7 @@ extern FILE *junkFile;
 #define  BIT_NAME      port->mem.bit_name
 #define  REG_NAME      port->mem.reg_name
 #define  STATIC_NAME   port->mem.static_name
-#define         HOME_NAME     port->mem.home_name
+#define  HOME_NAME     port->mem.home_name
 #define  OVERLAY_NAME  port->mem.overlay_name
 #define  CONST_NAME    port->mem.const_name
 #define  CABS_NAME     port->mem.cabs_name
@@ -53,43 +53,41 @@ extern FILE *junkFile;
 #define  IABS_NAME     port->mem.iabs_name
 
 /* forward definition for variables */
-extern memmap *xstack;         /* xternal stack data           */
-extern memmap *istack;         /* internal stack               */
-extern memmap *code;           /* code segment                 */
-extern memmap *data;           /* internal data upto 128       */
-extern memmap *pdata;          /* paged external data upto 256 */
-extern memmap *xdata;          /* external data                */
+extern memmap *xstack;          /* xternal stack data           */
+extern memmap *istack;          /* internal stack               */
+extern memmap *code;            /* code segment                 */
+extern memmap *data;            /* internal data upto 128       */
+extern memmap *pdata;           /* paged external data upto 256 */
+extern memmap *xdata;           /* external data                */
 extern memmap *xidata;          /* the initialized xdata        */
 extern memmap *xinit;           /* the initializers for xidata  */
-extern memmap *idata;          /* internal data upto 256       */
-extern memmap *bit;            /* bit addressable space        */
-extern memmap *statsg;         /* static code segment          */
-extern memmap *c_abs;          /* constant absolute data       */
-extern memmap *x_abs;          /* absolute xdata/pdata         */
-extern memmap *i_abs;          /* absolute idata upto 256      */
-extern memmap *d_abs;          /* absolute data upto 128       */
-extern memmap *sfr;            /* register space               */
-extern memmap *sfrbit;         /* sfr bit space                */
-extern memmap *reg;            /* register space               */
-extern memmap *generic;                /* unknown                      */
-extern memmap *overlay;                /* the overlay segment          */
-extern memmap *eeprom;         /* eeprom space                 */
-extern memmap *home;           /* Non-banked home space        */
+extern memmap *idata;           /* internal data upto 256       */
+extern memmap *bit;             /* bit addressable space        */
+extern memmap *statsg;          /* static code segment          */
+extern memmap *c_abs;           /* constant absolute data       */
+extern memmap *x_abs;           /* absolute xdata/pdata         */
+extern memmap *i_abs;           /* absolute idata upto 256      */
+extern memmap *d_abs;           /* absolute data upto 128       */
+extern memmap *sfr;             /* register space               */
+extern memmap *sfrbit;          /* sfr bit space                */
+extern memmap *reg;             /* register space               */
+extern memmap *generic;         /* unknown                      */
+extern memmap *overlay;         /* the overlay segment          */
+extern memmap *eeprom;          /* eeprom space                 */
+extern memmap *home;            /* Non-banked home space        */
 
 extern int fatalError;
 
 extern struct set *ovrSetSets;
 
-extern int maxRegBank;
-
 /* easy access macros */
-#define IN_BITSPACE(map)       (map && map->bitsp)
+#define IN_BITSPACE(map)        (map && map->bitsp)
 #define IN_STACK(x)  (IS_SPEC(x) && (SPEC_OCLS(x) == xstack || SPEC_OCLS(x) == istack ))
 #define IN_FARSPACE(map)        (map && map->fmap)
 #define IN_DIRSPACE(map)        (map && map->direct)
 #define IN_PAGEDSPACE(map)      (map && map->paged )
 #define IN_CODESPACE(map)       (map && map->codesp)
-#define IN_REGSP(map)          (map && map->regsp)
+#define IN_REGSP(map)           (map && map->regsp)
 #define PTR_TYPE(map)           (map ? (map->ptrType ? map->ptrType : POINTER)\
                                      : port->unqualified_pointer)
 
index e686c296d9a332c69cbf6136c8e76c75f0bab2ed..1565d6950a47d296459696b6841719849b4e3e32 100644 (file)
@@ -2356,8 +2356,8 @@ inCalleeSaveList(char *s)
 }
 
 /*-----------------------------------------------------------------*/
-/* aggregateToPointer:  change an agggregate type function      */
-/*         argument to a pointer to that type.     */
+/* aggregateToPointer:     change an aggregate type function       */
+/*                         argument to a pointer to that type.     */
 /*-----------------------------------------------------------------*/
 value *
 aggregateToPointer (value * val)
@@ -2486,7 +2486,6 @@ checkFunction (symbol * sym, symbol *csym)
       werror (E_SHADOWREGS_NO_ISR, sym->name);
     }
 
-
   for (argCnt=1, acargs = FUNC_ARGS(sym->type); 
        acargs; 
        acargs=acargs->next, argCnt++) {
@@ -2539,6 +2538,9 @@ checkFunction (symbol * sym, symbol *csym)
       werror (E_PREV_DEF_CONFLICT, csym->name, "using");
     }
 
+  /*JCF: Mark the register bank as used*/
+  RegBankUsed[FUNC_REGBANK (sym->type)] = 1;
+
   if (IFFUNC_ISNAKED (csym->type) != IFFUNC_ISNAKED (sym->type))
     {
       werror (E_PREV_DEF_CONFLICT, csym->name, "_naked");
index b3d2f4da6be4722ebcc9e701e6f5e01d520268ee..5a92bcefcbc3041e0ac58e2d005e458d06f3da22 100644 (file)
@@ -48,7 +48,6 @@ extern int noAlloc;
 extern set *publics;
 extern set *externs;
 extern unsigned maxInterrupts;
-extern int maxRegBank;
 extern symbol *mainf;
 extern char *VersionString;
 extern struct dbuf_s *codeOutBuf;
index 158aa8a5eb842663a1c7e847caa277d8c9c8dd6c..b7cf7b08ffd00df0f30c1d3237de14f384f2aef8 100644 (file)
@@ -40,7 +40,6 @@ extern int noAlloc;
 extern set *publics;
 extern set *externs;
 extern unsigned maxInterrupts;
-extern int maxRegBank;
 extern symbol *mainf;
 extern char *VersionString;
 extern struct dbuf_s *codeOutBuf;