Changed it so each target can have their own command line.
[fw/sdcc] / src / z80 / main.c
1 #include "common.h"
2 #include "ralloc.h"
3
4 static char *_z80_keywords[] = { NULL };
5
6 void z80_assignRegisters (eBBlock **ebbs, int count);
7
8 static bool _z80_parseOptions(int *pargc, char **argv)
9 {
10     return FALSE;
11 }
12
13 static void _z80_finaliseOptions(void)
14 {
15 }
16
17 static void _z80_setDefaultOptions(void)
18 {    
19     options.genericPtr = 1;   /* default on */
20     options.nopeep    = 1;
21     options.stackAuto = 1;
22     options.mainreturn = 1;
23     options.noregparms = 1;
24     /* first the options part */
25     options.intlong_rent = 1;
26
27     optimize.global_cse = 0;    
28     optimize.label1 = 0;
29     optimize.label2 = 0;
30     optimize.label3 = 0;
31     optimize.label4 = 0;    
32     optimize.loopInvariant = 0;
33     optimize.loopInduction = 0;
34 }
35
36 static const char *_z80_getRegName(struct regs *reg)
37 {
38     if (reg)
39         return reg->name;
40     return "err";
41 }
42
43 /** $1 is always the basename.
44     $2 is always the output file.
45     $3 varies
46     $l is the list of extra options that should be there somewhere...
47     MUST be terminated with a NULL.
48 */
49 static const char *_linkCmd[] = {
50     "link-z80", "-nf", "$1", NULL
51 };
52
53 static const char *_asmCmd[] = {
54     "as-z80", "-plosgff", "$1.o", "$1.asm", NULL
55 };
56
57 /* Globals */
58 PORT z80_port = {
59     "z80",
60     "Zilog Z80",                /* Target name */
61     {   
62         _asmCmd,
63         "-plosgff",             /* Options with debug */
64         "-plosgff",             /* Options without debug */
65     },
66     {
67         _linkCmd
68     },
69     {
70         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
71         1, 1, 2, 4, 2, 2, 2, 1, 4, 4
72     },
73     {
74         "_XSEG",
75         "_STACK",
76         "_CODE",
77         "_DATA",
78         "_ISEG",
79         "_XSEG",
80         "_BSEG",
81         "_RSEG",
82         "_GSINIT",
83         "_OVERLAY"
84     },
85     { 
86         -1, 0, 0, 8, 0
87     },
88     /* Z80 has no native mul/div commands */
89     {  
90         0
91     },
92     _z80_parseOptions,
93     _z80_finaliseOptions,
94     _z80_setDefaultOptions,
95     z80_assignRegisters,
96     _z80_getRegName,
97     _z80_keywords
98 };
99