From: epetrich Date: Tue, 28 Oct 2003 05:15:01 +0000 (+0000) Subject: * as/hc08/asm.h, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9a62abdbae6dc14565e2d8b593f6716a90d08119;p=fw%2Fsdcc * as/hc08/asm.h, * as/hc08/lkrloc.c, * src/hc08/gen.c, * src/hc08/ralloc.c: Fix various warnings related to the hc08 * src/SDCCicode.c (geniCodePreInc, geniCodePreDec): Fixed bug #829717 (tweaked fix for bug #818696) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2961 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index b2ea2977..eb11a4c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-10-28 Erik Petrich + + * as/hc08/asm.h, + * as/hc08/lkrloc.c, + * src/hc08/gen.c, + * src/hc08/ralloc.c: Fix various warnings related to the hc08 + * src/SDCCicode.c (geniCodePreInc, geniCodePreDec): Fixed bug #829717 + (tweaked fix for bug #818696) + 2003-10-23 Erik Petrich * src/z80/ralloc.c (joinPushes): Fixed bug #828742 diff --git a/as/hc08/asm.h b/as/hc08/asm.h index c81374ab..c145aae4 100644 --- a/as/hc08/asm.h +++ b/as/hc08/asm.h @@ -658,6 +658,7 @@ extern VOID out_tw(); extern VOID out_t24(int); extern VOID outr11(); /* JLH */ extern VOID outr19(struct expr *, int, int); +extern VOID outdp(struct area *, struct expr *); /* asstore.c */ extern char *StoreString( char *str ); diff --git a/as/hc08/lkrloc.c b/as/hc08/lkrloc.c index cf761024..8ff6ce5f 100644 --- a/as/hc08/lkrloc.c +++ b/as/hc08/lkrloc.c @@ -515,6 +515,7 @@ relr() /* JLH: output only if data (beyond two byte address) */ if ((oflag == 1) && (rtcnt > 2)) { +#if 0 int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff; /* Boy, is this a hack: for ABS sections, the @@ -542,7 +543,6 @@ relr() newArea(); } -#if 0 if (extendedAddress != lastExtendedAddress) { diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 82199b50..ad97a2a8 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -2402,7 +2402,7 @@ geniCodePreInc (operand * op, bool lvalue) ADDTOCHAIN (ic); (void) geniCodeAssign (op, result, 0); - if (lvalue) + if (lvalue || IS_TRUE_SYMOP (op)) return op; else return result; @@ -2485,7 +2485,7 @@ geniCodePreDec (operand * op, bool lvalue) ADDTOCHAIN (ic); (void) geniCodeAssign (op, result, 0); - if (lvalue) + if (lvalue || IS_TRUE_SYMOP (op)) return op; else return result; diff --git a/src/hc08/gen.c b/src/hc08/gen.c index 2bcb3ca5..04dafb2e 100644 --- a/src/hc08/gen.c +++ b/src/hc08/gen.c @@ -5277,7 +5277,7 @@ XAccRsh (int shCount, bool sign) return; } - shCount &= 0x000f; // shCount : 0..7 + shCount &= 0x000f; // shCount : 0..f /* if we can beat 2n cycles or bytes for some special case, do it here */ switch (shCount) @@ -5415,87 +5415,6 @@ movLeft2Result (operand * left, int offl, } -/*-----------------------------------------------------------------*/ -/* AccAXRsh1 - right shift 0->a:x->c by 1 */ -/*-----------------------------------------------------------------*/ -static void -AccAXRsh1 (char *x) -{ - emitcode ("lsra", ""); - emitcode ("ror", "%s", x); -} - - -/*-----------------------------------------------------------------*/ -/* AccAXRshS1 - signed right shift s->a:x->c by 1 */ -/*-----------------------------------------------------------------*/ -static void -AccAXRshS1 (char *x) -{ - emitcode ("asra", ""); - emitcode ("ror", "%s", x); -} - -/*-----------------------------------------------------------------*/ -/* AccAXLrl1 - left rotate c<-a:x<-c by 1 */ -/*-----------------------------------------------------------------*/ -static void -AccAXLrl1 (char *x) -{ - emitcode ("rol", "%s", x); - emitcode ("rola", ""); -} - -/*-----------------------------------------------------------------*/ -/* AccAXLsh1 - left shift a:x<-0 by 1 */ -/*-----------------------------------------------------------------*/ -static void -AccAXLsh1 (char *x) -{ - emitcode ("lsl", "%s", x); - emitcode ("rola", ""); -} - -/*-----------------------------------------------------------------*/ -/* AccAXLsh - left shift a:x by known count (0..7) */ -/*-----------------------------------------------------------------*/ -static void -AccAXLsh (char *x, int shCount) -{ - int i; - - for (i=0;i= 8 */ @@ -5634,10 +5554,9 @@ genlshTwo (operand * result, operand * left, int shCount) if (size > 1) { - if (shCount) - shiftL1Left2Result (left, LSB, result, MSB16, shCount); - else - movLeft2Result (left, LSB, result, MSB16, 0); + loadRegFromAop (hc08_reg_a, AOP (left), 0); + AccLsh (shCount); + storeRegToAop (hc08_reg_a, AOP (result), 1); } storeConstToAop(zero, AOP (result), LSB); } @@ -5645,10 +5564,9 @@ genlshTwo (operand * result, operand * left, int shCount) /* 1 <= shCount <= 7 */ else { - if (size == 1) - shiftL1Left2Result (left, LSB, result, LSB, shCount); - else - shiftL2Left2Result (left, LSB, result, LSB, shCount); + loadRegFromAop (hc08_reg_xa, AOP (left), 0); + XAccLsh (shCount); + storeRegToFullAop (hc08_reg_xa, AOP (result), 0); } } @@ -6343,6 +6261,7 @@ genDataPointerGet (operand * left, freeAsmop (result, NULL, ic, TRUE); } +#if 0 /*-----------------------------------------------------------------*/ /* genNearPointerGet - emitcode for near pointer fetch */ /*-----------------------------------------------------------------*/ @@ -6415,9 +6334,8 @@ genNearPointerGet (operand * left, } hc08_freeReg (hc08_reg_hx); - } - +#endif /*-----------------------------------------------------------------*/ /* genFarPointerGet - get value from far space */ @@ -6699,6 +6617,7 @@ genDataPointerSet (operand * right, freeAsmop (NULL, derefaop, ic, TRUE); } +#if 0 /*-----------------------------------------------------------------*/ /* genNearPointerSet - emitcode for near pointer put */ /*-----------------------------------------------------------------*/ @@ -6770,7 +6689,7 @@ genNearPointerSet (operand * right, hc08_freeReg (hc08_reg_hx); } - +#endif /*-----------------------------------------------------------------*/ /* genFarPointerSet - set value from far space */ diff --git a/src/hc08/ralloc.c b/src/hc08/ralloc.c index cbd8b828..f70c369b 100644 --- a/src/hc08/ralloc.c +++ b/src/hc08/ralloc.c @@ -1768,6 +1768,7 @@ DEFSETFUNC (deallocStackSpil) return 0; } +#if 0 /*-----------------------------------------------------------------*/ /* farSpacePackable - returns the packable icode for far variables */ /*-----------------------------------------------------------------*/ @@ -1835,6 +1836,7 @@ farSpacePackable (iCode * ic) return NULL; } +#endif /*-----------------------------------------------------------------*/ /* packRegsForAssign - register reduction for assignment */ @@ -2172,6 +2174,7 @@ packRegsForSupport (iCode * ic, eBBlock * ebp) #define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly) +#if 0 /*-----------------------------------------------------------------*/ /* packRegsForOneuse : - will reduce some registers for single Use */ /*-----------------------------------------------------------------*/ @@ -2185,8 +2188,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp) if (!IS_SYMOP (op)) return NULL; - /* only upto 2 bytes since we cannot predict - the usage of b, & acc */ + /* only up to 2 bytes */ if (getSize (operandType (op)) > (fReturnSizeHC08 - 2)) return NULL; @@ -2328,6 +2330,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp) OP_SYMBOL (op)->ruonly = 1; return sic; } +#endif /*-----------------------------------------------------------------*/ /* isBitwiseOptimizable - requirements of JEAN LOUIS VERN */ @@ -2889,14 +2892,14 @@ packRegisters (eBBlock ** ebpp, int blockno) } - #if 0 + #if 1 /* pack registers for accumulator use, when the result of an arithmetic or bit wise operation has only one use, that use is immediately following the defintion and the using iCode has only one operand or has two operands but one is literal & the result of that operation is not on stack then - we can leave the result of this operation in acc:b + we can leave the result of this operation in x:a combination */ if ((IS_ARITHMETIC_OP (ic) || IS_CONDITIONAL(ic) @@ -2907,7 +2910,7 @@ packRegisters (eBBlock ** ebpp, int blockno) || (ic->op == ADDRESS_OF && isOperandOnStack (IC_LEFT (ic))) ) && IS_ITEMP (IC_RESULT (ic)) && - getSize (operandType (IC_RESULT (ic))) <= 2) + getSize (operandType (IC_RESULT (ic))) <= 1) packRegsForAccUse (ic); #endif