2 Definitions for what a port must provide.
3 All ports are referenced in SDCCmain.c.
8 /* Processor specific names */
10 /** Target name used for -m */
13 /** Target name string, used for --help */
14 const char *target_name;
17 /** TRUE if all types of glue functions should be inseted into
18 the file that also defines main.
19 We dont want this in cases like the z80 where the startup
20 code is provided by a seperate module.
28 /* assembler related information */
30 /** Command to run and arguments (eg as-z80) */
32 /** Arguments for debug mode. PENDING: ignored */
33 const char *debug_opts;
34 /** Arguments for normal assembly mode. PENDING: ignored */
35 const char *plain_opts;
36 /* print externs as global */
40 /* linker related info */
42 /** Command to run (eg link-z80) */
44 /** If non-null will be used to execute the link. */
45 void (*do_link)(void);
46 /** Extention for object files (.rel, .obj, ...) */
51 /** Default peephole rules */
55 /** Basic type sizes */
69 /** memory regions related stuff */
71 const char *xstack_name;
72 const char *istack_name;
73 const char *code_name;
74 const char *data_name;
75 const char *idata_name;
76 const char *xdata_name;
79 const char *static_name;
80 const char *overlay_name;
81 const char *post_static_name;
82 const char *home_name;
83 struct memmap *default_local_map ; /* default location for auto vars */
84 struct memmap *default_globl_map ; /* default location for globl vars*/
85 int code_ro; /* code space read-only 1=yes */
88 /* stack related information */
90 /** -1 for grows down (z80), +1 for grows up (mcs51) */
92 /** Extra overhead when calling between banks */
94 /** Extra overhead when the function is an ISR */
96 /** Standard overhead for a function call */
98 /** Re-enterant space */
100 /** 'banked' call overhead.
101 Mild overlap with bank_overhead */
106 /** One more than the smallest
107 mul/div operation the processor can do nativley
108 Eg if the processor has an 8 bit mul, nativebelow is 2 */
110 /** The mul/div/mod functions will be made to use regparams
111 for sizeof(param) < log2(force_reg)
112 i.e. Use 2 for WORD and BYTE, 0 for none. */
113 int force_reg_param_below;
116 /** Prefix to add to a C function (eg "_") */
117 const char *fun_prefix;
119 /** Called once the processor target has been selected.
120 First chance to initalise and set any port specific varibles.
121 'port' is set before calling this. May be NULL.
124 /** Parses one option + its arguments */
125 bool (*parseOption)(int *pargc, char **argv, int *i);
126 /** Called after all the options have been parsed. */
127 void (*finaliseOptions)(void);
128 /** Called after the port has been selected but before any
129 options are parsed. */
130 void (*setDefaultOptions)(void);
131 /** Does the dirty work. */
132 void (*assignRegisters)(struct eBBlock **, int);
134 /** Returns the register name of a symbol.
135 Used so that 'regs' can be an incomplete type. */
136 const char *(*getRegName)(struct regs *reg);
138 /* list of keywords that are used by this
139 target (used by lexer) */
142 /* Write any port specific assembler output. */
143 void (*genAssemblerPreamble)(FILE *of);
145 /* Write the port specific IVT. If genIVT is NULL or if
146 * it returns zero, default (8051) IVT generation code
149 int (*genIVT)(FILE *of, symbol **intTable, int intCount);
152 /* parameter passing in register related functions */
153 void (*reset_regparms)(); /* reset the register count */
154 int (*reg_parm)(struct link *); /* will return 1 if can be passed in register */
156 /** Process the pragma string 'sz'. Returns 0 if recognised and
157 processed, 1 otherwise. May be NULL.
159 int (*process_pragma)(const char *sz);
161 /** If TRUE, then tprintf and !dw will be used for some initalisers
163 bool use_dw_for_init;
165 /* condition transformations */
166 bool lt_nge ; /* transform (a < b) to !(a >= b) */
167 bool gt_nle ; /* transform (a > b) to !(a <= b) */
168 bool le_ngt ; /* transform (a <= b) to !(a > b) */
169 bool ge_nlt ; /* transform (a >= b) to !(a < b) */
170 bool ne_neq ; /* transform a != b --> ! (a == b) */
171 bool eq_nne ; /* transform a == b --> ! (a != b) */
176 #if !OPT_DISABLE_MCS51
177 extern PORT mcs51_port;
179 #if !OPT_DISABLE_GBZ80
180 extern PORT gbz80_port;
183 extern PORT z80_port;
186 extern PORT avr_port;
188 #if !OPT_DISABLE_DS390
189 extern PORT ds390_port;
192 extern PORT pic14_port;
195 /* Test to see if we are current compiling in DS390 mode. */
196 #define IS_MCS51_PORT (port == &mcs51_port)
197 #define IS_GBZ80_PORT (port == &gbz80_port)
198 #define IS_Z80_PORT (port == &z80_port)
199 #define IS_AVR_PORT (port == &avr_port)
200 #define IS_DS390_PORT (port == &ds390_port)
201 #define IS_PIC_PORT (port == &pic14_port)