* Improved the pop params code
[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     assert(0);
41     return "err";
42 }
43
44 /** $1 is always the basename.
45     $2 is always the output file.
46     $3 varies
47     $l is the list of extra options that should be there somewhere...
48     MUST be terminated with a NULL.
49 */
50 static const char *_linkCmd[] = {
51     "link-z80", "-nf", "$1", NULL
52 };
53
54 static const char *_asmCmd[] = {
55     "as-z80", "-plosgff", "$1.o", "$1.asm", NULL
56 };
57
58 /* Globals */
59 PORT z80_port = {
60     "z80",
61     "Zilog Z80",                /* Target name */
62     {   
63         _asmCmd,
64         "-plosgff",             /* Options with debug */
65         "-plosgff",             /* Options without debug */
66     },
67     {
68         _linkCmd
69     },
70     {
71         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
72         1, 1, 2, 4, 2, 2, 2, 1, 4, 4
73     },
74     {
75         "_XSEG",
76         "_STACK",
77         "_CODE",
78         "_DATA",
79         "_ISEG",
80         "_XSEG",
81         "_BSEG",
82         "_RSEG",
83         "_GSINIT",
84         "_OVERLAY"
85     },
86     { 
87         -1, 0, 0, 8, 0
88     },
89     /* Z80 has no native mul/div commands */
90     {  
91         0
92     },
93     _z80_parseOptions,
94     _z80_finaliseOptions,
95     _z80_setDefaultOptions,
96     z80_assignRegisters,
97     _z80_getRegName,
98     _z80_keywords
99 };
100