From: tecodev Date: Sat, 22 Jan 2005 13:22:07 +0000 (+0000) Subject: * src/SDCCopt.c (killDeadCode): do not throw iCodes away if one X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5a55bd5eca262ce15fa89b7825c74042f89168ae;p=fw%2Fsdcc * src/SDCCopt.c (killDeadCode): do not throw iCodes away if one of the operands is volatile. Fixes #1020220 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3646 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 75a82ee5..2d4c75d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-01-22 Daniel Winkler + + * src/SDCCopt.c (killDeadCode): do not throw iCodes away if one + of the operands is volatile. Fixes #1020220 + 2005-01-22 Daniel Winkler * src/pic16/pcoderegs.c (pCodeOptime2pCodes): reenabled optimization diff --git a/src/SDCCopt.c b/src/SDCCopt.c index f7e67ce6..1377a58e 100644 --- a/src/SDCCopt.c +++ b/src/SDCCopt.c @@ -879,6 +879,18 @@ killDeadCode (eBBlock ** ebbs, int count) if (IC_RESULT (ic) && isOperandVolatile (IC_RESULT (ic), FALSE)) continue; + /* We also cannot remove the iCode, when an operand is volatile. */ + /* Even read access can cause side effects on some hardware registers! */ + + /* if the left operand is volatile then continue */ + if (IC_LEFT(ic) && isOperandVolatile (IC_LEFT (ic), TRUE)) + continue; + + /* if the right operand is volatile then continue */ + if (IC_RIGHT(ic) && isOperandVolatile (IC_RIGHT (ic), TRUE)) + continue; + + /* if the result is a temp & isaddr then skip */ if (IC_RESULT (ic) && POINTER_SET (ic)) continue;