From f531064b9bdf85c649dad884976b42acf0179dfc Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Fri, 30 May 2003 00:28:28 +0000 Subject: [PATCH] * src/pic/device.c: added 16F819, patch by "David I. Lehn" * 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 | 5 +++++ src/SDCCcse.c | 48 ++++++++++++++++++++++++++++++++++++++---------- src/pic/device.c | 8 ++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f311f7f..95f9782f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-05-29 Bernhard Held + + * src/pic/device.c: added 16F819, patch by "David I. Lehn" + * src/SDCCcse.c (algebraicOpts): fixed "c * 1" + 2003-05-28 Bernhard Held * doc/sdccman.lyx: fix double dash and other minor things diff --git a/src/SDCCcse.c b/src/SDCCcse.c index cfa79af1..dc51ea48 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -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; } } diff --git a/src/pic/device.c b/src/pic/device.c index e41b1b02..2a2cd646 100644 --- a/src/pic/device.c +++ b/src/pic/device.c @@ -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); -- 2.30.2