* src/pic/device.c: added 16F819, patch by "David I. Lehn" <dlehn@vt.edu>
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 30 May 2003 00:28:28 +0000 (00:28 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 30 May 2003 00:28:28 +0000 (00:28 +0000)
* src/SDCCcse.c (algebraicOpts): fixed "c * 1"

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

ChangeLog
src/SDCCcse.c
src/pic/device.c

index 2f311f7f300d0321e1fbccf45a9543d06e1c1999..95f9782f318f5b1d758939f38e2f735b6e08a790 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-29  Bernhard Held <bernhard@bernhardheld.de>
+
+       * src/pic/device.c: added 16F819, patch by "David I. Lehn" <dlehn@vt.edu>
+       * src/SDCCcse.c (algebraicOpts): fixed "c * 1" 
+
 2003-05-28  Bernhard Held <bernhard@bernhardheld.de>
 
        * doc/sdccman.lyx: fix double dash and other minor things
index cfa79af14eb0c2014198aef4cabcb0c17d6ab1c9..dc51ea481d0603be56001d7fb85efdf63dfa0ce5 100644 (file)
@@ -281,7 +281,7 @@ DEFSETFUNC (findCheaperOp)
        /* if the result is volatile then return result */
        if (IS_OP_VOLATILE (IC_RESULT (cdp->diCode)))
          *opp = IC_RESULT (cdp->diCode);
-       else 
+       else
          /* if this is a straight assignment and
             left is a temp then prefer the temporary to the
             true symbol */
@@ -624,7 +624,7 @@ iCode *findBackwardDef(operand *op,iCode *ic)
     iCode *lic;
 
     for (lic = ic; lic ; lic = lic->prev) {
-       if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic))) 
+       if (IC_RESULT(lic) && isOperandEqual(op,IC_RESULT(lic)))
            return lic;
     }
     return NULL;
@@ -812,10 +812,21 @@ algebraicOpts (iCode * ic)
            }
          if (operandLitValue (IC_LEFT (ic)) == 1.0)
            {
-             ic->op = '=';
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
-             return;
+             /* '*' can have two unsigned chars as operands */
+             /* and an unsigned int as result.              */
+             if (compareType (operandType (IC_RESULT (ic)),
+                              operandType (IC_RIGHT (ic))) == 1)
+               {
+                 ic->op = '=';
+                 IC_LEFT (ic) = NULL;
+                 SET_RESULT_RIGHT (ic);
+               }
+             else
+               {
+                 ic->op = CAST;
+                 IC_LEFT (ic)->type = TYPE;
+                 setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+               }
            }
        }
 
@@ -832,10 +843,27 @@ algebraicOpts (iCode * ic)
 
          if (operandLitValue (IC_RIGHT (ic)) == 1.0)
            {
-             ic->op = '=';
-             IC_RIGHT (ic) = IC_LEFT (ic);
-             IC_LEFT (ic) = NULL;
-             SET_RESULT_RIGHT (ic);
+             /* '*' can have two unsigned chars as operands */
+             /* and an unsigned int as result.              */
+             if (compareType (operandType (IC_RESULT (ic)),
+                              operandType (IC_LEFT (ic))) == 1)
+               {
+                 ic->op = '=';
+                 IC_RIGHT (ic) = IC_LEFT (ic);
+                 IC_LEFT (ic) = NULL;
+                 SET_RESULT_RIGHT (ic);
+               }
+             else
+               {
+                  operand *op;
+
+                 ic->op = CAST;
+                 op = IC_RIGHT (ic);
+                 IC_RIGHT (ic) = IC_LEFT (ic);
+                 IC_LEFT (ic) = op;
+                 IC_LEFT (ic)->type = TYPE;
+                 setOperandType (IC_LEFT (ic), operandType (IC_RESULT (ic)));
+               }
              return;
            }
        }
index e41b1b02d9d06073fa2af50142e0a52d8a9555d8..2a2cd646cf244135042eafb5bfba82eb14ac443a 100644 (file)
@@ -75,6 +75,14 @@ static PIC_device Pics[] = {
     0x180,
   },
 
+  {
+    {"p16f819", "16f819", "pic16f819", "f819"},
+    (memRange *)NULL,
+    (memRange *)NULL,
+    0,
+    0x80,
+  },
+
 };
 
 static int num_of_supported_PICS = sizeof(Pics)/sizeof(PIC_device);