2 Definitions for what a port must provide.
3 All ports are referenced in SDCCmain.c.
10 #define TARGET_ID_MCS51 1
11 #define TARGET_ID_GBZ80 2
12 #define TARGET_ID_Z80 3
13 #define TARGET_ID_AVR 4
14 #define TARGET_ID_DS390 5
15 #define TARGET_ID_PIC 6
16 #define TARGET_ID_I186 7
17 #define TARGET_ID_TLCS900H 8
18 #define TARGET_ID_XA51 9
20 /* Macro to test the target we are compiling for.
21 Can only be used after SDCCmain has defined the port
23 #define TARGET_IS_MCS51 (port->id==TARGET_ID_MCS51)
24 #define TARGET_IS_GBZ80 (port->id==TARGET_ID_GBZ80)
25 #define TARGET_IS_Z80 (port->id==TARGET_ID_Z80)
26 #define TARGET_IS_AVR (port->id==TARGET_ID_AVR)
27 #define TARGET_IS_DS390 (port->id==TARGET_ID_DS390)
28 #define TARGET_IS_PIC (port->id==TARGET_ID_PIC)
29 #define TARGET_IS_I186 (port->id==TARGET_ID_I186)
30 #define TARGET_IS_TCLS900H (port->id==TARGET_ID_TCLS900H)
32 /* Processor specific names */
35 /** Unique id for this target */
37 /** Target name used for -m */
40 /** Target name string, used for --help */
41 const char *target_name;
45 /** TRUE if all types of glue functions should be inserted into
46 the file that also defines main.
47 We dont want this in cases like the z80 where the startup
48 code is provided by a seperate module.
57 /* assembler related information */
60 /** Command to run and arguments (eg as-z80) */
62 /** Alternate macro based form. */
64 /** Arguments for debug mode. */
65 const char *debug_opts;
66 /** Arguments for normal assembly mode. */
67 const char *plain_opts;
68 /* print externs as global */
70 /* assembler file extension */
75 /* linker related info */
78 /** Command to run (eg link-z80) */
80 /** Alternate macro based form. */
82 /** If non-null will be used to execute the link. */
83 void (*do_link) (void);
84 /** Extention for object files (.rel, .obj, ...) */
91 /** Default peephole rules */
96 /** Basic type sizes */
112 /** memory regions related stuff */
115 const char *xstack_name;
116 const char *istack_name;
117 const char *code_name;
118 const char *data_name;
119 const char *idata_name;
120 const char *xdata_name;
121 const char *bit_name;
122 const char *reg_name;
123 const char *static_name;
124 const char *overlay_name;
125 const char *post_static_name;
126 const char *home_name;
127 struct memmap *default_local_map; /* default location for auto vars */
128 struct memmap *default_globl_map; /* default location for globl vars */
129 int code_ro; /* code space read-only 1=yes */
133 /* stack related information */
136 /** -1 for grows down (z80), +1 for grows up (mcs51) */
138 /** Extra overhead when calling between banks */
140 /** Extra overhead when the function is an ISR */
142 /** Standard overhead for a function call */
144 /** Re-enterant space */
146 /** 'banked' call overhead.
147 Mild overlap with bank_overhead */
154 /** One more than the smallest
155 mul/div operation the processor can do nativley
156 Eg if the processor has an 8 bit mul, nativebelow is 2 */
162 /** Prefix to add to a C function (eg "_") */
163 const char *fun_prefix;
165 /** Called once the processor target has been selected.
166 First chance to initalise and set any port specific variables.
167 'port' is set before calling this. May be NULL.
170 /** Parses one option + its arguments */
171 bool (*parseOption) (int *pargc, char **argv, int *i);
172 /** Called after all the options have been parsed. */
173 void (*finaliseOptions) (void);
174 /** Called after the port has been selected but before any
175 options are parsed. */
176 void (*setDefaultOptions) (void);
177 /** Does the dirty work. */
178 void (*assignRegisters) (struct eBBlock **, int);
180 /** Returns the register name of a symbol.
181 Used so that 'regs' can be an incomplete type. */
182 const char *(*getRegName) (struct regs * reg);
184 /* list of keywords that are used by this
185 target (used by lexer) */
188 /* Write any port specific assembler output. */
189 void (*genAssemblerPreamble) (FILE * of);
191 /* Write the port specific IVT. If genIVT is NULL or if
192 * it returns zero, default (8051) IVT generation code
195 int (*genIVT) (FILE * of, symbol ** intTable, int intCount);
198 /* parameter passing in register related functions */
199 void (*reset_regparms) (); /* reset the register count */
200 int (*reg_parm) (struct sym_link *); /* will return 1 if can be passed in register */
202 /** Process the pragma string 'sz'. Returns 0 if recognised and
203 processed, 1 otherwise. May be NULL.
205 int (*process_pragma) (const char *sz);
207 /** Mangles a support function name to reflect the calling model.
209 char *(*getMangledFunctionName) (char *szOrginial);
211 /** Returns true if the port can multiply the two types nativly
212 without using support functions.
214 bool (*hasNativeMulFor) (iCode *ic, sym_link *left, sym_link *right);
216 /** If TRUE, then tprintf and !dw will be used for some initalisers
218 bool use_dw_for_init;
220 /* condition transformations */
221 bool lt_nge; /* transform (a < b) to !(a >= b) */
222 bool gt_nle; /* transform (a > b) to !(a <= b) */
223 bool le_ngt; /* transform (a <= b) to !(a > b) */
224 bool ge_nlt; /* transform (a >= b) to !(a < b) */
225 bool ne_neq; /* transform a != b --> ! (a == b) */
226 bool eq_nne; /* transform a == b --> ! (a != b) */
228 bool arrayInitializerSuppported;
230 #define PORT_MAGIC 0xAC32
231 /** Used at runtime to detect if this structure has been completly filled in. */
238 #if !OPT_DISABLE_MCS51
239 extern PORT mcs51_port;
241 #if !OPT_DISABLE_GBZ80
242 extern PORT gbz80_port;
245 extern PORT z80_port;
248 extern PORT avr_port;
250 #if !OPT_DISABLE_DS390
251 extern PORT ds390_port;
254 extern PORT pic_port;
256 #if !OPT_DISABLE_I186
257 extern PORT i186_port;
259 #if !OPT_DISABLE_TLCS900H
260 extern PORT tlcs900h_port;
263 #endif /* PORT_INCLUDE*/