"pdata",
"reentrant",
"sfr",
+ "sfr16",
+ "sfr32",
"sbit",
"using",
"xdata",
{ "__builtin_memcmp_x2x","c",3,{"cx*","cx*","i"}}, /* void __builtin_memcmp_x2x (xdata char *,xdata char *,int) */
{ "__builtin_memcmp_c2x","c",3,{"cx*","cp*","i"}}, /* void __builtin_memcmp_c2x (xdata char *,code char *,int) */
{ NULL , NULL,0, {NULL}} /* mark end of table */
-};
-void ds390_assignRegisters (eBBlock ** ebbs, int count);
+};
+void ds390_assignRegisters (ebbIndex * ebbi);
static int regParmFlg = 0; /* determine if we can register a parameter */
}
static void
-_ds390_reset_regparm ()
+_ds390_reset_regparm (void)
{
regParmFlg = 0;
}
static int
-_ds390_regparm (sym_link * l)
+_ds390_regparm (sym_link * l, bool reentrant)
{
-
+ if (IS_SPEC(l) && (SPEC_NOUN(l) == V_BIT))
+ return 0;
if (options.parms_in_bank1 == 0) {
/* simple can pass only the first parameter in a register */
if (regParmFlg)
return 0;
}
regParmFlg += size ;
- return regParmFlg - size + 1;
+ return regParmFlg - size + 1;
}
}
port->stack.isr_overhead += 2; /* Will save dpx on ISR entry. */
- port->stack.call_overhead += 2; /* This acounts for the extra byte
+ port->stack.call_overhead += 2; /* This acounts for the extra byte
* of return addres on the stack.
- * but is ugly. There must be a
+ * but is ugly. There must be a
* better way.
*/
} else {
if (!options.stack_loc) options.stack_loc = 0x400008;
}
-
+
/* generate native code 16*16 mul/div */
- if (options.useAccelerator)
+ if (options.useAccelerator)
port->support.muldiv=2;
- else
+ else
port->support.muldiv=1;
/* Fixup the memory map for the stack; it is now in
if (options.model != MODEL_FLAT24)
{
- /* Let the default code handle it. */
- return FALSE;
+ fprintf (of, "\tljmp\t__sdcc_gsinit_startup\n");
+
+ /* now for the other interrupts */
+ for (i = 0; i < maxInterrupts; i++)
+ {
+ if (interrupts[i])
+ {
+ fprintf (of, "\tljmp\t%s\n", interrupts[i]->rname);
+ if ( i != maxInterrupts - 1 )
+ fprintf (of, "\t.ds\t5\n");
+ }
+ else
+ {
+ fprintf (of, "\treti\n");
+ if ( i != maxInterrupts - 1 )
+ fprintf (of, "\t.ds\t7\n");
+ }
+ }
+ return TRUE;
}
fprintf (of, "\tajmp\t__reset_vect\n");
sym_link *result_type = operandType(result);
//sym_link *right_type = (right ? operandType(right) : 0);
//sym_link *left_type = (left ? operandType(left) : 0);
-
+
/* if it is a pointer then return ok for now */
if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
-
- /* if bitwise | add & subtract then no since mcs51 is pretty good at it
+
+ /* if bitwise | add & subtract then no since mcs51 is pretty good at it
so we will cse only if they are local (i.e. both ic & pdic belong to
the same basic block */
if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
else return 0;
}
-
+
/* for others it is cheaper to do the cse */
return 1;
}
{
if (IN_FARSPACE(oclass))
return 1;
-
+
return 0;
}
instructionSize(char *inst, char *op1, char *op2)
{
int isflat24 = (options.model == MODEL_FLAT24);
-
+
#define ISINST(s) (strncmp(inst, (s), sizeof(s)-1) == 0)
#define IS_A(s) (*(s) == 'a' && *(s+1) == '\0')
#define IS_C(s) (*(s) == 'c' && *(s+1) == '\0')
/* Based on the current (2003-08-22) code generation for the
small library, the top instruction probability is:
-
+
57% mov/movx/movc
6% push
6% pop
if (IS_A (op2) || IS_Rn (op2) || IS_atRi (op2)) return 2;
return 3;
}
-
+
if (ISINST ("push")) return 2;
if (ISINST ("pop")) return 2;
if (ISINST ("acall")) return 2+isflat24;
if (ISINST ("ajmp")) return 2+isflat24;
-
+
if (ISINST ("add") || ISINST ("addc") || ISINST ("subb") || ISINST ("xch"))
{
if (IS_Rn(op2) || IS_atRi(op2)) return 1;
aln->regsWritten = NULL;
aln->initialized = 0;
aln->currentDPS = currentDPS;
-
+
return aln;
}
return strcmp((const char *)key, ((ds390operanddata *)member)->name);
}
-static void
+static void
updateOpRW (asmLineNode *aln, char *op, char *optype, int currentDPS)
{
ds390operanddata *opdat;
int regIdx1 = -1;
int regIdx2 = -1;
int regIdx3 = -1;
-
+
dot = strchr(op, '.');
if (dot)
*dot = '\0';
opdat = bsearch (op, ds390operandDataTable,
sizeof(ds390operandDataTable)/sizeof(ds390operanddata),
sizeof(ds390operanddata), ds390operandCompare);
-
+
if (opdat)
{
regIdx1 = opdat->regIdx1;
regIdx3 = DPX1_IDX;
}
}
-
+
if (strchr(optype,'r'))
{
if (regIdx1 >= 0)
{"xchd", "", "", "rw", "rw"},
{"xrl", "", "", "rw", "r"},
};
-
+
static int
ds390opcodeCompare (const void *key, const void *member)
{
ds390opcodedata *opdat;
aln->initialized = 1;
-
+
p = ln->line;
-
+
while (*p && isspace(*p)) p++;
for (op = inst, opsize=1; *p; p++)
{
if (*p == ';' || *p == ':' || *p == '=')
return aln;
-
+
while (*p && isspace(*p)) p++;
if (*p == '=')
return aln;
*op++ = tolower(*p), opsize++;
}
*op = '\0';
-
+
if (*p == ',') p++;
for (op = op2, opsize=1; *p && *p != ','; p++)
{
"aslink", "-nf", "\"$1\"", NULL
};
-/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */ static const char *_asmCmd[] =
+/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
+static const char *_asmCmd[] =
{
"asx8051", "$l", "$3", "\"$1.asm\"", NULL
};
/* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
1, 2, 2, 4, 1, 2, 3, 1, 4, 4
},
+
+ /* tags for generic pointers */
+ { 0x00, 0x40, 0x60, 0x80 }, /* far, near, xstack, code */
+
{
"XSEG (XDATA)",
"STACK (DATA)",
"CSEG (CODE)",
"DSEG (DATA)",
"ISEG (DATA)",
+ "PSEG (PAG,XDATA)",
"XSEG (XDATA)",
"BSEG (BIT)",
"RSEG (DATA)",
"HOME (CODE)",
"XISEG (XDATA)", // initialized xdata
"XINIT (CODE)", // a code copy of xiseg
+ "CONST (CODE)", // const_name - const data (code or not)
NULL,
NULL,
1
{
ds390_emitDebuggerSymbol
},
+ {
+ 255/4, /* maxCount */
+ 4, /* sizeofElement */
+ {8,12,20}, /* sizeofMatchJump[] */
+ {10,14,22}, /* sizeofRangeCompare[] */
+ 4, /* sizeofSubtract */
+ 7, /* sizeofDispatch */
+ },
"_",
_ds390_init,
_ds390_parseOptions,
}
port->s.fptr_size = 3;
port->s.gptr_size = 4;
-
+
port->stack.isr_overhead += 2; /* Will save dpx on ISR entry. */
-
- port->stack.call_overhead += 2; /* This acounts for the extra byte
+
+ port->stack.call_overhead += 2; /* This acounts for the extra byte
* of return addres on the stack.
- * but is ugly. There must be a
+ * but is ugly. There must be a
* better way.
*/
-
+
port->mem.default_local_map = xdata;
port->mem.default_globl_map = xdata;
-
+
if (!options.stack10bit) {
options.stack10bit = 1;
fprintf(stderr,"TININative supports only stack10bit \n");
}
-
+
if (!options.stack_loc) options.stack_loc = 0x400008;
-
+
/* generate native code 16*16 mul/div */
- if (options.useAccelerator)
+ if (options.useAccelerator)
port->support.muldiv=2;
- else
+ else
port->support.muldiv=1;
-
+
/* Fixup the memory map for the stack; it is now in
* far space and requires a FPOINTER to access it.
*/
options.cc_only =1;
}
-static int _tininative_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
+static int _tininative_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
{
- return 1;
+ return TRUE;
}
static void _tininative_genAssemblerPreamble (FILE * of)
{
buildCmdLine(buffer,a390Cmd,dstFileName,NULL,NULL,asmOptions);
if (my_system(buffer)) {
exit(1);
- }
+ }
}
/* list of key words used by TININative */
{ "System_GetCurrentProcessId","c",0,{NULL}}, /* char System_GetCurrentProcessId() */
{ "System_GetCurrentThreadId","c",0,{NULL}}, /* char System_GetCurrentThreadId() */
{ NULL , NULL,0, {NULL}} /* mark end of table */
-};
+};
static const char *_a390Cmd[] =
{
/* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
1, 2, 2, 4, 1, 3, 3, 1, 4, 4
},
+ /* tags for generic pointers */
+ { 0x00, 0x40, 0x60, 0x80 }, /* far, near, xstack, code */
+
{
"XSEG (XDATA)",
"STACK (DATA)",
"CSEG (CODE)",
"DSEG (DATA)",
"ISEG (DATA)",
+ "PSEG (PAG,XDATA)",
"XSEG (XDATA)",
"BSEG (BIT)",
"RSEG (DATA)",
"GSINIT (CODE)",
"OSEG (OVR,DATA)",
"GSFINAL (CODE)",
- "HOME (CODE)",
+ "HOME (CODE)",
NULL,
NULL,
+ "CONST (CODE)", // const_name - const data (code or not)
NULL,
NULL,
1
{
ds390_emitDebuggerSymbol
},
+ {
+ 255/4, /* maxCount */
+ 4, /* sizeofElement */
+ {8,12,20}, /* sizeofMatchJump[] */
+ {10,14,22}, /* sizeofRangeCompare[] */
+ 4, /* sizeofSubtract */
+ 7, /* sizeofDispatch */
+ },
"",
_tininative_init,
_ds390_parseOptions,
{
/* We can't generate a static IVT, since the boot rom creates one
* for us in rom_init.
- *
+ *
* we must patch it as part of the C startup.
*/
fprintf (of, ";\tDS80C400 IVT must be generated at runtime.\n");
return TRUE;
}
-
+
static void
_ds400_finaliseOptions (void)
// hackhack: we're a superset of the 390.
addSet(&preArgvSet, Safe_strdup("-DSDCC_ds390"));
addSet(&preArgvSet, Safe_strdup("-D__ds390"));
-
+
/* Hack-o-matic: if we are using the flat24 model,
* adjust pointer sizes.
*/
port->stack.isr_overhead += 2; /* Will save dpx on ISR entry. */
- port->stack.call_overhead += 2; /* This acounts for the extra byte
+ port->stack.call_overhead += 2; /* This acounts for the extra byte
* of return addres on the stack.
- * but is ugly. There must be a
+ * but is ugly. There must be a
* better way.
*/
if (!options.stack_loc) options.stack_loc = 0xffdc00;
// assumes IDM1:0 = 1:0, CMA = 1.
}
-
+
/* generate native code 16*16 mul/div */
- if (options.useAccelerator)
+ if (options.useAccelerator)
port->support.muldiv=2;
- else
+ else
port->support.muldiv=1;
/* Fixup the memory map for the stack; it is now in
if (options.parms_in_bank1) {
addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
}
-
+
// the DS400 rom calling interface uses register bank 3.
RegBankUsed[3] = 1;
-
+
} /* MODEL_FLAT24 */
}
/* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
1, 2, 2, 4, 1, 2, 3, 1, 4, 4
},
+
+ /* tags for generic pointers */
+ { 0x00, 0x40, 0x60, 0x80 }, /* far, near, xstack, code */
+
{
"XSEG (XDATA)",
"STACK (DATA)",
"CSEG (CODE)",
"DSEG (DATA)",
"ISEG (DATA)",
+ "PSEG (PAG,XDATA)",
"XSEG (XDATA)",
"BSEG (BIT)",
"RSEG (DATA)",
"HOME (CODE)",
"XISEG (XDATA)", // initialized xdata
"XINIT (CODE)", // a code copy of xiseg
+ "CONST (CODE)", // const_name - const data (code or not)
NULL,
NULL,
1
{
ds390_emitDebuggerSymbol
},
+ {
+ 255/4, /* maxCount */
+ 4, /* sizeofElement */
+ {8,12,20}, /* sizeofMatchJump[] */
+ {10,14,22}, /* sizeofRangeCompare[] */
+ 4, /* sizeofSubtract */
+ 7, /* sizeofDispatch */
+ },
"_",
_ds390_init,
_ds390_parseOptions,