return 0;
}
+/*-----------------------------------------------------------------*/
+/* flat24bitMode - will check to see if we are in flat24 mode */
+/*-----------------------------------------------------------------*/
+FBYNAME(flat24bitMode)
+{
+ return (options.model == MODEL_FLAT24);
+}
+
/*-----------------------------------------------------------------*/
/* labelInRange - will check to see if label %5 is within range */
/*-----------------------------------------------------------------*/
int (*func)(hTab *,lineNode *,lineNode *) ;
} ftab[] = {
{"labelInRange", labelInRange },
- {"operandsNotSame", operandsNotSame }
+ {"operandsNotSame", operandsNotSame },
+ {"24bitMode", flat24bitMode },
};
int i;
static char *zero = "#0x00";
static char *one = "#0x01";
static char *spname ;
-static char *fReturn[] = {"dpl","dph","b","a" };
+
+static char *fReturn8051[] = {"dpl","dph","b","a" };
+static char *fReturn390[] = {"dpl","dph","dpx", "b","a" };
+static unsigned fReturnSize = 4;
+static char **fReturn = fReturn8051;
static char *accUse[] = {"a","b"};
static short rbank = -1;
int i;
aop = op->aop = sym->aop = newAsmop(AOP_STR);
aop->size = getSize(sym->type);
- for ( i = 0 ; i < 4 ; i++ )
+ for ( i = 0 ; i < fReturnSize ; i++ )
aop->aopu.aop_str[i] = fReturn[i];
return;
}
IS_TRUE_SYMOP(IC_RESULT(ic))) ) {
int size = getSize(operandType(IC_RESULT(ic)));
- int offset = 4 - size;
+ int offset = fReturnSize - size;
while (size--) {
- emitcode ("push","%s", (strcmp(fReturn[3 - offset],"a") ?
- fReturn[3 - offset] : "acc"));
+ emitcode ("push","%s", (strcmp(fReturn[fReturnSize - offset - 1],"a") ?
+ fReturn[fReturnSize - offset - 1] : "acc"));
offset++;
}
aopOp(IC_RESULT(ic),ic,FALSE);
iCode *ic;
int cln = 0;
+ /* Hack-o-matic: change fReturn based on model. */
+ if (options.model == MODEL_FLAT24)
+ {
+ fReturn = fReturn390;
+ fReturnSize = 5;
+ }
+
lineHead = lineCurr = NULL;
/* if debug information required */
orl a,r%2
}
+replace {
+ mov %1,a
+ mov dpl,%2
+ mov dph,%3
+ mov dpx,%4
+ mov a,%1
+} by {
+ ; Peephole 136a removed redundant moves
+ mov %1,a
+ mov dpl,%2
+ mov dph,%3
+ mov dpx,%4
+} if 24bitMode
+
replace {
mov %1,a
mov dpl,%2
clr a
}
+replace {
+ mov dpl,#0x00
+ mov dph,#0x00
+ mov dpx,#0x00
+} by {
+ ; Peephole 181a used 24 bit load of dptr
+ mov dptr,#0x0000
+} if 24bitMode
+
// saving 3 byte, 2 cycles, return(NULL) profits here
replace {
mov dpl,#0x00
mov dptr,#0x0000
}
+// saves 2 bytes, ?? cycles.
+replace {
+ mov dpl,#%1
+ mov dph,#(%1 >> 8)
+ mov dpx,#(%1 >> 16)
+} by {
+ ; Peephole 182a used 24 bit load of dptr
+ mov dptr,#%1
+} if 24bitMode
+
// saving 3 byte, 2 cycles, return(float_constant) profits here
replace {
mov dpl,#%1
inc %1
}
+replace {
+ mov dptr,#((((%1 >> 16)) <<16) + (((%1 >> 8)) <<8) + %1)
+} by {
+ ; Peephole 210a simplified expression
+ mov dptr,#%1
+} if 24bitMode
+
replace {
mov dptr,#((((%1 >> 8)) <<8) + %1)
} by {
mov @r%1,a
inc r%1
mov @r%1,a
+}
+
+replace {
+ clr a
+ movx @dptr,a
+ mov dptr,%1
+ clr a
+ movx @dptr,a
+} by {
+ ; Peephole 219 removed redundant clear
+ clr a
+ movx @dptr,a
+ mov dptr,%1
+ movx @dptr,a
+}
+
+replace {
+ clr a
+ movx @dptr,a
+ mov dptr,%1
+ movx @dptr,a
+ mov dptr,%2
+ clr a
+ movx @dptr,a
+} by {
+ ; Peephole 219a removed redundant clear
+ clr a
+ movx @dptr,a
+ mov dptr,%1
+ movx @dptr,a
+ mov dptr,%2
+ movx @dptr,a
}
\ No newline at end of file