Cleaned up ds390 leftovers in the mcs51 port.
[fw/sdcc] / src / izt / tlcs900h.c
1 /** @file izt/tlcs900h.c
2     tlcs900h specific general functions.
3 */
4 #include "izt.h"
5
6 static REG _tlcs900h_regs[] =
7 {
8   {1, REG_ID_C, "c", 0,
9    {REG_ID_BC, REG_ID_NONE, REG_ID_NONE}},
10   {1, REG_ID_B, "b", 0,
11    {REG_ID_BC, REG_ID_NONE, REG_ID_NONE}},
12   {1, REG_ID_E, "e", 0,
13    {REG_ID_DE, REG_ID_NONE, REG_ID_NONE}},
14   {1, REG_ID_D, "d", 0,
15    {REG_ID_DE, REG_ID_NONE, REG_ID_NONE}},
16   {2, REG_ID_BC, "bc", 0,
17    {REG_ID_C, REG_ID_B, REG_ID_NONE}},
18   {2, REG_ID_DE, "de", 0,
19    {REG_ID_E, REG_ID_D, REG_ID_NONE}},
20   {4, REG_ID_XBC, "xbc", 0,
21    {REG_ID_C, REG_ID_B, REG_ID_BC}},
22   {4, REG_ID_XDE, "xde", 0,
23    {REG_ID_E, REG_ID_D, REG_ID_DE}},
24   {0, REG_ID_NONE, "??", 0,
25    {REG_ID_NONE, REG_ID_NONE, REG_ID_NONE}}
26 };
27
28 static IZT_PORT _tlcs900h_port =
29 {
30   _tlcs900h_regs
31 };
32
33 static char _defaultRules[] =
34 {
35     //#include "peeph.rul"
36 };
37
38 static char *_tlcs900h_keywords[] =
39 {
40   NULL
41 };
42
43 void tlcs900h_assignRegisters (eBBlock ** ebbs, int count);
44
45 static void
46 _tlcs900h_init (void)
47 {
48   asm_addTree (&asm_asxxxx_mapping);
49   izt_init (&_tlcs900h_port);
50 }
51
52 static void
53 _tlcs900h_reset_regparm ()
54 {
55 }
56
57 static int
58 _tlcs900h_regparm (sym_link * l)
59 {
60   // PENDING: No register parameters.
61   return 0;
62 }
63
64 static bool
65 _tlcs900h_parseOptions (int *pargc, char **argv, int *i)
66 {
67   /* TODO: allow port-specific command line options to specify
68    * segment names here.
69    */
70   return FALSE;
71 }
72
73 static void
74 _tlcs900h_finaliseOptions (void)
75 {
76   // No options
77 }
78
79 static void
80 _tlcs900h_setDefaultOptions (void)
81 {
82   // No options
83 }
84
85 static const char *
86 _tlcs900h_getRegName (struct regs *reg)
87 {
88   if (reg)
89     return reg->name;
90   wassert (0);
91   return "err";
92 }
93
94 static void
95 _tlcs900h_genAssemblerPreamble (FILE * of)
96 {
97   // PENDING
98 }
99
100 /* Generate interrupt vector table. */
101 static int
102 _tlcs900h_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
103 {
104   // PENDING
105   return 0;
106 }
107
108 /** $1 is always the basename.
109     $2 is always the output file.
110     $3 varies
111     $l is the list of extra options that should be there somewhere...
112     MUST be terminated with a NULL.
113 */
114 // PENDING
115 static const char *_linkCmd[] =
116 {
117   "aslink", "-nf", "$1", NULL
118 };
119
120 // PENDING
121 static const char *_asmCmd[] =
122 {
123   "gpasm", NULL, NULL, NULL
124 };
125
126 void
127 tlcs900h_assignRegisters (eBBlock ** ebbs, int count)
128 {
129 }
130
131 /* Globals */
132 PORT tlcs900h_port =
133 {
134   TARGET_ID_TLCS900H,
135   "tlcs900h",
136   "Toshiba TLCS-900H",          /* Target name */
137   {
138     TRUE,                       /* Emit glue around main */
139     MODEL_SMALL,
140     MODEL_SMALL
141   },
142   {
143     _asmCmd,
144     NULL,
145     NULL,
146     0
147   },
148   {
149     _linkCmd,
150     NULL,
151     ".o"
152   },
153   {
154     _defaultRules
155   },
156   {
157         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
158     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
159   },
160   {
161     "XSEG    (XDATA)",
162     "STACK   (DATA)",
163     "CSEG    (CODE)",
164     "DSEG    (DATA)",
165     "ISEG    (DATA)",
166     "XSEG    (XDATA)",
167     "BSEG    (BIT)",
168     "RSEG    (DATA)",
169     "GSINIT  (CODE)",
170     "OSEG    (OVR,DATA)",
171     "GSFINAL (CODE)",
172     "HOME        (CODE)",
173     NULL,
174     NULL,
175     1
176   },
177   {
178     +1, 1, 4, 1, 1, 0
179   },
180     /* tlcs900h has an 16 bit mul */
181   {
182     2, 0
183   },
184   "_",
185   _tlcs900h_init,
186   _tlcs900h_parseOptions,
187   _tlcs900h_finaliseOptions,
188   _tlcs900h_setDefaultOptions,
189   tlcs900h_assignRegisters,
190   _tlcs900h_getRegName,
191   _tlcs900h_keywords,
192   _tlcs900h_genAssemblerPreamble,
193   _tlcs900h_genIVT,
194   _tlcs900h_reset_regparm,
195   _tlcs900h_regparm,
196   NULL,
197   FALSE,
198   0,                            /* leave lt */
199   0,                            /* leave gt */
200   1,                            /* transform <= to ! > */
201   1,                            /* transform >= to ! < */
202   1,                            /* transform != to !(a == b) */
203   0,                            /* leave == */
204   PORT_MAGIC
205 };