return lic;
}
/* if the operand used or deffed */
- if (bitVectBitValue(ic->uses,op->key) || ic->defKey == op->key) {
+ if (bitVectBitValue(ic->uses,op->key) || ((unsigned) ic->defKey == op->key)) {
return NULL;
}
lic = lic->next;
return NULL;
}
- piCode (ic, stdout);
/* other wise this is true end of the world */
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"getFreePtr should never reach here");
static int
isRegPair (asmop * aop)
{
- if (!aop || aop->size != 2)
+ if (!aop || aop->size < 2)
return 0;
if (aop->type == AOP_X || aop->type == AOP_Z)
return 1;
/* if the type is a conditional */
- if (sym->regType == REG_CND) {
+ if (sym->regType & REG_CND) {
aop = op->aop = sym->aop = newAsmop (AOP_CRY);
aop->size = 0;
return;
static void
genGoto (iCode * ic)
{
- emitcode ("rjmp", "L%05d:", (IC_LABEL (ic)->key + 100));
+ emitcode ("rjmp", "L%05d", (IC_LABEL (ic)->key + 100));
}
/*-----------------------------------------------------------------*/
return TRUE;
}
emitcode ("subi", "%s,lo8(%d)",
- aopGet (AOP (IC_LEFT (ic)), 0), -icount);
+ aopGet (AOP (IC_LEFT (ic)), 0), 0-icount);
return TRUE;
}
/* use subi */
emitcode ("subi", "%s,lo8(%d)",
- aopGet (AOP (IC_RESULT (ic)), 0), -icount);
+ aopGet (AOP (IC_RESULT (ic)), 0), 0-icount);
emitcode ("sbci", "%s,hi8(%d)",
- aopGet (AOP (IC_RESULT (ic)), 1), -icount);
+ aopGet (AOP (IC_RESULT (ic)), 1), 0-icount);
return TRUE;
}
/* for 32 bit longs */
emitcode ("subi", "%s,lo8(%d)", aopGet (AOP (IC_RESULT (ic)), 0),
- -icount);
+ 0-icount);
emitcode ("sbci", "%s,hi8(%d)", aopGet (AOP (IC_RESULT (ic)), 1),
- -icount);
+ 0-icount);
emitcode ("sbci", "%s,hlo8(%d)", aopGet (AOP (IC_RESULT (ic)), 2),
- -icount);
+ 0-icount);
emitcode ("sbci", "%s,hhi8(%d)", aopGet (AOP (IC_RESULT (ic)), 3),
- -icount);
+ 0-icount);
return TRUE;
}
} else {
aop = newAsmop(0);
getFreePtr(ic,&aop,FALSE,TRUE);
-
- emitcode ("mov", "r30,%s", aopGet (AOP (left), 0));
- emitcode ("mov", "r31,%s", aopGet (AOP (left), 1));
- emitcode ("mov", "r0,%s", aopGet (AOP (left), 2));
+ if (isRegPair(AOP(left))) {
+ emitcode ("movw", "r30,%s", aopGet (AOP (left), 0));
+ } else {
+ emitcode ("mov", "r30,%s", aopGet (AOP (left), 0));
+ emitcode ("mov", "r31,%s", aopGet (AOP (left), 1));
+ }
+ emitcode ("mov", "r24,%s", aopGet (AOP (left), 2));
gotFreePtr=1;
}
}
ic->generated = 1;
}
-
+/* here */
/*-----------------------------------------------------------------*/
/* genAddrOf - generates code for address of */
/*-----------------------------------------------------------------*/
while (size--) {
/* Yuck! */
if (options.stack10bit && offset == 2) {
- aopPut (AOP (IC_RESULT (ic)), "#0x40",
+ aopPut (AOP (IC_RESULT (ic)), "0x40",
offset++);
}
else {
while (size--) {
char s[SDCC_NAME_MAX];
if (offset)
- sprintf (s, "#(%s >> %d)", sym->rname, offset * 8);
+ sprintf (s, "(%s >> %d)", sym->rname, offset * 8);
else
- sprintf (s, "#%s", sym->rname);
+ sprintf (s, "%s", sym->rname);
aopPut (AOP (IC_RESULT (ic)), s, offset++);
}
l = one;
break;
case CPOINTER:
- l = "#0x02";
+ l = "0x02";
break;
case PPOINTER:
- l = "#0x03";
+ l = "0x03";
break;
default:
default:
ic = ic;
- /* piCode(ic,stdout); */
-
}
}