emitcode("ld","%s,%s", ptr, aopGet(AOP(left),0,TRUE));
else { /* we need to get it byte by byte */
if (IS_GB) {
- bool hack = 0;
- /* PENDING: hack */
- if (AOP_SIZE(left) == 1) {
- hack = 1;
- AOP_SIZE(left) = 2;
- }
emitcode("ld", "e,%s ; 1", aopGet(AOP(left), 0, FALSE));
emitcode("ld", "d,%s ; 2", aopGet(AOP(left), 1, FALSE));
- if (hack)
- AOP_SIZE(left) = 1;
}
else
fetchHL(AOP(left));
/* if the operand is on the stack then we
need to get the stack offset of this
variable */
- if (sym->onStack) {
- /* if it has an offset then we need to compute it */
- if (IS_GB) {
+ if (IS_GB) {
+ if (sym->onStack) {
emitcode("lda", "hl,%d+%d+%d(sp)", sym->stack, _pushed, _spoffset);
emitcode("ld", "d,h");
emitcode("ld", "e,l");
- aopPut(AOP(IC_RESULT(ic)), "e", 0);
- aopPut(AOP(IC_RESULT(ic)), "d", 1);
- goto end;
}
else {
- emitcode("push", "de");
+ emitcode("ld", "de,#%s", sym->rname);
+ }
+ aopPut(AOP(IC_RESULT(ic)), "e", 0);
+ aopPut(AOP(IC_RESULT(ic)), "d", 1);
+ }
+ else {
+ if (sym->onStack) {
+ /* if it has an offset then we need to compute it */
+ emitcode("push", "de");
emitcode("push", "ix");
emitcode("pop", "hl");
emitcode("ld", "de,#%d", sym->stack);
emitcode("add", "hl,de");
emitcode("pop", "de");
}
+ else {
+ emitcode("ld", "hl,#%s", sym->rname);
+ }
+ aopPut(AOP(IC_RESULT(ic)), "l", 0);
+ aopPut(AOP(IC_RESULT(ic)), "h", 1);
}
- else {
- emitcode("ld", "hl,#%s", sym->rname);
- }
- aopPut(AOP(IC_RESULT(ic)), "l", 0);
- aopPut(AOP(IC_RESULT(ic)), "h", 1);
-end:
freeAsmop(IC_RESULT(ic),NULL,ic);
}
if(AOP_TYPE(right) == AOP_LIT)
lit = (unsigned long)floatFromVal(AOP(right)->aopu.aop_lit);
- if((size > 1) &&
+ if (isPair(AOP(result)) && AOP_TYPE(right) == AOP_LIT) {
+ emitcode("ld", "%s,%s", getPairName(AOP(result)), aopGetWord(AOP(right), 0));
+ }
+ else if((size > 1) &&
(AOP_TYPE(result) != AOP_REG) &&
(AOP_TYPE(right) == AOP_LIT) &&
!IS_FLOAT(operandType(right)) &&
dic = NULL;
break;
}
+#if 0
if (POINTER_SET(dic) &&
IC_RESULT(dic)->key == IC_RESULT(ic)->key ) {
dic = NULL ;
break;
}
+#endif
}
if (!dic)
bool opPreservesA(iCode *ic, iCode *uic)
{
/* if the usage has only one operand then we can */
- if (IC_LEFT(ic) == NULL ||
- IC_RIGHT(ic) == NULL)
+ if (IC_LEFT(uic) == NULL ||
+ IC_RIGHT(uic) == NULL)
return TRUE;
+ if (getSize(operandType(IC_RESULT(uic))) > 1) {
+ return FALSE;
+ }
+
if (uic->op != '=' &&
!IS_ARITHMETIC_OP(uic) &&
!IS_BITWISE_OP(uic) &&
uic->op != EQ_OP &&
uic->op != LEFT_OP &&
+ !POINTER_GET(uic) &&
uic->op != RIGHT_OP ) {
return FALSE;
}
static void packRegsForAccUse2(iCode *ic)
{
iCode *uic;
-
+
/* if + or - then it has to be one byte result.
MLH: Ok.
*/
!options.model)
packRegsForOneuse (ic,IC_LEFT(ic),ebp);
#endif
-
- if (!IS_GB) {
- /* if pointer set & left has a size more than
+ /* if pointer set & left has a size more than
one and right is not in far space */
- if (POINTER_SET(ic) &&
- /* MLH: no such thing.
- !isOperandInFarSpace(IC_RIGHT(ic)) && */
- !OP_SYMBOL(IC_RESULT(ic))->remat &&
- !IS_OP_RUONLY(IC_RIGHT(ic)) &&
- getSize(aggrToPtr(operandType(IC_RESULT(ic)),FALSE)) > 1 )
-
- packRegsForOneuse (ic,IC_RESULT(ic),ebp);
-
- /* if pointer get */
- if (POINTER_GET(ic) &&
- /* MLH: dont have far space
- !isOperandInFarSpace(IC_RESULT(ic))&& */
- !OP_SYMBOL(IC_LEFT(ic))->remat &&
- !IS_OP_RUONLY(IC_RESULT(ic)) &&
- getSize(aggrToPtr(operandType(IC_LEFT(ic)),FALSE)) > 1 )
- packRegsForOneuse (ic,IC_LEFT(ic),ebp);
- }
-
+ if (POINTER_SET(ic) &&
+ /* MLH: no such thing.
+ !isOperandInFarSpace(IC_RIGHT(ic)) && */
+ !OP_SYMBOL(IC_RESULT(ic))->remat &&
+ !IS_OP_RUONLY(IC_RIGHT(ic)) &&
+ getSize(aggrToPtr(operandType(IC_RESULT(ic)),FALSE)) > 1 )
+
+ packRegsForOneuse (ic,IC_RESULT(ic),ebp);
+
+ /* if pointer get */
+ if (POINTER_GET(ic) &&
+ /* MLH: dont have far space
+ !isOperandInFarSpace(IC_RESULT(ic))&& */
+ !OP_SYMBOL(IC_LEFT(ic))->remat &&
+ !IS_OP_RUONLY(IC_RESULT(ic)) &&
+ getSize(aggrToPtr(operandType(IC_LEFT(ic)),FALSE)) > 1 )
+ packRegsForOneuse (ic,IC_LEFT(ic),ebp);
/* 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 combination */
+#if 0
#if 0
if ((IS_ARITHMETIC_OP(ic)
|| IS_BITWISE_OP(ic)
getSize(operandType(IC_RESULT(ic))) <= 2)
packRegsForAccUse (ic);
#else
- if (!IS_GB) {
- if ((POINTER_GET(ic) ||
- IS_ARITHMETIC_OP(ic) ||
- IS_BITWISE_OP(ic) ||
- ic->op == LEFT_OP ||
- ic->op == RIGHT_OP
- ) &&
- IS_ITEMP(IC_RESULT(ic)) &&
- getSize(operandType(IC_RESULT(ic))) == 1)
- packRegsForAccUse2(ic);
- }
+ if (IS_ITEMP(IC_RESULT(ic)) &&
+ getSize(operandType(IC_RESULT(ic))) == 1)
+ packRegsForAccUse2(ic);
+#endif
#endif
}
}