2 Definitions for what a port must provide.
3 All ports are referenced in SDCCmain.c.
8 /* Processor specific names */
11 /** Target name used for -m */
14 /** Target name string, used for --help */
15 const char *target_name;
19 /** TRUE if all types of glue functions should be inseted into
20 the file that also defines main.
21 We dont want this in cases like the z80 where the startup
22 code is provided by a seperate module.
31 /* assembler related information */
34 /** Command to run and arguments (eg as-z80) */
36 /** Arguments for debug mode. PENDING: ignored */
37 const char *debug_opts;
38 /** Arguments for normal assembly mode. PENDING: ignored */
39 const char *plain_opts;
40 /* print externs as global */
45 /* linker related info */
48 /** Command to run (eg link-z80) */
50 /** If non-null will be used to execute the link. */
51 void (*do_link) (void);
52 /** Extention for object files (.rel, .obj, ...) */
59 /** Default peephole rules */
64 /** Basic type sizes */
80 /** memory regions related stuff */
83 const char *xstack_name;
84 const char *istack_name;
85 const char *code_name;
86 const char *data_name;
87 const char *idata_name;
88 const char *xdata_name;
91 const char *static_name;
92 const char *overlay_name;
93 const char *post_static_name;
94 const char *home_name;
95 struct memmap *default_local_map; /* default location for auto vars */
96 struct memmap *default_globl_map; /* default location for globl vars */
97 int code_ro; /* code space read-only 1=yes */
101 /* stack related information */
104 /** -1 for grows down (z80), +1 for grows up (mcs51) */
106 /** Extra overhead when calling between banks */
108 /** Extra overhead when the function is an ISR */
110 /** Standard overhead for a function call */
112 /** Re-enterant space */
114 /** 'banked' call overhead.
115 Mild overlap with bank_overhead */
122 /** One more than the smallest
123 mul/div operation the processor can do nativley
124 Eg if the processor has an 8 bit mul, nativebelow is 2 */
126 /** The mul/div/mod functions will be made to use regparams
127 for sizeof(param) < log2(force_reg)
128 i.e. Use 2 for WORD and BYTE, 0 for none. */
129 int force_reg_param_below;
133 /** Prefix to add to a C function (eg "_") */
134 const char *fun_prefix;
136 /** Called once the processor target has been selected.
137 First chance to initalise and set any port specific varibles.
138 'port' is set before calling this. May be NULL.
141 /** Parses one option + its arguments */
142 bool (*parseOption) (int *pargc, char **argv, int *i);
143 /** Called after all the options have been parsed. */
144 void (*finaliseOptions) (void);
145 /** Called after the port has been selected but before any
146 options are parsed. */
147 void (*setDefaultOptions) (void);
148 /** Does the dirty work. */
149 void (*assignRegisters) (struct eBBlock **, int);
151 /** Returns the register name of a symbol.
152 Used so that 'regs' can be an incomplete type. */
153 const char *(*getRegName) (struct regs * reg);
155 /* list of keywords that are used by this
156 target (used by lexer) */
159 /* Write any port specific assembler output. */
160 void (*genAssemblerPreamble) (FILE * of);
162 /* Write the port specific IVT. If genIVT is NULL or if
163 * it returns zero, default (8051) IVT generation code
166 int (*genIVT) (FILE * of, symbol ** intTable, int intCount);
169 /* parameter passing in register related functions */
170 void (*reset_regparms) (); /* reset the register count */
171 int (*reg_parm) (struct sym_link *); /* will return 1 if can be passed in register */
173 /** Process the pragma string 'sz'. Returns 0 if recognised and
174 processed, 1 otherwise. May be NULL.
176 int (*process_pragma) (const char *sz);
178 /** If TRUE, then tprintf and !dw will be used for some initalisers
180 bool use_dw_for_init;
182 /* condition transformations */
183 bool lt_nge; /* transform (a < b) to !(a >= b) */
184 bool gt_nle; /* transform (a > b) to !(a <= b) */
185 bool le_ngt; /* transform (a <= b) to !(a > b) */
186 bool ge_nlt; /* transform (a >= b) to !(a < b) */
187 bool ne_neq; /* transform a != b --> ! (a == b) */
188 bool eq_nne; /* transform a == b --> ! (a != b) */
190 #define PORT_MAGIC 0xAC32
191 /** Used at runtime to detect if this structure has been completly filled in. */
198 #if !OPT_DISABLE_MCS51
199 extern PORT mcs51_port;
201 #if !OPT_DISABLE_GBZ80
202 extern PORT gbz80_port;
205 extern PORT z80_port;
208 extern PORT avr_port;
210 #if !OPT_DISABLE_DS390
211 extern PORT ds390_port;
214 extern PORT pic14_port;
216 #if !OPT_DISABLE_I186
217 extern PORT i186_port;
219 #if !OPT_DISABLE_TLCS900H
220 extern PORT tlcs900h_port;
223 /* Test to see if we are current compiling in what? port. */
224 #define IS_MCS51_PORT (port == &mcs51_port)
225 #define IS_GBZ80_PORT (port == &gbz80_port)
226 #define IS_Z80_PORT (port == &z80_port)
227 #define IS_AVR_PORT (port == &avr_port)
228 #define IS_DS390_PORT (port == &ds390_port)
229 #define IS_PIC14_PORT (port == &pic14_port)
230 #define IS_I186_PORT (port == &i186_port)
231 #define IS_TCLS900H_PORT (port == &tlcs900h_port)