2 xa51 specific general functions.
4 Note that mlh prepended _xa51_ on the static functions. Makes
5 it easier to set a breakpoint using the debugger.
12 static char _defaultRules[] =
17 /* list of key words used by xa51 */
18 static char *_xa51_keywords[] =
48 void _xa51_genAssemblerEnd () {
49 //fprintf (stderr, "Did %d rewind%c for c-line in asm comments\n", rewinds,
50 //rewinds==1 ? '\0' : 's');
53 void xa51_assignRegisters (eBBlock ** ebbs, int count);
55 static int regParmFlg = 0; /* determine if we can register a parameter */
60 asm_addTree (&asm_xa_asm_mapping);
64 _xa51_reset_regparm ()
70 _xa51_regparm (sym_link * l)
73 /* for this processor it is simple
74 can pass only the first parameter in a register */
83 _xa51_parseOptions (int *pargc, char **argv, int *i)
85 /* TODO: allow port-specific command line options to specify
92 _xa51_finaliseOptions (void)
94 port->mem.default_local_map = istack;
95 port->mem.default_globl_map = xdata;
99 _xa51_setDefaultOptions (void)
102 options.intlong_rent=1;
103 options.float_rent=1;
107 _xa51_getRegName (struct regs *reg)
115 _xa51_genAssemblerPreamble (FILE * of)
117 // this needs to be an include file someday
118 fputs ("pswl\tsfr\t0x400\n", of);
119 fputs ("z\tbit\tpswl.0\n", of);
120 fputs ("n\tbit\tpswl.1\n", of);
121 fputs ("v\tbit\tpswl.2\n", of);
122 fputs ("ac\tbit\tpswl.6\n", of);
123 fputs ("cy\tbit\tpswl.7\n", of);
126 /* Generate interrupt vector table. */
128 _xa51_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
130 fprintf (of, "\t.dw\t0x8f00\n");
131 fprintf (of, "\t.dw\t__sdcc_gsinit_startup\n");
136 /* Generate code to copy XINIT to XISEG */
137 static void _xa51_genXINIT (FILE * of) {
138 fprintf (of, "; _xa51_genXINIT() start\n");
139 fprintf (of, " mov r0,#l_XINIT\n");
140 fprintf (of, " beq 00002$\n");
141 fprintf (of, " mov r1,#s_XINIT\n");
142 fprintf (of, " mov r2,#s_XISEG\n");
143 fprintf (of, "00001$ movc r3l,[r1+]\n");
144 fprintf (of, " mov [r2+],r3l\n");
145 fprintf (of, " djnz r0,00001$\n");
146 fprintf (of, "00002$:\n");
147 fprintf (of, "; _xa51_genXINIT() end\n");
151 /* Do CSE estimation */
152 static bool cseCostEstimation (iCode *ic, iCode *pdic)
154 operand *result = IC_RESULT(ic);
155 sym_link *result_type = operandType(result);
157 /* if it is a pointer then return ok for now */
158 if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
160 /* if bitwise | add & subtract then no since xa51 is pretty good at it
161 so we will cse only if they are local (i.e. both ic & pdic belong to
162 the same basic block */
163 if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
164 /* then if they are the same Basic block then ok */
165 if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
169 /* for others it is cheaper to do the cse */
173 /** $1 is always the basename.
174 $2 is always the output file.
176 $l is the list of extra options that should be there somewhere...
177 MUST be terminated with a NULL.
179 static const char *_linkCmd[] =
181 "{bindir}{sep}aslink", "-nf", "$1", NULL
184 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
185 static const char *_asmCmd[] =
187 "xa_asm -dontcomplain", "$l", "$3", "$1.xa", NULL
195 "MCU 80C51XA", /* Target name */
197 TRUE, /* Emit glue around main */
204 "", /* Options with debug */
205 "", /* Options without debug */
208 NULL /* no do_assemble function */
220 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
221 1, 2, 2, 4, 2, 2, 3, 1, 4, 4
236 "XISEG (XDATA)", // initialized xdata
237 "XINIT (CODE)", // a code copy of xiseg
238 NULL, // default local map
239 NULL, // default global map
243 -1, // stack grows down
244 0, // bank overhead NUY
246 4, // function call overhead
247 0, // reentrant overhead NUY
248 0 // banked overhead NUY
250 /* xa51 has an 16 bit mul */
257 _xa51_finaliseOptions,
258 _xa51_setDefaultOptions,
259 xa51_assignRegisters,
262 _xa51_genAssemblerPreamble,
263 _xa51_genAssemblerEnd,
268 NULL, // process_pragma()
269 NULL, // getMangledFunctionName()
270 NULL, // hasNativeMulFor()
271 TRUE, // use_dw_for_init
274 0, /* transform <= to ! > */
275 0, /* transform >= to ! < */
276 0, /* transform != to !(a == b) */
278 FALSE, /* No array initializer support. */
280 NULL, /* no builtin functions */
281 GPOINTER, /* treat unqualified pointers as "generic" pointers */
282 1, /* reset labelKey to 1 */
283 1, /* globals & local static allowed */