* src/mcs51/gen.c (genFunction, genEndFunction),
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 16 Sep 2003 08:12:15 +0000 (08:12 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 16 Sep 2003 08:12:15 +0000 (08:12 +0000)
* src/ds390/gen.c (genFunction, genEndFunction): Moved save
and restore of EA so that stack offsets to parameters are
correct when using both critical and reentrant/stack-auto.
* src/z80/gen.c (aopOp): removed erroneous assertion about sloc
size (can be triggered in error if sloc is shared between
different sized objects)
* device/include/float.h: fixed macros to explicitly use
unsigned long where needed

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

ChangeLog
device/include/float.h
src/ds390/gen.c
src/mcs51/gen.c
src/z80/gen.c

index 95d26821e55ff4d13dcc435b513cf7ca635e61d1..1dd4cf0861b8dc462097df56d4ab471541555cd3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-09-16  Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * src/mcs51/gen.c (genFunction, genEndFunction),
+       * src/ds390/gen.c (genFunction, genEndFunction): Moved save
+       and restore of EA so that stack offsets to parameters are
+       correct when using both critical and reentrant/stack-auto.
+       * src/z80/gen.c (aopOp): removed erroneous assertion about sloc
+       size (can be triggered in error if sloc is shared between
+       different sized objects)
+       * device/include/float.h: fixed macros to explicitly use
+       unsigned long where needed
+
 2003-09-15  Bernhard Held <bernhard@bernhardheld.de>
 
        Feature req. 799831: added code to allow nesting of critical functions
index 5870fdb8a4724ec7a35024b78143ea7c5f2d9a2c..c1d3c26b2b57b779d1953e24c496bea2565db831 100644 (file)
 /* the following deal with IEEE single-precision numbers */
 #define EXCESS         126
 #define SIGNBIT                ((unsigned long)0x80000000)
-#define HIDDEN         (unsigned long)(1 << 23)
-#define SIGN(fp)       ((fp >> (8*sizeof(fp)-1)) & 1)
-#define EXP(fp)                (((fp) >> 23) & (unsigned int) 0x00FF)
+#define HIDDEN         (unsigned long)(1ul << 23)
+#define SIGN(fp)       (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
+#define EXP(fp)                (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
 #define MANT(fp)       (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
 #define NORM            0xff000000
-#define PACK(s,e,m)    ((s) | ((e) << 23) | (m))
+#define PACK(s,e,m)    ((s) | ((unsigned long)(e) << 23) | (m))
 
 float __uchar2fs (unsigned char);
 float __schar2fs (signed char);
index c8cb28950e3b68120da883d569e39ad8b6708bed..83ceb8bcf17d03a032babc9798fc0a5c13f42edd 100644 (file)
@@ -2897,13 +2897,6 @@ genFunction (iCode * ic)
   
   if (options.stack_probe) 
       emitcode ("lcall","__stack_probe");
-  /* if critical function then turn interrupts off */
-  if (IFFUNC_ISCRITICAL (ftype))
-    {
-      emitcode ("mov", "c,ea");
-      emitcode ("push", "psw"); /* save old ea via c in psw */
-      emitcode ("clr", "ea");
-    }
 
   /* here we need to generate the equates for the
      register bank if required */
@@ -3182,6 +3175,14 @@ genFunction (iCode * ic)
       emitcode ("add", "a,#!constbyte", ((char) sym->xstack & 0xff));
       emitcode ("mov", "_spx,a");
     }
+  
+  /* if critical function then turn interrupts off */
+  if (IFFUNC_ISCRITICAL (ftype))
+    {
+      emitcode ("mov", "c,ea");
+      emitcode ("push", "psw"); /* save old ea via c in psw */
+      emitcode ("clr", "ea");
+    }
 
 }
 
@@ -3201,6 +3202,12 @@ genEndFunction (iCode * ic)
       return;
   }
 
+  if (IFFUNC_ISCRITICAL (sym->type))
+    {
+      emitcode ("pop", "psw"); /* restore ea via c in psw */
+      emitcode ("mov", "ea,c");
+    }
+  
   if ((IFFUNC_ISREENT (sym->type) || options.stackAuto) &&
        (sym->stack || FUNC_HASSTACKPARM(sym->type))) {
 
@@ -3345,12 +3352,6 @@ genEndFunction (iCode * ic)
       if (!inExcludeList ("acc"))
        emitcode ("pop", "acc");
 
-      if (IFFUNC_ISCRITICAL (sym->type))
-        {
-         emitcode ("pop", "psw"); /* restore ea via c in psw */
-         emitcode ("mov", "ea,c");
-        }
-
       /* if debug then send end of function */
       if (options.debug && currFunc) {
          _G.debugLine = 1;
@@ -3368,12 +3369,6 @@ genEndFunction (iCode * ic)
     }
   else
     {
-      if (IFFUNC_ISCRITICAL (sym->type))
-        {
-         emitcode ("pop", "psw"); /* restore ea via c in psw */
-         emitcode ("mov", "ea,c");
-        }
-
       if (IFFUNC_CALLEESAVES(sym->type))
        {
          int i;
index cb33e3ef4c0b1a38921c5c97f7665e9b8b1ed3b5..b71930550139a4a9939e6667938046590c64abb0 100644 (file)
@@ -2291,14 +2291,6 @@ genFunction (iCode * ic)
       return;
   }
 
-  /* if critical function then turn interrupts off */
-  if (IFFUNC_ISCRITICAL (ftype))
-    {
-      emitcode ("mov", "c,ea");
-      emitcode ("push", "psw"); /* save old ea via c in psw */
-      emitcode ("clr", "ea");
-    }
-
   /* here we need to generate the equates for the
      register bank if required */
   if (FUNC_REGBANK (ftype) != rbank)
@@ -2575,7 +2567,14 @@ genFunction (iCode * ic)
       emitcode ("add", "a,#0x%02x", ((char) sym->xstack & 0xff));
       emitcode ("mov", "_spx,a");
     }
-
+  
+  /* if critical function then turn interrupts off */
+  if (IFFUNC_ISCRITICAL (ftype))
+    {
+      emitcode ("mov", "c,ea");
+      emitcode ("push", "psw"); /* save old ea via c in psw */
+      emitcode ("clr", "ea");
+    }
 }
 
 /*-----------------------------------------------------------------*/
@@ -2591,6 +2590,12 @@ genEndFunction (iCode * ic)
       emitcode(";", "naked function: no epilogue.");
       return;
   }
+      
+  if (IFFUNC_ISCRITICAL (sym->type))
+    {
+      emitcode ("pop", "psw"); /* restore ea via c in psw */
+      emitcode ("mov", "ea,c");
+    }
 
   if (IFFUNC_ISREENT (sym->type) || options.stackAuto)
     {
@@ -2715,12 +2720,6 @@ genEndFunction (iCode * ic)
       if (!inExcludeList ("acc"))
        emitcode ("pop", "acc");
 
-      if (IFFUNC_ISCRITICAL (sym->type))
-        {
-         emitcode ("pop", "psw"); /* restore ea via c in psw */
-         emitcode ("mov", "ea,c");
-        }
-
       /* if debug then send end of function */
       if (options.debug && currFunc)
        {
@@ -2739,12 +2738,6 @@ genEndFunction (iCode * ic)
     }
   else
     {
-      if (IFFUNC_ISCRITICAL (sym->type))
-        {
-         emitcode ("pop", "psw"); /* restore ea via c in psw */
-         emitcode ("mov", "ea,c");
-        }
-
       if (IFFUNC_CALLEESAVES(sym->type))
        {
          int i;
index 0ab78841d45dacc20572a89109cdaaeb06e1490a..f822996156bc4d626f0533bcbe15ec5f6dccb4cb 100644 (file)
@@ -1039,7 +1039,6 @@ aopOp (operand * op, iCode * ic, bool result, bool requires_a)
       }
       sym->aop = op->aop = aop =
        aopForSym (ic, sym->usl.spillLoc, result, requires_a);
-      wassertl (aop->size >= getSize (sym->type), "Operand doesn't fit in the spill location");
       aop->size = getSize (sym->type);
       return;
     }