* as/mcs51/asexpr.c (expr): disabled warning "not in .flat24 mode",
[fw/sdcc] / src / mcs51 / main.c
1 /** @file main.c
2     mcs51 specific general functions.
3
4     Note that mlh prepended _mcs51_ on the static functions.  Makes
5     it easier to set a breakpoint using the debugger.
6 */
7 #include "common.h"
8 #include "main.h"
9 #include "ralloc.h"
10 #include "gen.h"
11 #include "../SDCCutil.h"
12
13 static char _defaultRules[] =
14 {
15 #include "peeph.rul"
16 };
17
18 /* list of key words used by msc51 */
19 static char *_mcs51_keywords[] =
20 {
21   "at",
22   "bit",
23   "code",
24   "critical",
25   "data",
26   "far",
27   "idata",
28   "interrupt",
29   "near",
30   "pdata",
31   "reentrant",
32   "sfr",
33   "sfr16",
34   "sfr32",
35   "sbit",
36   "using",
37   "xdata",
38   "_data",
39   "_code",
40   "_generic",
41   "_near",
42   "_xdata",
43   "_pdata",
44   "_idata",
45   "_naked",
46   "_overlay",
47   NULL
48 };
49
50
51
52 void mcs51_assignRegisters (ebbIndex *);
53
54 static int regParmFlg = 0;      /* determine if we can register a parameter */
55
56 static void
57 _mcs51_init (void)
58 {
59   asm_addTree (&asm_asxxxx_mapping);
60 }
61
62 static void
63 _mcs51_reset_regparm (void)
64 {
65   regParmFlg = 0;
66 }
67
68 static int
69 _mcs51_regparm (sym_link * l)
70 {
71     if (IS_SPEC(l) && (SPEC_NOUN(l) == V_BIT))
72         return 0;
73     if (options.parms_in_bank1 == 0) {
74         /* simple can pass only the first parameter in a register */
75         if (regParmFlg)
76             return 0;
77
78         regParmFlg = 1;
79         return 1;
80     } else {
81         int size = getSize(l);
82         int remain ;
83
84         /* first one goes the usual way to DPTR */
85         if (regParmFlg == 0) {
86             regParmFlg += 4 ;
87             return 1;
88         }
89         /* second one onwards goes to RB1_0 thru RB1_7 */
90         remain = regParmFlg - 4;
91         if (size > (8 - remain)) {
92             regParmFlg = 12 ;
93             return 0;
94         }
95         regParmFlg += size ;
96         return regParmFlg - size + 1;
97     }
98 }
99
100 static bool
101 _mcs51_parseOptions (int *pargc, char **argv, int *i)
102 {
103   /* TODO: allow port-specific command line options to specify
104    * segment names here.
105    */
106   return FALSE;
107 }
108
109 static void
110 _mcs51_finaliseOptions (void)
111 {
112   if (options.noXinitOpt) {
113     port->genXINIT=0;
114   }
115
116   if (options.model == MODEL_LARGE) {
117       port->mem.default_local_map = xdata;
118       port->mem.default_globl_map = xdata;
119     }
120   else
121     {
122       port->mem.default_local_map = data;
123       port->mem.default_globl_map = data;
124     }
125
126   if (options.parms_in_bank1) {
127       addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1"));
128   }
129 }
130
131 static void
132 _mcs51_setDefaultOptions (void)
133 {
134 }
135
136 static const char *
137 _mcs51_getRegName (struct regs *reg)
138 {
139   if (reg)
140     return reg->name;
141   return "err";
142 }
143
144 static void
145 _mcs51_genAssemblerPreamble (FILE * of)
146 {
147     if (options.parms_in_bank1) {
148         int i ;
149         for (i=0; i < 8 ; i++ )
150             fprintf (of,"b1_%d = 0x%x \n",i,8+i);
151     }
152 }
153
154 /* Generate interrupt vector table. */
155 static int
156 _mcs51_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
157 {
158   int i;
159
160   fprintf (of, "\tljmp\t__sdcc_gsinit_startup\n");
161
162   /* now for the other interrupts */
163   for (i = 0; i < maxInterrupts; i++)
164     {
165       if (interrupts[i])
166         {
167           fprintf (of, "\tljmp\t%s\n", interrupts[i]->rname);
168           if ( i != maxInterrupts - 1 )
169             fprintf (of, "\t.ds\t5\n");
170         }
171       else
172         {
173           fprintf (of, "\treti\n");
174           if ( i != maxInterrupts - 1 )
175             fprintf (of, "\t.ds\t7\n");
176         }
177     }
178   return TRUE;
179 }
180
181 static void
182 _mcs51_genExtraAreas(FILE *of, bool hasMain)
183 {
184   tfprintf (of, "\t!area\n", port->mem.code_name);
185   tfprintf (of, "\t!area\n", "GSINIT0 (CODE)");
186   tfprintf (of, "\t!area\n", "GSINIT1 (CODE)");
187   tfprintf (of, "\t!area\n", "GSINIT2 (CODE)");
188   tfprintf (of, "\t!area\n", "GSINIT3 (CODE)");
189   tfprintf (of, "\t!area\n", "GSINIT4 (CODE)");
190   tfprintf (of, "\t!area\n", "GSINIT5 (CODE)");
191 }
192
193 static void
194 _mcs51_genInitStartup (FILE *of)
195 {
196   tfprintf (of, "\t!global\n", "__sdcc_gsinit_startup");
197   tfprintf (of, "\t!global\n", "__sdcc_program_startup");
198   tfprintf (of, "\t!global\n", "__start__stack");
199
200   if (options.useXstack)
201     {
202       tfprintf (of, "\t!global\n", "__sdcc_init_xstack");
203       tfprintf (of, "\t!global\n", "__start__xstack");
204     }
205
206   // if the port can copy the XINIT segment to XISEG
207   if (port->genXINIT)
208     {
209       port->genXINIT(of);
210     }
211
212   if (!getenv("SDCC_NOGENRAMCLEAR"))
213     tfprintf (of, "\t!global\n", "__mcs51_genRAMCLEAR");
214 }
215
216
217 /* Generate code to copy XINIT to XISEG */
218 static void _mcs51_genXINIT (FILE * of) {
219   tfprintf (of, "\t!global\n", "__mcs51_genXINIT");
220
221   if (!getenv("SDCC_NOGENRAMCLEAR"))
222     tfprintf (of, "\t!global\n", "__mcs51_genXRAMCLEAR");
223 }
224
225
226 /* Do CSE estimation */
227 static bool cseCostEstimation (iCode *ic, iCode *pdic)
228 {
229     operand *result = IC_RESULT(ic);
230     sym_link *result_type = operandType(result);
231
232     /* if it is a pointer then return ok for now */
233     if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
234
235     /* if bitwise | add & subtract then no since mcs51 is pretty good at it
236        so we will cse only if they are local (i.e. both ic & pdic belong to
237        the same basic block */
238     if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
239         /* then if they are the same Basic block then ok */
240         if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
241         else return 0;
242     }
243
244     /* for others it is cheaper to do the cse */
245     return 1;
246 }
247
248 /* Indicate which extended bit operations this port supports */
249 static bool
250 hasExtBitOp (int op, int size)
251 {
252   if (op == RRC
253       || op == RLC
254       || op == GETHBIT
255       || (op == SWAP && size <= 2)
256      )
257     return TRUE;
258   else
259     return FALSE;
260 }
261
262 /* Indicate the expense of an access to an output storage class */
263 static int
264 oclsExpense (struct memmap *oclass)
265 {
266   if (IN_FARSPACE(oclass))
267     return 1;
268
269   return 0;
270 }
271
272
273
274 static int
275 instructionSize(char *inst, char *op1, char *op2)
276 {
277   #define ISINST(s) (strncmp(inst, (s), sizeof(s)-1) == 0)
278   #define IS_A(s) (*(s) == 'a' && *(s+1) == '\0')
279   #define IS_C(s) (*(s) == 'c' && *(s+1) == '\0')
280   #define IS_Rn(s) (*(s) == 'r' && *(s+1) >= '0' && *(s+1) <= '7')
281   #define IS_atRi(s) (*(s) == '@' && *(s+1) == 'r')
282
283   /* Based on the current (2003-08-22) code generation for the
284      small library, the top instruction probability is:
285
286        57% mov/movx/movc
287         6% push
288         6% pop
289         4% inc
290         4% lcall
291         4% add
292         3% clr
293         2% subb
294   */
295   /* mov, push, & pop are the 69% of the cases. Check them first! */
296   if (ISINST ("mov"))
297     {
298       if (*(inst+3)=='x') return 1; /* movx */
299       if (*(inst+3)=='c') return 1; /* movc */
300       if (IS_C (op1) || IS_C (op2)) return 2;
301       if (IS_A (op1))
302         {
303           if (IS_Rn (op2) || IS_atRi (op2)) return 1;
304           return 2;
305         }
306       if (IS_Rn(op1) || IS_atRi(op1))
307         {
308           if (IS_A(op2)) return 1;
309           return 2;
310         }
311       if (strcmp (op1, "dptr") == 0) return 3;
312       if (IS_A (op2) || IS_Rn (op2) || IS_atRi (op2)) return 2;
313       return 3;
314     }
315
316   if (ISINST ("push")) return 2;
317   if (ISINST ("pop")) return 2;
318
319   if (ISINST ("lcall")) return 3;
320   if (ISINST ("ret")) return 1;
321   if (ISINST ("ljmp")) return 3;
322   if (ISINST ("sjmp")) return 2;
323   if (ISINST ("rlc")) return 1;
324   if (ISINST ("rrc")) return 1;
325   if (ISINST ("rl")) return 1;
326   if (ISINST ("rr")) return 1;
327   if (ISINST ("swap")) return 1;
328   if (ISINST ("jc")) return 2;
329   if (ISINST ("jnc")) return 2;
330   if (ISINST ("jb")) return 3;
331   if (ISINST ("jnb")) return 3;
332   if (ISINST ("jbc")) return 3;
333   if (ISINST ("jmp")) return 1; // always jmp @a+dptr
334   if (ISINST ("jz")) return 2;
335   if (ISINST ("jnz")) return 2;
336   if (ISINST ("cjne")) return 3;
337   if (ISINST ("mul")) return 1;
338   if (ISINST ("div")) return 1;
339   if (ISINST ("da")) return 1;
340   if (ISINST ("xchd")) return 1;
341   if (ISINST ("reti")) return 1;
342   if (ISINST ("nop")) return 1;
343   if (ISINST ("acall")) return 2;
344   if (ISINST ("ajmp")) return 2;
345
346
347   if (ISINST ("add") || ISINST ("addc") || ISINST ("subb") || ISINST ("xch"))
348     {
349       if (IS_Rn(op2) || IS_atRi(op2)) return 1;
350       return 2;
351     }
352   if (ISINST ("inc") || ISINST ("dec"))
353     {
354       if (IS_A(op1) || IS_Rn(op1) || IS_atRi(op1)) return 1;
355       if (strcmp(op1, "dptr") == 0) return 1;
356       return 2;
357     }
358   if (ISINST ("anl") || ISINST ("orl") || ISINST ("xrl"))
359     {
360       if (IS_C(op1)) return 2;
361       if (IS_A(op1))
362         {
363           if (IS_Rn(op2) || IS_atRi(op2)) return 1;
364           return 2;
365         }
366       else
367         {
368           if (IS_A(op2)) return 2;
369           return 3;
370         }
371     }
372   if (ISINST ("clr") || ISINST ("setb") || ISINST ("cpl"))
373     {
374       if (IS_A(op1) || IS_C(op1)) return 1;
375       return 2;
376     }
377   if (ISINST ("djnz"))
378     {
379       if (IS_Rn(op1)) return 2;
380       return 3;
381     }
382
383   /* If the instruction is unrecognized, we shouldn't try to optimize. */
384   /* Return a large value to discourage optimization.                  */
385   return 999;
386 }
387
388 static asmLineNode *
389 newAsmLineNode (void)
390 {
391   asmLineNode *aln;
392
393   aln = Safe_alloc ( sizeof (asmLineNode));
394   aln->size = 0;
395   aln->regsRead = NULL;
396   aln->regsWritten = NULL;
397
398   return aln;
399 }
400
401
402 typedef struct mcs51operanddata
403   {
404     char name[6];
405     int regIdx1;
406     int regIdx2;
407   }
408 mcs51operanddata;
409
410 static mcs51operanddata mcs51operandDataTable[] =
411   {
412     {"a", A_IDX, -1},
413     {"ab", A_IDX, B_IDX},
414     {"ac", CND_IDX, -1},
415     {"acc", A_IDX, -1},
416     {"ar0", R0_IDX, -1},
417     {"ar1", R1_IDX, -1},
418     {"ar2", R2_IDX, -1},
419     {"ar3", R3_IDX, -1},
420     {"ar4", R4_IDX, -1},
421     {"ar5", R5_IDX, -1},
422     {"ar6", R6_IDX, -1},
423     {"ar7", R7_IDX, -1},
424     {"b", B_IDX, -1},
425     {"c", CND_IDX, -1},
426     {"cy", CND_IDX, -1},
427     {"dph", DPH_IDX, -1},
428     {"dpl", DPL_IDX, -1},
429     {"dptr", DPL_IDX, DPH_IDX},
430     {"f0", CND_IDX, -1},
431     {"f1", CND_IDX, -1},
432     {"ov", CND_IDX, -1},
433     {"p", CND_IDX, -1},
434     {"psw", CND_IDX, -1},
435     {"r0", R0_IDX, -1},
436     {"r1", R1_IDX, -1},
437     {"r2", R2_IDX, -1},
438     {"r3", R3_IDX, -1},
439     {"r4", R4_IDX, -1},
440     {"r5", R5_IDX, -1},
441     {"r6", R6_IDX, -1},
442     {"r7", R7_IDX, -1},
443   };
444
445 static int
446 mcs51operandCompare (const void *key, const void *member)
447 {
448   return strcmp((const char *)key, ((mcs51operanddata *)member)->name);
449 }
450
451 static void
452 updateOpRW (asmLineNode *aln, char *op, char *optype)
453 {
454   mcs51operanddata *opdat;
455   char *dot;
456
457   dot = strchr(op, '.');
458   if (dot)
459     *dot = '\0';
460
461   opdat = bsearch (op, mcs51operandDataTable,
462                    sizeof(mcs51operandDataTable)/sizeof(mcs51operanddata),
463                    sizeof(mcs51operanddata), mcs51operandCompare);
464
465   if (opdat && strchr(optype,'r'))
466     {
467       if (opdat->regIdx1 >= 0)
468         aln->regsRead = bitVectSetBit (aln->regsRead, opdat->regIdx1);
469       if (opdat->regIdx2 >= 0)
470         aln->regsRead = bitVectSetBit (aln->regsRead, opdat->regIdx2);
471     }
472   if (opdat && strchr(optype,'w'))
473     {
474       if (opdat->regIdx1 >= 0)
475         aln->regsWritten = bitVectSetBit (aln->regsWritten, opdat->regIdx1);
476       if (opdat->regIdx2 >= 0)
477         aln->regsWritten = bitVectSetBit (aln->regsWritten, opdat->regIdx2);
478     }
479   if (op[0] == '@')
480     {
481       if (!strcmp(op, "@r0"))
482         aln->regsRead = bitVectSetBit (aln->regsRead, R0_IDX);
483       if (!strcmp(op, "@r1"))
484         aln->regsRead = bitVectSetBit (aln->regsRead, R1_IDX);
485       if (strstr(op, "dptr"))
486         {
487           aln->regsRead = bitVectSetBit (aln->regsRead, DPL_IDX);
488           aln->regsRead = bitVectSetBit (aln->regsRead, DPH_IDX);
489         }
490       if (strstr(op, "a+"))
491         aln->regsRead = bitVectSetBit (aln->regsRead, A_IDX);
492     }
493 }
494
495 typedef struct mcs51opcodedata
496   {
497     char name[6];
498     char class[3];
499     char pswtype[3];
500     char op1type[3];
501     char op2type[3];
502   }
503 mcs51opcodedata;
504
505 static mcs51opcodedata mcs51opcodeDataTable[] =
506   {
507     {"acall","j", "",   "",   ""},
508     {"add",  "",  "w",  "rw", "r"},
509     {"addc", "",  "rw", "rw", "r"},
510     {"ajmp", "j", "",   "",   ""},
511     {"anl",  "",  "",   "rw", "r"},
512     {"cjne", "j", "w",  "r",  "r"},
513     {"clr",  "",  "",   "w",  ""},
514     {"cpl",  "",  "",   "rw", ""},
515     {"da",   "",  "rw", "rw", ""},
516     {"dec",  "",  "",   "rw", ""},
517     {"div",  "",  "w",  "rw", ""},
518     {"djnz", "j", "",  "rw",  ""},
519     {"inc",  "",  "",   "rw", ""},
520     {"jb",   "j", "",   "r",  ""},
521     {"jbc",  "j", "",  "rw",  ""},
522     {"jc",   "j", "",   "",   ""},
523     {"jmp",  "j", "",  "",    ""},
524     {"jnb",  "j", "",   "r",  ""},
525     {"jnc",  "j", "",   "",   ""},
526     {"jnz",  "j", "",  "",    ""},
527     {"jz",   "j", "",  "",    ""},
528     {"lcall","j", "",   "",   ""},
529     {"ljmp", "j", "",   "",   ""},
530     {"mov",  "",  "",   "w",  "r"},
531     {"movc", "",  "",   "w",  "r"},
532     {"movx", "",  "",   "w",  "r"},
533     {"mul",  "",  "w",  "rw", ""},
534     {"nop",  "",  "",   "",   ""},
535     {"orl",  "",  "",   "rw", "r"},
536     {"pop",  "",  "",   "w",  ""},
537     {"push", "",  "",   "r",  ""},
538     {"ret",  "j", "",   "",   ""},
539     {"reti", "j", "",   "",   ""},
540     {"rl",   "",  "",   "rw", ""},
541     {"rlc",  "",  "rw", "rw", ""},
542     {"rr",   "",  "",   "rw", ""},
543     {"rrc",  "",  "rw", "rw", ""},
544     {"setb", "",  "",   "w",  ""},
545     {"sjmp", "j", "",   "",   ""},
546     {"subb", "",  "rw", "rw", "r"},
547     {"swap", "",  "",   "rw", ""},
548     {"xch",  "",  "",   "rw", "rw"},
549     {"xchd", "",  "",   "rw", "rw"},
550     {"xrl",  "",  "",   "rw", "r"},
551   };
552
553 static int
554 mcs51opcodeCompare (const void *key, const void *member)
555 {
556   return strcmp((const char *)key, ((mcs51opcodedata *)member)->name);
557 }
558
559 static asmLineNode *
560 asmLineNodeFromLineNode (lineNode *ln)
561 {
562   asmLineNode *aln = newAsmLineNode();
563   char *op, op1[256], op2[256];
564   int opsize;
565   const char *p;
566   char inst[8];
567   mcs51opcodedata *opdat;
568
569   p = ln->line;
570
571   while (*p && isspace(*p)) p++;
572   for (op = inst, opsize=1; *p; p++)
573     {
574       if (isspace(*p) || *p == ';' || *p == ':' || *p == '=')
575         break;
576       else
577         if (opsize < sizeof(inst))
578           *op++ = tolower(*p), opsize++;
579     }
580   *op = '\0';
581
582   if (*p == ';' || *p == ':' || *p == '=')
583     return aln;
584
585   while (*p && isspace(*p)) p++;
586   if (*p == '=')
587     return aln;
588
589   for (op = op1, opsize=1; *p && *p != ','; p++)
590     {
591       if (!isspace(*p) && opsize < sizeof(op1))
592         *op++ = tolower(*p), opsize++;
593     }
594   *op = '\0';
595
596   if (*p == ',') p++;
597   for (op = op2, opsize=1; *p && *p != ','; p++)
598     {
599       if (!isspace(*p) && opsize < sizeof(op2))
600         *op++ = tolower(*p), opsize++;
601     }
602   *op = '\0';
603
604   aln->size = instructionSize(inst, op1, op2);
605
606   aln->regsRead = newBitVect (END_IDX);
607   aln->regsWritten = newBitVect (END_IDX);
608
609   opdat = bsearch (inst, mcs51opcodeDataTable,
610                    sizeof(mcs51opcodeDataTable)/sizeof(mcs51opcodedata),
611                    sizeof(mcs51opcodedata), mcs51opcodeCompare);
612
613   if (opdat)
614     {
615       updateOpRW (aln, op1, opdat->op1type);
616       updateOpRW (aln, op2, opdat->op2type);
617       if (strchr(opdat->pswtype,'r'))
618         aln->regsRead = bitVectSetBit (aln->regsRead, CND_IDX);
619       if (strchr(opdat->pswtype,'w'))
620         aln->regsWritten = bitVectSetBit (aln->regsWritten, CND_IDX);
621     }
622
623   return aln;
624 }
625
626 static int
627 getInstructionSize (lineNode *line)
628 {
629   if (!line->aln)
630     line->aln = asmLineNodeFromLineNode (line);
631
632   return line->aln->size;
633 }
634
635 static bitVect *
636 getRegsRead (lineNode *line)
637 {
638   if (!line->aln)
639     line->aln = asmLineNodeFromLineNode (line);
640
641   return line->aln->regsRead;
642 }
643
644 static bitVect *
645 getRegsWritten (lineNode *line)
646 {
647   if (!line->aln)
648     line->aln = asmLineNodeFromLineNode (line);
649
650   return line->aln->regsWritten;
651 }
652
653
654 /** $1 is always the basename.
655     $2 is always the output file.
656     $3 varies
657     $l is the list of extra options that should be there somewhere...
658     MUST be terminated with a NULL.
659 */
660 static const char *_linkCmd[] =
661 {
662   "aslink", "-nf", "\"$1\"", NULL
663 };
664
665 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
666 static const char *_asmCmd[] =
667 {
668   "asx8051", "$l", "$3", "\"$1.asm\"", NULL
669 };
670
671 /* Globals */
672 PORT mcs51_port =
673 {
674   TARGET_ID_MCS51,
675   "mcs51",
676   "MCU 8051",                   /* Target name */
677   NULL,                         /* Processor name */
678   {
679     glue,
680     TRUE,                       /* Emit glue around main */
681     MODEL_SMALL | MODEL_LARGE,
682     MODEL_SMALL
683   },
684   {
685     _asmCmd,
686     NULL,
687     "-plosgffc",                /* Options with debug */
688     "-plosgff",                 /* Options without debug */
689     0,
690     ".asm",
691     NULL                        /* no do_assemble function */
692   },
693   {
694     _linkCmd,
695     NULL,
696     NULL,
697     ".rel",
698     1
699   },
700   {
701     _defaultRules,
702     getInstructionSize,
703     getRegsRead,
704     getRegsWritten
705   },
706   {
707     /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
708     1, 2, 2, 4, 1, 2, 3, 1, 4, 4
709   },
710   {
711     "XSTK    (PAG,XDATA)",      // xstack_name
712     "STACK   (DATA)",           // istack_name
713     "CSEG    (CODE)",           // code_name
714     "DSEG    (DATA)",           // data_name
715     "ISEG    (DATA)",           // idata_name
716     "PSEG    (PAG,XDATA)",      // pdata_name
717     "XSEG    (XDATA)",          // xdata_name
718     "BSEG    (BIT)",            // bit_name
719     "RSEG    (DATA)",           // reg_name
720     "GSINIT  (CODE)",           // static_name
721     "OSEG    (OVR,DATA)",       // overlay_name
722     "GSFINAL (CODE)",           // post_static_name
723     "HOME    (CODE)",           // home_name
724     "XISEG   (XDATA)",          // xidata_name - initialized xdata   initialized xdata
725     "XINIT   (CODE)",           // xinit_name - a code copy of xiseg
726     "CONST   (CODE)",           // const_name - const data (code or not)
727     NULL,
728     NULL,
729     1
730   },
731   { _mcs51_genExtraAreas, NULL },
732   {
733     +1,         /* direction (+1 = stack grows up) */
734     0,          /* bank_overhead (switch between register banks) */
735     4,          /* isr_overhead */
736     1,          /* call_overhead (2 for return address - 1 for pre-incrementing push */
737     1,          /* reent_overhead */
738     0           /* banked_overhead (switch between code banks) */
739   },
740   {
741     /* mcs51 has an 8 bit mul */
742     1, -1
743   },
744   {
745     mcs51_emitDebuggerSymbol
746   },
747   {
748     256,        /* maxCount */
749     2,          /* sizeofElement */
750     {6,9,15},   /* sizeofMatchJump[] */
751     {9,18,36},  /* sizeofRangeCompare[] */
752     4,          /* sizeofSubtract */
753     6,          /* sizeofDispatch */
754   },
755   "_",
756   _mcs51_init,
757   _mcs51_parseOptions,
758   NULL,
759   NULL,
760   _mcs51_finaliseOptions,
761   _mcs51_setDefaultOptions,
762   mcs51_assignRegisters,
763   _mcs51_getRegName,
764   _mcs51_keywords,
765   _mcs51_genAssemblerPreamble,
766   NULL,                         /* no genAssemblerEnd */
767   _mcs51_genIVT,
768   _mcs51_genXINIT,
769   _mcs51_genInitStartup,
770   _mcs51_reset_regparm,
771   _mcs51_regparm,
772   NULL,
773   NULL,
774   NULL,
775   hasExtBitOp,                  /* hasExtBitOp */
776   oclsExpense,                  /* oclsExpense */
777   FALSE,
778   TRUE,                         /* little endian */
779   0,                            /* leave lt */
780   0,                            /* leave gt */
781   1,                            /* transform <= to ! > */
782   1,                            /* transform >= to ! < */
783   1,                            /* transform != to !(a == b) */
784   0,                            /* leave == */
785   FALSE,                        /* No array initializer support. */
786   cseCostEstimation,
787   NULL,                         /* no builtin functions */
788   GPOINTER,                     /* treat unqualified pointers as "generic" pointers */
789   1,                            /* reset labelKey to 1 */
790   1,                            /* globals & local static allowed */
791   PORT_MAGIC
792 };