From: MaartenBrock Date: Sat, 3 Nov 2007 13:08:55 +0000 (+0000) Subject: * src/mcs51/gen.c (outBitC): optimized for no result X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0eeab15911b113565d0d55f426590f752de1b395;hp=fadd2e4872075e85bf61f52c52c9c7b7ec06e333;p=fw%2Fsdcc * src/mcs51/gen.c (outBitC): optimized for no result git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4958 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index bb4a4847..c0f83b77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-11-03 Maarten Brock + + * src/mcs51/gen.c (outBitC): optimized for no result + 2007-10-31 Borut Razem * src/SDCCsymt.c: fixed (hopeful properly) bug diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index e4c6e5f8..338961c9 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -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 */