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)
}
-/*-----------------------------------------------------------------*/
-/* 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<shCount;i++) {
- AccAXLsh1 (x);
- }
-}
-
-/*-----------------------------------------------------------------*/
-/* AccAXRsh - right shift a:x known count (0..7) */
-/*-----------------------------------------------------------------*/
-static void
-AccAXRsh (char *x, int shCount)
-{
- int i;
-
- for (i=0;i<shCount;i++) {
- AccAXRsh1 (x);
- }
-
-}
-
-/*-----------------------------------------------------------------*/
-/* AccAXRshS - right shift signed a:x known count (0..7) */
-/*-----------------------------------------------------------------*/
-static void
-AccAXRshS (char *x, int shCount)
-{
- int i;
-
- for (i=0;i<shCount;i++) {
- AccAXRshS1 (x);
- }
-}
-
/*-----------------------------------------------------------------*/
/* shiftL2Left2Result - shift left two bytes from left to result */
/*-----------------------------------------------------------------*/
D(emitcode ("; genlshTwo",""));
+
size = getDataSize (result);
/* if shCount >= 8 */
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);
}
/* 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);
}
}
freeAsmop (result, NULL, ic, TRUE);
}
+#if 0
/*-----------------------------------------------------------------*/
/* genNearPointerGet - emitcode for near pointer fetch */
/*-----------------------------------------------------------------*/
}
hc08_freeReg (hc08_reg_hx);
-
}
-
+#endif
/*-----------------------------------------------------------------*/
/* genFarPointerGet - get value from far space */
freeAsmop (NULL, derefaop, ic, TRUE);
}
+#if 0
/*-----------------------------------------------------------------*/
/* genNearPointerSet - emitcode for near pointer put */
/*-----------------------------------------------------------------*/
hc08_freeReg (hc08_reg_hx);
}
-
+#endif
/*-----------------------------------------------------------------*/
/* genFarPointerSet - set value from far space */
return 0;
}
+#if 0
/*-----------------------------------------------------------------*/
/* farSpacePackable - returns the packable icode for far variables */
/*-----------------------------------------------------------------*/
return NULL;
}
+#endif
/*-----------------------------------------------------------------*/
/* packRegsForAssign - register reduction for assignment */
#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
+#if 0
/*-----------------------------------------------------------------*/
/* packRegsForOneuse : - will reduce some registers for single Use */
/*-----------------------------------------------------------------*/
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;
OP_SYMBOL (op)->ruonly = 1;
return sic;
}
+#endif
/*-----------------------------------------------------------------*/
/* isBitwiseOptimizable - requirements of JEAN LOUIS VERN */
}
- #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)
|| (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