* src/SDCCicode.h: moved CRITICAL and ENDCRITICAL from SKIP_IC2 to SKIP_IC
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 6 Mar 2005 11:50:17 +0000 (11:50 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 6 Mar 2005 11:50:17 +0000 (11:50 +0000)
* src/mcs51/ralloc.c (willCauseSpill): added check for REG_BIT type,
  (regTypeNum): set REG_BIT type if necessary
* src/mcs51/ralloc.h: added define REG_BIT, used to fix bug 1144613
* support/regression/tests/critical.c: check bug 1144613

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

ChangeLog
src/SDCCicode.h
src/mcs51/ralloc.c
src/mcs51/ralloc.h
support/regression/tests/critical.c

index 89cc542110713effe67b96661aa31c148e8f8fbb..3a32fced03873d170a77851eb312fd303e95e3db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,16 @@
+2005-03-06 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * src/SDCCicode.h: moved CRITICAL and ENDCRITICAL from SKIP_IC2 to SKIP_IC
+       * src/mcs51/ralloc.c (willCauseSpill): added check for REG_BIT type,
+         (regTypeNum): set REG_BIT type if necessary
+       * src/mcs51/ralloc.h: added define REG_BIT, used to fix bug 1144613
+       * support/regression/tests/critical.c: check bug 1144613
+
 2005-03-02 Raphael Neider <rneider AT web.de>
 
        * src/pic16/gen.c (genRightShiftLiteral): fixed bug #1154256
 
-2004-02-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+2005-02-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/avr/ralloc.c (serialRegAssign),
        * src/ds390/ralloc.c (serialRegAssign),
 
        * src/SDCCast.c (decorateType): fixed bug 1124787
 
-2004-02-20 Hubert Sack <sack AT digiplan.de>
+2005-02-20 Hubert Sack <sack AT digiplan.de>
        committed by Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * src/mcs51/peeph.def: added peepholes 3.h-k and 132.a-f from
        patch #1121755
 
-2004-02-20 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
+2005-02-20 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * src/SDCCpeeph.def: new keyword "labelRefCountChange" which allows peepholes
        to keep the correct label reference count when adding/removing references
@@ -85,7 +93,7 @@
 
        * src/pic/gen.c : Fix for bugs #1080519 & #1115662.
 
-2004-02-03 Maarten Brock <sourceforge.brock AT dse.nl>
+2005-02-03 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/include/mcs51/c8051f120.h: added declarations for sbit port 2,3&4
 
        * (genPackBits): improved accessing full bytes, implemented for GPOINTERs
        * device/include/pic16/{stddef.h,stdbool.h}: added
 
-2004-02-02 Maarten Brock <sourceforge.brock AT dse.nl>
+2005-02-02 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/include/mcs51/c8051f040.h: added define CPT2_PAGE
 
        * src/pic16/Makefile.bcc : Do not use this file but added file graph.c as it
         appeared to be required
 
-2004-01-31 Borut Razem <borut.razem AT siol.net>
+2005-01-31 Borut Razem <borut.razem AT siol.net>
 
        * support/scripts/sdcc.nsi: added include/asm/ds390, include/asm/mcs51,
          include/mcs51 and include/z80 directories to the package
 
-2004-01-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+2005-01-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/hc08/gen.c (genFunction): fixed bug #1112752
 
-2004-01-30 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
+2005-01-30 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * src/mcs51/peeph.def: adapted peephole 258.x to changed gen.c (genAnd)
 
-2004-01-29 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
+2005-01-29 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * src/mcs51/gen.c (genAnd): accessing LSB/MSB by rotating acc
 
-2004-01-29 Maarten Brock <sourceforge.brock AT dse.nl>
+2005-01-29 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/include/Makefile.in: create/copy mcs51 and z80 include subdirs
 
-2004-01-27 Maarten Brock <sourceforge.brock AT dse.nl>
+2005-01-27 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/include/c8051fxxx.h: removed these 6 files
        * device/include/mcs51/c8051fxxx.h: added these 11 new files
        * src/pic16/glue.c (emitStatistics): beautified
        * device/lib/pic16/libm/Makefile: added include path
 
-2004-01-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+2005-01-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/z80/gen.c (aopPut): fixed bug #1103902
 
-2004-01-25 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+2005-01-25 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * device/lib/expf.c: fixed bug #1095792
 
        * src/pic16/pcoderegs.c (pCodeOptime2pCodes): disabled optimization
          to fix #1106967 (pCode->seq are not set up correctly)
 
-2004-01-22 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+2005-01-22 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/SDCCglue.c (glue): make sure code area is declared before the
        static initialization area.
index 2968911f04d037a4276af6add82262cb67c81862..d0aab4c055778229d73a4925d66efd829341052b 100644 (file)
@@ -211,9 +211,7 @@ iCodeTable;
                       x->op == LABEL        ||    \
                       x->op == FUNCTION     ||    \
                       x->op == INLINEASM    ||    \
-                      x->op == ENDFUNCTION  ||    \
-                      x->op == CRITICAL     ||    \
-                      x->op == ENDCRITICAL  )
+                      x->op == ENDFUNCTION  )
 
 #define SKIP_IC1(x)  (x->op == CALL         ||    \
                       SKIP_IC2(x) )
@@ -225,6 +223,8 @@ iCodeTable;
                       x->op == RECEIVE      ||    \
                       x->op == ARRAYINIT    ||    \
                       SKIP_IC1(x)           ||    \
+                      x->op == CRITICAL     ||    \
+                      x->op == ENDCRITICAL  ||    \
                       x->op == SEND         )
 
 #define SKIP_IC3(x) (SKIP_IC2(x)            ||    \
index c6db735b06a7e1b9d9799efa3e3ad072c52c41df..f606f076e7eaacec5a029989fa0012f5f27b1e5e 100644 (file)
@@ -866,7 +866,7 @@ tryAgain:
 }
 
 /*-----------------------------------------------------------------*/
-/* getRegPtrNoSpil - get it cannot split                           */
+/* getRegPtrNoSpil - get it cannot be spilt                        */
 /*-----------------------------------------------------------------*/
 static regs *getRegPtrNoSpil()
 {
@@ -887,7 +887,7 @@ static regs *getRegPtrNoSpil()
 }
 
 /*-----------------------------------------------------------------*/
-/* getRegGprNoSpil - get it cannot split                           */
+/* getRegGprNoSpil - get it cannot be spilt                           */
 /*-----------------------------------------------------------------*/
 static regs *getRegGprNoSpil()
 {
@@ -1054,8 +1054,8 @@ reassignLR (operand * op)
 static int
 willCauseSpill (int nr, int rt)
 {
-  /* first check if there are any avlb registers
-     of te type required */
+  /* first check if there are any available registers
+     of the type required */
   if (rt == REG_PTR)
     {
       /* special case for pointer type
@@ -1066,6 +1066,11 @@ willCauseSpill (int nr, int rt)
       if (nFreeRegs (REG_GPR) >= nr)
         return 0;
     }
+  else if (rt == REG_BIT)
+    {
+      if (nFreeRegs (rt) >= nr)
+        return 0;
+    }
   else
     {
       if (mcs51_ptrRegReq)
@@ -1217,7 +1222,7 @@ serialRegAssign (eBBlock ** ebbs, int count)
                 int j;
                 int ptrRegSet = 0;
 
-                /* Make sure any spill location is definately allocated */
+                /* Make sure any spill location is definitely allocated */
                 if (sym->isspilt && !sym->remat && sym->usl.spillLoc &&
                     !sym->usl.spillLoc->allocreq)
                   {
@@ -1457,7 +1462,7 @@ static void fillGaps()
               }
           }
 
-        D(printf("Atemping fillGaps on %s: [",sym->name));
+        D(printf("Attempting fillGaps on %s: [",sym->name));
         /* THERE IS HOPE !!!! */
         for (i=0; i < sym->nRegs ; i++ ) {
             if (sym->regType == REG_PTR)
@@ -1825,13 +1830,12 @@ regTypeNum (eBBlock *ebbs)
             }
 
           /* determine the type of register required */
-          if (sym->nRegs == 1 &&
-              IS_PTR (sym->type) &&
-              sym->uptr)
+          if (sym->nRegs == 1 && IS_PTR (sym->type) && sym->uptr)
             sym->regType = REG_PTR;
+          else if (IS_BIT(sym->type))
+            sym->regType = REG_BIT;
           else
             sym->regType = REG_GPR;
-
         }
       else
         /* for the first run we don't provide */
index 978ccfc572a6d571ed2f2fd40830490179098d93..cd92de4fc505c4b9c7ee9bc27cffca9e59204ac7 100644 (file)
@@ -8,19 +8,19 @@
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2, or (at your option) any
    later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
+
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
+   what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 #include "SDCCicode.h"
 #include "SDCCBBlock.h"
 
 enum
   {
-    R2_IDX = 0, R3_IDX, R4_IDX,
-    R5_IDX, R6_IDX, R7_IDX,
-    R0_IDX, R1_IDX, X8_IDX,
-    X9_IDX, X10_IDX, X11_IDX,
+    R2_IDX = 0, R3_IDX, R4_IDX, R5_IDX,
+    R6_IDX, R7_IDX, R0_IDX,  R1_IDX,
+    X8_IDX, X9_IDX, X10_IDX, X11_IDX,
     X12_IDX, CND_IDX,
     DPL_IDX, DPH_IDX, B_IDX, A_IDX,
     END_IDX
@@ -42,18 +41,19 @@ enum
 #define REG_PTR 0x01
 #define REG_GPR 0x02
 #define REG_CND 0x04
+#define REG_BIT 0x08
 /* definition for the registers */
 typedef struct regs
   {
-    short type;                        /* can have value 
-                                  REG_GPR, REG_PTR or REG_CND */
-    short rIdx;                        /* index into register table */
+    short type;         /* can have value
+                           REG_GPR, REG_PTR or REG_CND */
+    short rIdx;         /* index into register table */
     short otype;
-    char *name;                        /* name */
-    char *dname;               /* name when direct access needed */
-    char *base;                        /* base address */
-    short offset;              /* offset from the base */
-    unsigned isFree:1;         /* is currently unassigned  */
+    char *name;         /* name */
+    char *dname;        /* name when direct access needed */
+    char *base;         /* base address */
+    short offset;       /* offset from the base */
+    unsigned isFree:1;  /* is currently unassigned  */
   }
 regs;
 extern regs regs8051[];
index 918cbdb4430ce406777abf3b434c7d6e152ddab3..2d66520e678802cd73b975a1ff07140f7e3a3158 100644 (file)
@@ -17,6 +17,7 @@ typedef union
 
 //must be at least 2 bytes big and volatile
 volatile big global_var = { 0 };
+int y;
 
 unsigned int get_global (void) critical
 {
@@ -52,6 +53,10 @@ testCritical(void)
   }
   //check the interrupt has run at all
   ASSERT(x.a != 0);
+
+  critical y = 0;
+  //check the interrupts are still enabled
+  ASSERT(EA);
 #else
   ASSERT(1);
 #endif