Changed the type of the result of the ! (NOT) operator to char;
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Aug 2003 06:51:32 +0000 (06:51 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 20 Aug 2003 06:51:32 +0000 (06:51 +0000)
previously it returned the same type as the source. This allows
us to eliminate all the genFloatNot functions (all of its target
implementations were very buggy) since !float can use the same
code as !long now.

* src/SDCCicode.c (ast2iCode): ! returns char
* src/mcs51/gen.c (genNot, genNotFloat),
* src/ds390/gen.c (genNot, genNotFloat),
* src/z80/gen.c (genNot, genNotFloat),
* src/pic/gen.c (genNot, genNotFloat),
* src/pic16/gen.c (genNot, genNotFloat): eliminated genNotFloat

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

ChangeLog
src/SDCCicode.c
src/ds390/gen.c
src/mcs51/gen.c
src/pic/gen.c
src/pic16/gen.c
src/z80/gen.c

index 9ebd65e3864dd5586c3fe0f4ec6d1d0e0ad6d3ed..8e9ca1c320f6a4b0b3208f846bd38604c89cd91d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2003-08-20  Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       Changed the type of the result of the ! (NOT) operator to char;
+       previously it returned the same type as the source. This allows
+       us to eliminate all the genFloatNot functions (all of its target
+       implementations were very buggy) since !float can use the same
+       code as !long now.
+
+       * src/SDCCicode.c (ast2iCode): ! returns char
+       * src/mcs51/gen.c (genNot, genNotFloat),
+       * src/ds390/gen.c (genNot, genNotFloat),
+       * src/z80/gen.c (genNot, genNotFloat),
+       * src/pic/gen.c (genNot, genNotFloat),
+       * src/pic16/gen.c (genNot, genNotFloat): eliminated genNotFloat
+
 2003-08-19  Bernhard Held <bernhard@bernhardheld.de>
 
        pic patch provided by Slade Rich <slade_rich@yahoo.com>
@@ -26,7 +41,7 @@
 
 2003-08-18  Erik Petrich <epetrich@ivorytower.norman.ok.us>
 
-       * src/z80/gen.c (isUnsplitable, fetchPairLog): fixed bug #770454
+       * src/z80/gen.c (isUnsplitable, fetchPairLong): fixed bug #770454
 
 2003-08-18  Erik Petrich <epetrich@ivorytower.norman.ok.us>
 
index eac7ec101b03bae495ee0353fc33b12be159b045..abafe41ffb64f990d03481a4fce45809f17597a7 100644 (file)
@@ -3637,11 +3637,11 @@ ast2iCode (ast * tree,int lvl)
 #endif
 
     case '~':
-    case '!':
     case RRC:
     case RLC:
       return geniCodeUnary (geniCodeRValue (left, FALSE), tree->opval.op);
 
+    case '!':
     case GETHBIT:
       {
        operand *op = geniCodeUnary (geniCodeRValue (left, FALSE), tree->opval.op);
index 419896b1231fb2cea4226063e72446138dfbcde6..4deb61a2347e11b01fbea99e1d690eaa206e4308 100644 (file)
@@ -1607,47 +1607,6 @@ reAdjustPreg (asmop * aop)
       emitcode("nop", "; workaround for DS80C390 div bug.");  \
     }
 
-/*-----------------------------------------------------------------*/
-/* genNotFloat - generates not for float operations              */
-/*-----------------------------------------------------------------*/
-static void
-genNotFloat (operand * op, operand * res)
-{
-  int size, offset;
-  symbol *tlbl;
-
-  D (emitcode (";", "genNotFloat "););
-
-  /* we will put 127 in the first byte of
-     the result */
-  aopPut (AOP (res), "#127", 0);
-  size = AOP_SIZE (op) - 1;
-  offset = 1;
-
-  _startLazyDPSEvaluation ();
-  MOVA(aopGet(op->aop, offset++, FALSE, FALSE, NULL));
-
-  while (size--)
-    {
-      emitcode ("orl", "a,%s",
-               aopGet (op->aop,
-                       offset++, FALSE, FALSE,
-                       DP2_RESULT_REG));
-    }
-  _endLazyDPSEvaluation ();
-
-  tlbl = newiTempLabel (NULL);
-  aopPut (res->aop, one, 1);
-  emitcode ("jz", "!tlabel", (tlbl->key + 100));
-  aopPut (res->aop, zero, 1);
-  emitcode ("", "!tlabeldef", (tlbl->key + 100));
-
-  size = res->aop->size - 2;
-  offset = 2;
-  /* put zeros in the rest */
-  while (size--)
-    aopPut (res->aop, zero, offset++);
-}
 
 /*-----------------------------------------------------------------*/
 /* opIsGptr: returns non-zero if the passed operand is       */
@@ -1797,7 +1756,6 @@ static void
 genNot (iCode * ic)
 {
   symbol *tlbl;
-  sym_link *optype = operandType (IC_LEFT (ic));
 
   D (emitcode (";", "genNot "););
 
@@ -1814,13 +1772,6 @@ genNot (iCode * ic)
       goto release;
     }
 
-  /* if type float then do float */
-  if (IS_FLOAT (optype))
-    {
-      genNotFloat (IC_LEFT (ic), IC_RESULT (ic));
-      goto release;
-    }
-
   toBoolean (IC_LEFT (ic));
 
   tlbl = newiTempLabel (NULL);
index 7e1494c8a4bfeba26d80c990835c8b160d159807..0a5e3598970ecc4881ad3e96e3e6ec7852d27478 100644 (file)
@@ -132,7 +132,8 @@ emitcode (char *inst, const char *fmt,...)
 
   while (isspace (*lbp))
     lbp++;
-
+//  printf ("%s\n", lb); // EEP - debugging
+  
   if (lbp && *lbp)
     lineCurr = (lineCurr ?
                connectLine (lineCurr, newLineNode (lb)) :
@@ -1205,46 +1206,6 @@ reAdjustPreg (asmop * aop)
                       (x->aopu.aop_reg[0] == mcs51_regWithIdx(R0_IDX) || \
                       x->aopu.aop_reg[0] == mcs51_regWithIdx(R1_IDX) )))
 
-/*-----------------------------------------------------------------*/
-/* genNotFloat - generates not for float operations              */
-/*-----------------------------------------------------------------*/
-static void
-genNotFloat (operand * op, operand * res)
-{
-  int size, offset;
-  char *l;
-  symbol *tlbl;
-
-  D(emitcode (";     genNotFloat",""));
-
-  /* we will put 127 in the first byte of
-     the result */
-  aopPut (AOP (res), "#127", 0, isOperandVolatile (op, FALSE));
-  size = AOP_SIZE (op) - 1;
-  offset = 1;
-
-  l = aopGet (op->aop, offset++, FALSE, FALSE);
-  MOVA (l);
-
-  while (size--)
-    {
-      emitcode ("orl", "a,%s",
-               aopGet (op->aop,
-                       offset++, FALSE, FALSE));
-    }
-
-  tlbl = newiTempLabel (NULL);
-  aopPut (res->aop, one, 1, isOperandVolatile (op, FALSE));
-  emitcode ("jz", "%05d$", (tlbl->key + 100));
-  aopPut (res->aop, zero, 1, isOperandVolatile (op, FALSE));
-  emitcode ("", "%05d$:", (tlbl->key + 100));
-
-  size = res->aop->size - 2;
-  offset = 2;
-  /* put zeros in the rest */
-  while (size--)
-    aopPut (res->aop, zero, offset++, isOperandVolatile (op, FALSE));
-}
 
 /*-----------------------------------------------------------------*/
 /* opIsGptr: returns non-zero if the passed operand is       */
@@ -1343,7 +1304,6 @@ static void
 genNot (iCode * ic)
 {
   symbol *tlbl;
-  sym_link *optype = operandType (IC_LEFT (ic));
 
   D(emitcode (";     genNot",""));
 
@@ -1360,13 +1320,6 @@ genNot (iCode * ic)
       goto release;
     }
 
-  /* if type float then do float */
-  if (IS_FLOAT (optype))
-    {
-      genNotFloat (IC_LEFT (ic), IC_RESULT (ic));
-      goto release;
-    }
-
   toBoolean (IC_LEFT (ic));
 
   tlbl = newiTempLabel (NULL);
index eadf223a0d9deb2d72bb42b7a95dbd4a445be59b..c2bb459fd27c1e395de08bb4552eefce96a690e1 100644 (file)
@@ -1732,44 +1732,6 @@ static void reAdjustPreg (asmop *aop)
 
 }
 
-/*-----------------------------------------------------------------*/
-/* genNotFloat - generates not for float operations              */
-/*-----------------------------------------------------------------*/
-static void genNotFloat (operand *op, operand *res)
-{
-    int size, offset;
-    char *l;
-    symbol *tlbl ;
-
-    DEBUGpic14_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
-    /* we will put 127 in the first byte of 
-    the result */
-    aopPut(AOP(res),"#127",0);
-    size = AOP_SIZE(op) - 1;
-    offset = 1;
-
-    l = aopGet(op->aop,offset++,FALSE,FALSE);
-    MOVA(l);    
-
-    while(size--) {
-        pic14_emitcode("orl","a,%s",
-                 aopGet(op->aop,
-                        offset++,FALSE,FALSE));
-    }
-    tlbl = newiTempLabel(NULL);
-
-    tlbl = newiTempLabel(NULL);
-    aopPut(res->aop,one,1);
-    pic14_emitcode("jz","%05d_DS_",(tlbl->key+100));
-    aopPut(res->aop,zero,1);
-    pic14_emitcode("","%05d_DS_:",(tlbl->key+100));
-
-    size = res->aop->size - 2;
-    offset = 2;    
-    /* put zeros in the rest */
-    while (size--) 
-        aopPut(res->aop,zero,offset++);
-}
 
 #if 0
 /*-----------------------------------------------------------------*/
@@ -1884,7 +1846,6 @@ void pic14_toBoolean(operand *oper)
 static void genNot (iCode *ic)
 {
   symbol *tlbl;
-  sym_link *optype = operandType(IC_LEFT(ic));
   int size;
 
   DEBUGpic14_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
@@ -1906,13 +1867,7 @@ static void genNot (iCode *ic)
     goto release;
   }
 
-  /* if type float then do float */
-  if (IS_FLOAT(optype)) {
-    genNotFloat(IC_LEFT(ic),IC_RESULT(ic));
-    goto release;
-  }
-
-  size = AOP_SIZE(IC_RESULT(ic));
+  size = AOP_SIZE(IC_LEFT(ic));
   if(size == 1) {
     emitpcode(POC_COMFW,popGet(AOP(IC_LEFT(ic)),0));
     emitpcode(POC_ANDLW,popGetLit(1));
index cf80da3c1f5357f48c60b2fa4ee539a20f97745c..d9fd14dca675ae07a7f9ddeca7313dfcfc1ae43c 100644 (file)
@@ -1728,44 +1728,6 @@ static void reAdjustPreg (asmop *aop)
 
 }
 
-/*-----------------------------------------------------------------*/
-/* genNotFloat - generates not for float operations              */
-/*-----------------------------------------------------------------*/
-static void genNotFloat (operand *op, operand *res)
-{
-    int size, offset;
-    char *l;
-    symbol *tlbl ;
-
-    DEBUGpic16_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
-    /* we will put 127 in the first byte of 
-    the result */
-    pic16_aopPut(AOP(res),"#127",0);
-    size = AOP_SIZE(op) - 1;
-    offset = 1;
-
-    l = pic16_aopGet(op->aop,offset++,FALSE,FALSE);
-    MOVA(l);    
-
-    while(size--) {
-        pic16_emitcode("orl","a,%s",
-                 pic16_aopGet(op->aop,
-                        offset++,FALSE,FALSE));
-    }
-    tlbl = newiTempLabel(NULL);
-
-    tlbl = newiTempLabel(NULL);
-    pic16_aopPut(res->aop,one,1);
-    pic16_emitcode("jz","%05d_DS_",(tlbl->key+100));
-    pic16_aopPut(res->aop,zero,1);
-    pic16_emitcode("","%05d_DS_:",(tlbl->key+100));
-
-    size = res->aop->size - 2;
-    offset = 2;    
-    /* put zeros in the rest */
-    while (size--) 
-        pic16_aopPut(res->aop,zero,offset++);
-}
 
 #if 0
 /*-----------------------------------------------------------------*/
@@ -1880,7 +1842,6 @@ void pic16_toBoolean(operand *oper)
 static void genNot (iCode *ic)
 {
   symbol *tlbl;
-  sym_link *optype = operandType(IC_LEFT(ic));
   int size;
 
   DEBUGpic16_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
@@ -1902,13 +1863,7 @@ static void genNot (iCode *ic)
     goto release;
   }
 
-  /* if type float then do float */
-  if (IS_FLOAT(optype)) {
-    genNotFloat(IC_LEFT(ic),IC_RESULT(ic));
-    goto release;
-  }
-
-  size = AOP_SIZE(IC_RESULT(ic));
+  size = AOP_SIZE(IC_LEFT(ic));
   if(size == 1) {
     pic16_emitpcode(POC_COMFW,pic16_popGet(AOP(IC_LEFT(ic)),0));
     pic16_emitpcode(POC_ANDLW,pic16_popGetLit(1));
index 9df933375c825dcb4c6b9d69b87fb7ef731c0971..17463dc0950a1bc9747662253eb7b2f66a668280 100644 (file)
@@ -2033,43 +2033,6 @@ _toBoolean (operand * oper)
     }
 }
 
-/*-----------------------------------------------------------------*/
-/* genNotFloat - generates not for float operations              */
-/*-----------------------------------------------------------------*/
-static void
-genNotFloat (operand * op, operand * res)
-{
-  int size, offset;
-  symbol *tlbl;
-
-  emitDebug ("; genNotFloat");
-
-  /* we will put 127 in the first byte of
-     the result */
-  aopPut (AOP (res), "!immedbyte", 0x7F);
-  size = AOP_SIZE (op) - 1;
-  offset = 1;
-
-  _moveA (aopGet (op->aop, offset++, FALSE));
-
-  while (size--)
-    {
-      emit2 ("or a,%s", aopGet (op->aop, offset++, FALSE));
-    }
-
-  tlbl = newiTempLabel (NULL);
-  aopPut (res->aop, "!one", 1);
-  emit2 ("!shortjp z !tlabel", tlbl->key + 100);
-  aopPut (res->aop, "!zero", 1);
-
-  emitLabel(tlbl->key + 100);
-
-  size = res->aop->size - 2;
-  offset = 2;
-  /* put zeros in the rest */
-  while (size--)
-    aopPut (res->aop, "!zero", offset++);
-}
 
 /*-----------------------------------------------------------------*/
 /* genNot - generate code for ! operation                          */
@@ -2077,7 +2040,6 @@ genNotFloat (operand * op, operand * res)
 static void
 genNot (iCode * ic)
 {
-  sym_link *optype = operandType (IC_LEFT (ic));
 
   /* assign asmOps to operand & result */
   aopOp (IC_LEFT (ic), ic, FALSE, TRUE);
@@ -2089,13 +2051,6 @@ genNot (iCode * ic)
       wassertl (0, "Tried to negate a bit");
     }
 
-  /* if type float then do float */
-  if (IS_FLOAT (optype))
-    {
-      genNotFloat (IC_LEFT (ic), IC_RESULT (ic));
-      goto release;
-    }
-
   _toBoolean (IC_LEFT (ic));
 
   /* Not of A:
@@ -2105,7 +2060,6 @@ genNot (iCode * ic)
   emit2 ("sub a,!one");
   outBitC (IC_RESULT (ic));
 
- release:
   /* release the aops */
   freeAsmop (IC_LEFT (ic), NULL, ic);
   freeAsmop (IC_RESULT (ic), NULL, ic);