"OSEG",
"GSFINAL",
"HOME",
+ NULL, // initialized xdata
+ NULL, // a code copy of xiseg
NULL,
NULL,
0,
_avr_keywords,
_avr_genAssemblerPreamble,
_avr_genIVT,
+ NULL, // _avr_genXINIT
_avr_reset_regparm,
_avr_regparm,
NULL,
while (size--)
{
MOVA (aopGet (AOP (IC_RIGHT (ic)), offset, FALSE, FALSE, TRUE));
- emitcode ("addc", "a,#00");
+ emitcode ("addc", "a,#0");
aopPut (AOP (IC_RESULT (ic)), "a", offset++);
}
_endLazyDPSEvaluation ();
CLRC;
while (size--)
{
- emitcode (";", "genCmp #1: %d/%d/%d", size, sign, offset);
+ //emitcode (";", "genCmp #1: %d/%d/%d", size, sign, offset);
MOVA (aopGet (AOP (left), offset, FALSE, FALSE, TRUE));
- emitcode (";", "genCmp #2");
+ //emitcode (";", "genCmp #2");
if (sign && (size == 0))
{
- emitcode (";", "genCmp #3");
+ //emitcode (";", "genCmp #3");
emitcode ("xrl", "a,#0x80");
if (AOP_TYPE (right) == AOP_LIT)
{
unsigned long lit = (unsigned long)
floatFromVal (AOP (right)->aopu.aop_lit);
- emitcode (";", "genCmp #3.1");
+ //emitcode (";", "genCmp #3.1");
emitcode ("subb", "a,#!constbyte",
0x80 ^ (unsigned int) ((lit >> (offset * 8)) & 0x0FFL));
}
else
{
- emitcode (";", "genCmp #3.2");
+ //emitcode (";", "genCmp #3.2");
if (AOP_NEEDSACC (right))
{
emitcode ("push", "acc");
{
const char *s;
- emitcode (";", "genCmp #4");
+ //emitcode (";", "genCmp #4");
if (AOP_NEEDSACC (right))
{
/* Yuck!! */
- emitcode (";", "genCmp #4.1");
+ //emitcode (";", "genCmp #4.1");
emitcode ("xch", "a, b");
MOVA (aopGet (AOP (right), offset++, FALSE, FALSE, TRUE));
emitcode ("xch", "a, b");
}
else
{
- emitcode (";", "genCmp #4.2");
+ //emitcode (";", "genCmp #4.2");
s = aopGet (AOP (right), offset++, FALSE, FALSE, FALSE);
}
aopOp(left, ic, FALSE, FALSE);
aopOp(result, ic, FALSE, (AOP_TYPE(left) == AOP_DPTR));
-#if 1 // debug spew
+#if 0 // debug spew
if (IS_SYMOP(left) && OP_SYMBOL(left)->aop)
{
emitcode(";", "left (%s) is %d", OP_SYMBOL(left)->rname, AOP_TYPE(left));
"XSEG (XDATA)",
"BSEG (BIT)",
"RSEG (DATA)",
- "GSINIT (CODE)",
+ /* "GSINIT (CODE)", */ "CSEG (CODE)",
"OSEG (OVR,DATA)",
"GSFINAL (CODE)",
- "HOME (CODE)",
+ "HOME (CODE)",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_ds390_keywords,
_ds390_genAssemblerPreamble,
_ds390_genIVT,
+ NULL, // _ds390_genXINIT
_ds390_reset_regparm,
_ds390_regparm,
NULL,
/* since the pack the registers depending strictly on the MCU */
/*-----------------------------------------------------------------*/
-#define D(x)
+#define D(x) x
/* Global data */
static struct
if (OP_SYMBOL(IC_RESULT(ic))->liveTo ==
OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ;
etype = getSpec(type = operandType(IC_RESULT(ic)));
- if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic))) continue ;
+#if 0
+ if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic)))
+ continue ;
+#else
+ if (getSize(type)==0)
+ continue;
+#endif
return NULL ;
}
".DATA",
".TEXT",
".TEXT",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_i186_keywords,
_i186_genAssemblerPreamble,
_i186_genIVT ,
+ NULL, // _i186_genXINIT
_i186_reset_regparm,
_i186_regparm,
NULL,
"OSEG (OVR,DATA)",
"GSFINAL (CODE)",
"HOME (CODE)",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_tlcs900h_keywords,
_tlcs900h_genAssemblerPreamble,
_tlcs900h_genIVT,
+ 0, // _tlcs900h_genXINIT
_tlcs900h_reset_regparm,
_tlcs900h_regparm,
NULL,
freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
}
-/*-----------------------------------------------------------------*/
-/* gen51AggregateAssign - copy complete array's or structures */
-/*-----------------------------------------------------------------*/
-void gen51AggregateAssign(iCode *ic) {
- operand *left=IC_LEFT(ic);
- operand *right=IC_RIGHT(ic);
- char *fromName=OP_SYMBOL(right)->rname;
- char *toName=OP_SYMBOL(left)->rname;
- int fromSize=getSize(OP_SYMBOL(right)->type);
- int toSize=getSize(OP_SYMBOL(left)->type);
- int count=toSize;
-
- D(emitcode (";", "gen51AggregateAssign"));
-
- if (SPEC_OCLS(OP_SYMBOL(left)->etype)!=xdata ||
- SPEC_OCLS(OP_SYMBOL(right)->etype)!=code) {
- // well, this code isn't used yet from anywhere else as for initialising
- fprintf (stderr, "*** error: %s:%d can only assign aggregates from cseg to xseg for now\n", ic->filename, ic->lineno);
- exit (457);
- }
-
- if (fromSize!=toSize) {
- fprintf (stderr, "*** error: %s:%d aggregates have different size\n",
- ic->filename, ic->lineno);
- exit (821);
- }
-
-#if 1
- // use the generic memcpy() for now
- emitcode (";", "initialize %s", OP_SYMBOL(IC_LEFT(ic))->name);
- emitcode ("mov", "dptr,#_memcpy_PARM_2");
- emitcode ("mov", "a,#%s", fromName);
- emitcode ("movx", "@dptr,a");
- emitcode ("inc", "dptr");
- emitcode ("mov", "a,#(%s>>8)", fromName);
- emitcode ("movx", "@dptr,a");
- emitcode ("inc", "dptr");
- emitcode ("mov", "a,#%02x; only from cseg for now", 2);
- emitcode ("movx", "@dptr,a");
- emitcode ("mov", "dptr,#_memcpy_PARM_3");
- emitcode ("mov", "a,#(%d>>0); number of bytes", count);
- emitcode ("movx", "@dptr,a");
- emitcode ("inc", "dptr");
- emitcode ("mov", "a,#(%d>>8)", count);
- emitcode ("movx", "@dptr,a");
- emitcode ("mov", "dptr,#%s", toName);
- emitcode ("mov", "b,#%02x; only to xseg for now", 1);
- emitcode ("lcall", "_memcpy");
-#else
- // more efficient, but will require the native_memcpy_cs2xs
- emitcode ("mov", "r0,#%s", fromName);
- emitcode ("mov", "r1,#(%s>>8)", fromName);
- emitcode ("mov", "r2,#%s", toName);
- emitcode ("mov", "r3,#(%s>>8)", toName);
- emitcode ("mov", "r4,#%d", count);
- emitcode ("mov", "r5,#(%d>>8)", count);
- emitcode ("lcall", "_native_memcpy_cs2xs");
-#endif
-}
-
/*-----------------------------------------------------------------*/
/* gen51Code - generate code for 8051 based controllers */
/*-----------------------------------------------------------------*/
addSet (&_G.sendSet, ic);
break;
- case ARRAYINIT:
- gen51AggregateAssign(ic);
- break;
-
default:
ic = ic;
}
return FALSE;
}
+/* Generate code to copy XINIT to XISEG */
+static void _mcs51_genXINIT (FILE * of) {
+ fprintf (of, "; _mcs51_genXINIT() start\n");
+ fprintf (of, " mov a,#s_XINIT\n");
+ fprintf (of, " add a,#l_XINIT\n");
+ fprintf (of, " mov r1,a\n");
+ fprintf (of, " mov a,#s_XINIT>>8\n");
+ fprintf (of, " addc a,#l_XINIT>>8\n");
+ fprintf (of, " mov r2,a\n");
+ fprintf (of, " mov dptr,#s_XINIT\n");
+ fprintf (of, " mov r0,#s_XISEG\n");
+ fprintf (of, " mov p2,#(s_XISEG >> 8)\n");
+ fprintf (of, "00001$: clr a\n");
+ fprintf (of, " movc a,@a+dptr\n");
+ fprintf (of, " movx @r0,a\n");
+ fprintf (of, " inc dptr\n");
+ fprintf (of, " inc r0\n");
+ fprintf (of, " cjne r0,#0,00002$\n");
+ fprintf (of, " inc p2\n");
+ fprintf (of, "00002$: mov a,dpl\n");
+ fprintf (of, " cjne a,ar1,00001$\n");
+ fprintf (of, " mov a,dph\n");
+ fprintf (of, " cjne a,ar2,00001$\n");
+ fprintf (of, " mov p2,#0xFF\n");
+ fprintf (of, "; _mcs51_genXINIT() end\n");
+}
+
+
/* Do CSE estimation */
static bool cseCostEstimation (iCode *ic, iCode *pdic)
{
"XSEG (XDATA)",
"BSEG (BIT)",
"RSEG (DATA)",
- "GSINIT (CODE)",
+ /* "GSINIT (CODE)", */ "CSEG (CODE)",
"OSEG (OVR,DATA)",
"GSFINAL (CODE)",
- "HOME (CODE)",
+ "HOME (CODE)",
+ "XISEG (XDATA)", // initialized xdata
+ "XINIT (CODE)", // a code copy of xiseg
NULL,
NULL,
1
_mcs51_keywords,
_mcs51_genAssemblerPreamble,
_mcs51_genIVT,
+ _mcs51_genXINIT,
_mcs51_reset_regparm,
_mcs51_regparm,
NULL,
rifx->generated = 1;
}
+#if 0
/*-----------------------------------------------------------------*/
/* genChkZeroes :- greater or less than comparison */
/* For each byte in a literal that is zero, inclusive or the */
return (flag==0);
}
+#endif
/*-----------------------------------------------------------------*/
/* genCmp :- greater or less than comparison */
} else {
symbol *lbl = newiTempLabel(NULL);
- int flag;
int emitFinalCheck=1;
symbol *truelbl = newiTempLabel(NULL);
/* special cases */
if(sign) {
- unsigned int mlit = -lit;
if(lit == 0) {
genSkipCond(&rIfx,left,size,7);
if(sign) {
- int mlit = -lit;
int lp1 = lit+1;
size--;
"OSEG (OVR,DATA)",
"GSFINAL (CODE)",
"HOME (CODE)",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_pic14_keywords,
_pic14_genAssemblerPreamble,
_pic14_genIVT,
+ NULL, // _pic14_genXINIT
_pic14_reset_regparm,
_pic14_regparm,
NULL,
"OVERLAY",
"GSFINAL",
"HOME",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_keywords,
0, /* no assembler preamble */
0, /* no local IVT generation code */
+ 0, /* no genXINIT code */
_reset_regparm,
_reg_parm,
_process_pragma,
"OVERLAY",
"GSFINAL",
"HOME",
+ NULL, // xidata
+ NULL, // xinit
NULL,
NULL,
1
_keywords,
0, /* no assembler preamble */
0, /* no local IVT generation code */
+ 0, /* no genXINIT code */
_reset_regparm,
_reg_parm,
_process_pragma,