Cumulative patch for pic16 port
[fw/sdcc] / src / pic16 / main.c
1 /*-------------------------------------------------------------------------
2
3   main.c - pic16 specific general functions.
4
5    Written by - Scott Dattalo scott@dattalo.com
6    Ported to PIC16 by - Martin Dubuc m.debuc@rogers.com
7     
8    Note that mlh prepended _pic16_ on the static functions.  Makes
9    it easier to set a breakpoint using the debugger.
10
11
12    This program is free software; you can redistribute it and/or modify it
13    under the terms of the GNU General Public License as published by the
14    Free Software Foundation; either version 2, or (at your option) any
15    later version.
16    
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License for more details.
21    
22    You should have received a copy of the GNU General Public License
23    along with this program; if not, write to the Free Software
24    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 -------------------------------------------------------------------------*/
26
27 #include "common.h"
28 #include "main.h"
29 #include "ralloc.h"
30 #include "device.h"
31 #include "SDCCutil.h"
32 #include "glue.h"
33 #include "pcode.h"
34 //#include "gen.h"
35
36
37 static char _defaultRules[] =
38 {
39 #include "peeph.rul"
40 };
41
42 /* list of key words used by pic16 */
43 static char *_pic16_keywords[] =
44 {
45   "at",
46   "bit",
47   "code",
48   "critical",
49   "data",
50   "far",
51   "idata",
52   "interrupt",
53   "near",
54   "pdata",
55   "reentrant",
56   "sfr",
57   "sbit",
58   "using",
59   "xdata",
60   "_data",
61   "_code",
62   "_generic",
63   "_near",
64   "_xdata",
65   "_pdata",
66   "_idata",
67   "_naked",
68   NULL
69 };
70
71
72 pic16_sectioninfo_t pic16_sectioninfo;
73
74
75 extern char *pic16_processor_base_name(void);
76
77 void  pic16_pCodeInitRegisters(void);
78
79 void pic16_assignRegisters (eBBlock ** ebbs, int count);
80
81 static int regParmFlg = 0;      /* determine if we can register a parameter */
82
83 pic16_options_t pic16_options;
84
85 extern set *includeDirsSet;
86 extern set *dataDirsSet;
87 extern set *libFilesSet;
88
89 /* Also defined in gen.h, but the #include is commented out */
90 /* for an unknowned reason. - EEP */
91 void pic16_emitDebuggerSymbol (char *);
92  
93 extern regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alias, operand *refop);
94 extern void pic16_emitConfigRegs(FILE *of);
95
96
97
98
99 static void
100 _pic16_init (void)
101 {
102         asm_addTree (&asm_asxxxx_mapping);
103         pic16_pCodeInitRegisters();
104         maxInterrupts = 2;
105
106         /* set pic16 port options to defaults */
107         pic16_options.no_banksel = 0;
108         pic16_options.opt_banksel = 0;
109         pic16_options.omit_configw = 0;
110         pic16_options.omit_ivt = 0;
111         pic16_options.leave_reset = 0;
112         pic16_options.stack_model = 0;                  /* 0 for 'small', 1 for 'large' */
113 }
114
115 static void
116 _pic16_reset_regparm ()
117 {
118   regParmFlg = 0;
119 }
120
121 static int
122 _pic16_regparm (sym_link * l)
123 {
124   /* for this processor it is simple
125      can pass only the first parameter in a register */
126   //if (regParmFlg)
127   //  return 0;
128
129   regParmFlg++;// = 1;
130   return 1;
131 }
132
133
134 int initsfpnt=0;                /* set to 1 if source provides a pragma for stack
135                                  * so glue() later emits code to initialize stack/frame pointers */
136 set *absSymSet;
137
138 static int
139 _process_pragma(const char *sz)
140 {
141   static const char *WHITE = " \t";
142   
143   char  *ptr = strtok((char *)sz, WHITE);
144
145         if (startsWith (ptr, "maxram")) {
146           char *maxRAM = strtok((char *)NULL, WHITE);
147
148                 if (maxRAM != (char *)NULL) {
149                   int maxRAMaddress;
150                   value *maxRAMVal;
151
152                         maxRAMVal = constVal(maxRAM);
153                         maxRAMaddress = (int)floatFromVal(maxRAMVal);
154                         pic16_setMaxRAM(maxRAMaddress);
155                 }
156         }
157         
158         if(startsWith(ptr, "stack")) {
159           char *stackPosS = strtok((char *)NULL, WHITE);
160           value *stackPosVal;
161           regs *reg;
162
163 //              fprintf(stderr, "Initializing stack pointer to 0x%x\n", (int)floatFromVal(constVal(stackPos)));
164                 stackPosVal = constVal( stackPosS );
165                 stackPos = (unsigned int)floatFromVal( stackPosVal );
166
167                 reg=newReg(REG_SFR, PO_SFR_REGISTER, stackPos, "stack", 1, 0, NULL);
168                 addSet(&pic16_fix_udata, reg);
169                 
170                 initsfpnt = 1;          // force glue() to initialize stack/frame pointers */
171
172           return 0;
173         }
174         
175         if(startsWith(ptr, "code")) {
176           char *symname = strtok((char *)NULL, WHITE);
177           char *location = strtok((char *)NULL, WHITE);
178           absSym *absS;
179           value *addr;
180
181                 absS = Safe_calloc(1, sizeof(absSym));
182                 absS->name = Safe_strdup( symname );
183                 addr = constVal( location );
184                 absS->address = (unsigned int)floatFromVal( addr );
185
186                 addSet(&absSymSet, absS);
187                 fprintf(stderr, "%s:%d symbol %s will be placed in location 0x%06x in code memory\n",
188                         __FILE__, __LINE__, symname, absS->address);
189
190           return 0;
191         }         
192
193   return 1;
194 }
195
196 #define REP_UDATA       "--preplace-udata-with="
197
198 #define STACK_MODEL     "--pstack-model="
199 #define OPT_BANKSEL     "--obanksel="
200
201 #define ALT_ASM         "--asm="
202 #define ALT_LINK        "--link="
203
204 char *alt_asm=NULL;
205 char *alt_link=NULL;
206
207 extern int pic16_debug_verbose;
208 extern int pic16_ralloc_debug;
209 extern int pic16_pcode_verbose;
210
211 int pic16_enable_peeps=0;
212
213 OPTION pic16_optionsTable[]= {
214         { 0,    "--pno-banksel",        &pic16_options.no_banksel,      "do not generate BANKSEL assembler directives"},
215         { 0,    OPT_BANKSEL,            NULL,                           "set banksel optimization level (default=0 no)"},
216         { 0,    "--pomit-config-words", &pic16_options.omit_configw,    "omit the generation of configuration words"},
217         { 0,    "--pomit-ivt",          &pic16_options.omit_ivt,        "omit the generation of the Interrupt Vector Table"},
218         { 0,    "--pleave-reset-vector",&pic16_options.leave_reset,     "when omitting IVT leave RESET vector"},
219         { 0,    STACK_MODEL,    NULL,   "use stack model 'small' (default) or 'large'"},
220
221         { 0,    "--debug-xtra",         &pic16_debug_verbose,   "show more debug info in assembly output"},
222         { 0,    "--debug-ralloc",       &pic16_ralloc_debug,    "dump register allocator debug file *.d"},
223         { 0,    "--pcode-verbose",      &pic16_pcode_verbose,   "dump pcode related info"},
224                 
225         { 0,    REP_UDATA,      NULL,   "Place udata variables at another section: udata_acs, udata_ovr, udata_shr"},
226
227         { 0,    ALT_ASM,        NULL,   "Use alternative assembler"},
228         { 0,    ALT_LINK,       NULL,   "Use alternative linker"},
229
230         { 0,    "--denable-peeps",      &pic16_enable_peeps,    "explicit enable of peepholes"},
231
232         { 0,    NULL,           NULL,   NULL}
233         };
234
235
236 #define ISOPT(str)      !strncmp(argv[ *i ], str, strlen(str) )
237
238 extern char *getStringArg(const char *,  char **, int *, int);
239 extern int getIntArg(const char *, char **, int *, int);
240
241 static bool
242 _pic16_parseOptions (int *pargc, char **argv, int *i)
243 {
244   int j=0;
245   char *stkmodel;
246   
247   /* TODO: allow port-specific command line options to specify
248    * segment names here.
249    */
250         /* check for arguments that have associated an integer variable */
251         while(pic16_optionsTable[j].pparameter) {
252                 if(ISOPT( pic16_optionsTable[j].longOpt )) {
253                         (*pic16_optionsTable[j].pparameter)++;
254                         return TRUE;
255                 }
256                 j++;
257         }
258
259
260         if(ISOPT(STACK_MODEL)) {
261                 stkmodel = getStringArg(STACK_MODEL, argv, i, *pargc);
262                 if(STRCASECMP(stkmodel, "small"))pic16_options.stack_model = 0;
263                 else if(STRCASECMP(stkmodel, "large"))pic16_options.stack_model = 1;
264                 else {
265                         fprintf(stderr, "Unknown stack model: %s", stkmodel);
266                         exit(-1);
267                 }
268                 return TRUE;
269         }
270
271         if(ISOPT(OPT_BANKSEL)) {
272                 pic16_options.opt_banksel = getIntArg(OPT_BANKSEL, argv, i, *pargc);
273                 return TRUE;
274         }
275
276         if(ISOPT(REP_UDATA)) {
277                 pic16_sectioninfo.at_udata = Safe_strdup(getStringArg(REP_UDATA, argv, i, *pargc));
278                 return TRUE;
279         }
280         
281         if(ISOPT(ALT_ASM)) {
282                 alt_asm = Safe_strdup(getStringArg(ALT_ASM, argv, i, *pargc));
283                 return TRUE;
284         }
285         
286         if(ISOPT(ALT_LINK)) {
287                 alt_link = Safe_strdup(getStringArg(ALT_LINK, argv, i, *pargc));
288                 return TRUE;
289         }
290
291
292   return FALSE;
293 }
294
295 static void _pic16_initPaths(void)
296 {
297   char pic16incDir[512];
298   char pic16libDir[512];
299   set *pic16incDirsSet;
300   set *pic16libDirsSet;
301   char devlib[512];
302
303         setMainValue("mcu", pic16->name[2] );
304         addSet(&preArgvSet, Safe_strdup("-D{mcu}"));
305
306         sprintf(pic16incDir, "%s%cpic16", INCLUDE_DIR_SUFFIX, DIR_SEPARATOR_CHAR);
307         sprintf(pic16libDir, "%s%cpic16", LIB_DIR_SUFFIX, DIR_SEPARATOR_CHAR);
308
309         if(!options.nostdinc) {
310                 /* setup pic16 include directory */
311                 pic16incDirsSet = appendStrSet(dataDirsSet, NULL, pic16incDir);
312                 mergeSets(&includeDirsSet, pic16incDirsSet);
313         }
314         
315         if(!options.nostdlib) {
316                 /* setup pic16 library directory */
317                 pic16libDirsSet = appendStrSet(dataDirsSet, NULL, pic16libDir);
318                 mergeSets(&libDirsSet, pic16libDirsSet);
319         
320                 /* now add the library for the device */
321                 sprintf(devlib, "%s.lib", pic16->name[2]);
322                 addSet(&libFilesSet, Safe_strdup(devlib));
323         }
324 }
325
326
327 /* forward declarations */
328 extern const char *pic16_linkCmd[];
329 extern const char *pic16_asmCmd[];
330
331 static void
332 _pic16_finaliseOptions (void)
333 {
334         port->mem.default_local_map = data;
335         port->mem.default_globl_map = data;
336
337         /* peepholes are disabled for the time being */
338         options.nopeep = 1;
339
340         /* explicit enable peepholes for testing */
341         if(pic16_enable_peeps)
342                 options.nopeep = 0;
343
344         options.all_callee_saves = 1;           // always callee saves
345 //      options.float_rent = 1;
346 //      options.intlong_rent = 1;
347         
348
349         if(alt_asm && strlen(alt_asm))
350                 pic16_asmCmd[0] = alt_asm;
351         
352         if(alt_link && strlen(alt_link))
353                 pic16_linkCmd[0] = alt_link;
354 }
355
356
357 /* all the rest is commented ifdef'd out */
358 #if 0
359   /* Hack-o-matic: if we are using the flat24 model,
360    * adjust pointer sizes.
361    */
362   if (options.model == MODEL_FLAT24)
363     {
364
365       fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
366                "for DS80C390 support. This code generator is "
367                "badly out of date and probably broken.\n");
368
369       port->s.fptr_size = 3;
370       port->s.gptr_size = 4;
371       port->stack.isr_overhead++;       /* Will save dpx on ISR entry. */
372 #if 1
373       port->stack.call_overhead++;      /* This acounts for the extra byte 
374                                          * of return addres on the stack.
375                                          * but is ugly. There must be a 
376                                          * better way.
377                                          */
378 #endif
379       fReturn = fReturn390;
380       fReturnSize = 5;
381     }
382
383   if (options.model == MODEL_LARGE)
384     {
385       port->mem.default_local_map = xdata;
386       port->mem.default_globl_map = xdata;
387     }
388   else
389     {
390       port->mem.default_local_map = data;
391       port->mem.default_globl_map = data;
392     }
393
394   if (options.stack10bit)
395     {
396       if (options.model != MODEL_FLAT24)
397         {
398           fprintf (stderr,
399                    "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
400           fprintf (stderr, "\t10 bit stack mode disabled.\n");
401           options.stack10bit = 0;
402         }
403       else
404         {
405           /* Fixup the memory map for the stack; it is now in
406            * far space and requires a FPOINTER to access it.
407            */
408           istack->fmap = 1;
409           istack->ptrType = FPOINTER;
410         }
411     }
412 #endif
413
414
415 static void
416 _pic16_setDefaultOptions (void)
417 {
418         /* initialize to defaults section locations, names and addresses */
419         pic16_sectioninfo.at_udata      = "udata";
420
421         /* set pic16 port options to defaults */
422         pic16_options.no_banksel = 0;
423         pic16_options.opt_banksel = 0;
424         pic16_options.omit_configw = 0;
425         pic16_options.omit_ivt = 0;
426         pic16_options.leave_reset = 0;
427         pic16_options.stack_model = 0;                  /* 0 for 'small', 1 for 'large' */
428 }
429
430 static const char *
431 _pic16_getRegName (struct regs *reg)
432 {
433   if (reg)
434     return reg->name;
435   return "err";
436 }
437
438
439 #if 1
440 static  char *_pic16_mangleFunctionName(char *sz)
441 {
442 //      fprintf(stderr, "mangled function name: %s\n", sz);
443
444   return sz;
445 }
446 #endif
447
448
449 static void
450 _pic16_genAssemblerPreamble (FILE * of)
451 {
452   char *name = pic16_processor_base_name();
453
454         if(!name) {
455                 name = "p18f452";
456                 fprintf(stderr,"WARNING: No Pic has been selected, defaulting to %s\n",name);
457         }
458
459         fprintf (of, "\tlist\tp=%s\n",&name[1]);
460
461         if(!pic16_options.omit_configw) {
462                 pic16_emitConfigRegs(of);
463 #if 0           
464                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300001, pic16_getConfigWord(0x300001));
465                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300002, pic16_getConfigWord(0x300002));
466                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300003, pic16_getConfigWord(0x300003));
467                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300005, pic16_getConfigWord(0x300005));
468                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300006, pic16_getConfigWord(0x300006));
469                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300008, pic16_getConfigWord(0x300008));
470                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300009, pic16_getConfigWord(0x300009));
471                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000a, pic16_getConfigWord(0x30000a));
472                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000b, pic16_getConfigWord(0x30000b));
473                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000c, pic16_getConfigWord(0x30000c));
474                 fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000d, pic16_getConfigWord(0x30000d));
475 #endif
476         }
477         
478   fprintf (of, "\tradix dec\n");
479 }
480
481 /* Generate interrupt vector table. */
482 static int
483 _pic16_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
484 {
485 #if 1
486         /* PIC18F family has only two interrupts, the high and the low
487          * priority interrupts, which reside at 0x0008 and 0x0018 respectively - VR */
488
489         if((!pic16_options.omit_ivt) || (pic16_options.omit_ivt && pic16_options.leave_reset)) {
490                 fprintf(of, "; RESET vector\n");
491                 fprintf(of, "\tgoto\t__sdcc_gsinit_startup\n");
492         }
493         
494         if(!pic16_options.omit_ivt) {
495                 fprintf(of, "\tres 4\n");
496
497
498                 fprintf(of, "; High priority interrupt vector 0x0008\n");
499                 if(interrupts[1]) {
500                         fprintf(of, "\tgoto\t%s\n", interrupts[1]->rname);
501                         fprintf(of, "\tres\t12\n"); 
502                 } else {
503                         fprintf(of, "\tretfie\n");
504                         fprintf(of, "\tres\t14\n");
505                 }
506
507                 fprintf(of, "; Low priority interrupt vector 0x0018\n");
508                 if(interrupts[2]) {
509                         fprintf(of, "\tgoto\t%s\n", interrupts[2]->rname);
510                 } else {
511                         fprintf(of, "\tretfie\n");
512                 }
513         }
514 #endif
515   return TRUE;
516 }
517
518 /* return True if the port can handle the type,
519  * False to convert it to function call */
520 static bool _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
521 {
522 //      fprintf(stderr,"checking for native mult for %c (size: %d)\n", ic->op, getSize(OP_SYMBOL(IC_RESULT(ic))->type));
523
524 #if 1
525         /* multiplication is fixed */
526         /* support mul for char/int/long */
527         if((getSize(OP_SYMBOL(IC_LEFT(ic))->type ) <= 4)
528                 && (ic->op == '*'))return TRUE;
529 #endif
530
531 #if 0
532         /* support div for char/int/long */
533         if((getSize(OP_SYMBOL(IC_LEFT(ic))->type ) <= 0)
534                 && (ic->op == '/'))return TRUE;
535 #endif
536         
537   return FALSE;
538 }
539
540
541 #if 0
542 /* Do CSE estimation */
543 static bool cseCostEstimation (iCode *ic, iCode *pdic)
544 {
545 //    operand *result = IC_RESULT(ic);
546 //    sym_link *result_type = operandType(result);
547
548
549         /* VR -- this is an adhoc. Put here after conversation
550          * with Erik Epetrich */
551
552         if(ic->op == '<'
553                 || ic->op == '>'
554                 || ic->op == EQ_OP) {
555
556                 fprintf(stderr, "%d %s\n", __LINE__, __FUNCTION__);
557           return 0;
558         }
559
560 #if 0
561     /* if it is a pointer then return ok for now */
562     if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
563
564     /* if bitwise | add & subtract then no since mcs51 is pretty good at it
565        so we will cse only if they are local (i.e. both ic & pdic belong to
566        the same basic block */
567     if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
568         /* then if they are the same Basic block then ok */
569         if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
570         else return 0;
571     }
572 #endif
573
574     /* for others it is cheaper to do the cse */
575     return 1;
576 }
577 #endif
578
579
580 /* Indicate which extended bit operations this port supports */
581 static bool
582 hasExtBitOp (int op, int size)
583 {
584   if (op == RRC
585       || op == RLC
586       /* || op == GETHBIT */ /* GETHBIT doesn't look complete for PIC */
587      )
588     return TRUE;
589   else
590     return FALSE;
591 }
592
593 /* Indicate the expense of an access to an output storage class */
594 static int
595 oclsExpense (struct memmap *oclass)
596 {
597   /* The IN_FARSPACE test is compatible with historical behaviour, */
598   /* but I don't think it is applicable to PIC. If so, please feel */
599   /* free to remove this test -- EEP */
600   if (IN_FARSPACE(oclass))
601     return 1;
602     
603   return 0;
604 }
605
606 /** $1 is always the basename.
607     $2 is always the output file.
608     $3 -L path and -l libraries
609     $l is the list of extra options that should be there somewhere...
610     MUST be terminated with a NULL.
611 */
612 const char *pic16_linkCmd[] =
613 {
614   "gplink", "$3", "\"$1.o\"", "-o \"$2\"", "$l", NULL
615 };
616
617
618
619 /** $1 is always the basename.
620     $2 is always the output file.
621     $3 varies (nothing currently)
622     $l is the list of extra options that should be there somewhere...
623     MUST be terminated with a NULL.
624 */
625 const char *pic16_asmCmd[] =
626 {
627   "gpasm", "$l", "$3", "-c", "\"$1.asm\"", "-o \"$2\"", NULL
628
629 };
630
631 /* Globals */
632 PORT pic16_port =
633 {
634   TARGET_ID_PIC16,
635   "pic16",
636   "MCU PIC16",                  /* Target name */
637   "p18f452",                    /* Processor */
638   {
639     pic16glue,
640     TRUE,                       /* Emit glue around main */
641     MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
642     MODEL_SMALL
643   },
644   {
645     pic16_asmCmd,               /* assembler command and arguments */
646     NULL,                       /* alternate macro based form */
647     "-g",                       /* arguments for debug mode */
648     NULL,                       /* arguments for normal mode */
649     0,                          /* print externs as global */
650     ".asm",                     /* assembler file extension */
651     NULL                        /* no do_assemble function */
652   },
653   {
654     pic16_linkCmd,              /* linker command and arguments */
655     NULL,                       /* alternate macro based form */
656     NULL,                       /* no do_link function */
657     ".o",                       /* extension for object files */
658     0                           /* no need for linker file */
659   },
660   {
661     _defaultRules
662   },
663   {
664         /* Sizes */
665     1,          /* char */
666     2,          /* short */
667     2,          /* int */
668     4,          /* long */
669     2,          /* ptr */
670     3,          /* fptr, far pointers (see Microchip) */
671     2,          /* gptr */
672     1,          /* bit */
673     4,          /* float */
674     4           /* max */
675   },
676   {
677     "XSEG    (XDATA)",          // xstack
678     "STACK   (DATA)",           // istack
679     "CSEG    (CODE)",           // code
680     "DSEG    (DATA)",           // data
681     "ISEG    (DATA)",           // idata
682     "XSEG    (XDATA)",          // xdata
683     "BSEG    (BIT)",            // bit
684     "RSEG    (DATA)",           // reg
685     "GSINIT  (CODE)",           // static
686     "OSEG    (OVR,DATA)",       // overlay
687     "GSFINAL (CODE)",           // post static
688     "HOME        (CODE)",       // home
689     NULL,                       // xidata
690     NULL,                       // xinit
691     NULL,                       // default location for auto vars
692     NULL,                       // default location for global vars
693     1                           // code is read only 1=yes
694   },
695   {
696     NULL,               /* genExtraAreaDeclaration */
697     NULL                /* genExatrAreaLinkOptions */
698   },
699   {
700         /* stack related information */
701     -1,                 /* -1 stack grows downwards, +1 upwards */
702     1,                  /* extra overhead when calling between banks */
703     4,                  /* extra overhead when the function is an ISR */
704     1,                  /* extra overhead for a function call */
705     1,                  /* re-entrant space */
706     0                   /* 'banked' call overhead, mild overlap with bank_overhead */
707   },
708     /* pic16 has an 8 bit mul */
709   {
710      0, -1
711   },
712   {
713     pic16_emitDebuggerSymbol
714   },
715   "_",
716   _pic16_init,
717   _pic16_parseOptions,
718   pic16_optionsTable,
719   _pic16_initPaths,
720   _pic16_finaliseOptions,
721   _pic16_setDefaultOptions,
722   pic16_assignRegisters,
723   _pic16_getRegName,
724   _pic16_keywords,
725   _pic16_genAssemblerPreamble,
726   NULL,                         /* no genAssemblerEnd */
727   _pic16_genIVT,
728   NULL, // _pic16_genXINIT
729   NULL,                         /* genInitStartup */
730   _pic16_reset_regparm,
731   _pic16_regparm,
732   _process_pragma,                              /* process a pragma */
733   _pic16_mangleFunctionName,                            /* mangles function name */
734   _hasNativeMulFor,
735   hasExtBitOp,                  /* hasExtBitOp */
736   oclsExpense,                  /* oclsExpense */
737   FALSE,                        
738   TRUE,                         /* little endian */
739   0,                            /* leave lt */
740   0,                            /* leave gt */
741   1,                            /* transform <= to ! > */
742   1,                            /* transform >= to ! < */
743   1,                            /* transform != to !(a == b) */
744   0,                            /* leave == */
745   FALSE,                        /* No array initializer support. */
746   0,    //cseCostEstimation,            /* !!!no CSE cost estimation yet */
747   NULL,                         /* no builtin functions */
748   GPOINTER,                     /* treat unqualified pointers as "generic" pointers */
749   1,                            /* reset labelKey to 1 */
750   1,                            /* globals & local static allowed */
751   PORT_MAGIC
752 };