* src/port.h (PORT structure): added hook initPaths, now each
[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
39 static char *_tlcs900h_keywords[] =
40 {
41   NULL
42 };
43
44 void tlcs900h_assignRegisters (eBBlock ** ebbs, int count);
45
46 static void
47 _tlcs900h_init (void)
48 {
49   asm_addTree (&asm_asxxxx_mapping);
50   izt_init (&_tlcs900h_port);
51 }
52
53 static void
54 _tlcs900h_reset_regparm ()
55 {
56 }
57
58 static int
59 _tlcs900h_regparm (sym_link * l)
60 {
61   // PENDING: No register parameters.
62   return 0;
63 }
64
65 static bool
66 _tlcs900h_parseOptions (int *pargc, char **argv, int *i)
67 {
68   /* TODO: allow port-specific command line options to specify
69    * segment names here.
70    */
71   return FALSE;
72 }
73
74 static void
75 _tlcs900h_finaliseOptions (void)
76 {
77   // No options
78 }
79
80 static void
81 _tlcs900h_setDefaultOptions (void)
82 {
83   // No options
84 }
85
86 static const char *
87 _tlcs900h_getRegName (struct regs *reg)
88 {
89   if (reg)
90     return reg->name;
91   wassert (0);
92   return "err";
93 }
94
95 static void
96 _tlcs900h_genAssemblerPreamble (FILE * of)
97 {
98   // PENDING
99 }
100
101 /* Generate interrupt vector table. */
102 static int
103 _tlcs900h_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
104 {
105   // PENDING
106   return 0;
107 }
108
109 /** $1 is always the basename.
110     $2 is always the output file.
111     $3 varies
112     $l is the list of extra options that should be there somewhere...
113     MUST be terminated with a NULL.
114 */
115 // PENDING
116 static const char *_linkCmd[] =
117 {
118   "aslink", "-nf", "$1", NULL
119 };
120
121 // PENDING
122 static const char *_asmCmd[] =
123 {
124   "gpasm", NULL, NULL, NULL
125 };
126
127 void
128 tlcs900h_assignRegisters (eBBlock ** ebbs, int count)
129 {
130 }
131
132 /* Globals */
133 PORT tlcs900h_port =
134 {
135   TARGET_ID_TLCS900H,
136   "tlcs900h",
137   "Toshiba TLCS-900H",          /* Target name */
138   NULL,
139   {
140     glue,
141     TRUE,                       /* Emit glue around main */
142     MODEL_SMALL,
143     MODEL_SMALL
144   },
145   {
146     _asmCmd,
147     NULL,
148     NULL,
149     NULL,
150     0,
151     NULL,
152     NULL                        /* no do_assemble function */
153   },
154   {
155     _linkCmd,
156     NULL,
157     NULL,
158     ".o"
159   },
160   {
161     _defaultRules
162   },
163   {
164         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
165     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
166   },
167   {
168     "XSEG    (XDATA)",
169     "STACK   (DATA)",
170     "CSEG    (CODE)",
171     "DSEG    (DATA)",
172     "ISEG    (DATA)",
173     "XSEG    (XDATA)",
174     "BSEG    (BIT)",
175     "RSEG    (DATA)",
176     "GSINIT  (CODE)",
177     "OSEG    (OVR,DATA)",
178     "GSFINAL (CODE)",
179     "HOME        (CODE)",
180     NULL, // xidata
181     NULL, // xinit
182     NULL,
183     NULL,
184     1
185   },
186   {
187     +1, 1, 4, 1, 1, 0
188   },
189     /* tlcs900h has an 16 bit mul */
190   {
191     2, -1
192   },
193   "_",
194   _tlcs900h_init,
195   _tlcs900h_parseOptions,
196   NULL,
197   _tlcs900h_finaliseOptions,
198   _tlcs900h_setDefaultOptions,
199   tlcs900h_assignRegisters,
200   _tlcs900h_getRegName,
201   _tlcs900h_keywords,
202   _tlcs900h_genAssemblerPreamble,
203   NULL,                         /* no genAssemblerEnd */
204   _tlcs900h_genIVT,
205   0, // _tlcs900h_genXINIT
206   _tlcs900h_reset_regparm,
207   _tlcs900h_regparm,
208   NULL,
209   NULL,
210   NULL,
211   FALSE,
212   0,                            /* leave lt */
213   0,                            /* leave gt */
214   1,                            /* transform <= to ! > */
215   1,                            /* transform >= to ! < */
216   1,                            /* transform != to !(a == b) */
217   0,                            /* leave == */
218   FALSE,                        /* No array initializer support. */     
219   0,                            /* no CSE cost estimation yet */
220   NULL,                         /* no builtin functions */
221   GPOINTER,                     /* treat unqualified pointers as "generic" pointers */
222   1,                            /* reset labelKey to 1 */
223   1,                            /* globals & local static allowed */
224   PORT_MAGIC
225 };