* src/mcs51/gen.c (outBitC): optimized for no result
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 3 Nov 2007 13:08:55 +0000 (13:08 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 3 Nov 2007 13:08:55 +0000 (13:08 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4958 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/mcs51/gen.c

index bb4a4847bd9395a63945b80bf5b1d40b4fb78b40..c0f83b77d4319391e40655308bf07cd8dd3de3bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-03 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * src/mcs51/gen.c (outBitC): optimized for no result
+
 2007-10-31 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCCsymt.c: fixed (hopeful properly) bug
index e4c6e5f85d4c588f3476abe7b73479e97fb5ac92..338961c9f52aa6e18d0382bafe19878903db2855 100644 (file)
@@ -712,7 +712,7 @@ aopForSym (iCode * ic, symbol * sym, bool result)
 }
 
 /*-----------------------------------------------------------------*/
-/* aopForRemat - rematerialzes an object                           */
+/* aopForRemat - rematerializes an object                          */
 /*-----------------------------------------------------------------*/
 static asmop *
 aopForRemat (symbol * sym)
@@ -728,13 +728,15 @@ aopForRemat (symbol * sym)
         val += (int) operandLitValue (IC_RIGHT (ic));
       else if (ic->op == '-')
         val -= (int) operandLitValue (IC_RIGHT (ic));
-      else if (IS_CAST_ICODE(ic)) {
-              sym_link *from_type = operandType(IC_RIGHT(ic));
-              aop->aopu.aop_immd.from_cast_remat = 1;
-              ic = OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
-              ptr_type = pointerTypeToGPByte (DCL_TYPE(from_type), NULL, NULL);
-              continue;
-      } else break;
+      else if (IS_CAST_ICODE(ic))
+        {
+          sym_link *from_type = operandType(IC_RIGHT(ic));
+          aop->aopu.aop_immd.from_cast_remat = 1;
+          ic = OP_SYMBOL (IC_RIGHT (ic))->rematiCode;
+          ptr_type = pointerTypeToGPByte (DCL_TYPE(from_type), NULL, NULL);
+          continue;
+        }
+      else break;
 
       ic = OP_SYMBOL (IC_LEFT (ic))->rematiCode;
     }
@@ -1857,9 +1859,12 @@ outBitC (operand * result)
     }
   else
     {
-      emitcode ("clr", "a");
-      emitcode ("rlc", "a");
-      outAcc (result);
+      if (getDataSize (result))
+        {
+          emitcode ("clr", "a");
+          emitcode ("rlc", "a");
+          outAcc (result);
+        }
     }
 }
 
@@ -10352,7 +10357,9 @@ genPointerGet (iCode * ic, iCode *pi, iCode *ifx)
   etype = getSpec (type);
   /* if left is of type of pointer then it is simple */
   if (IS_PTR (type) && !IS_FUNC (type->next))
-    p_type = DCL_TYPE (type);
+    {
+      p_type = DCL_TYPE (type);
+    }
   else
     {
       /* we have to go by the storage class */