typedef struct {
/** Target name used for -m */
const char *target;
+
/** Target name string, used for --help */
const char *target_name;
+
+ struct {
+ /** TRUE if all types of glue functions should be inseted into
+ the file that also defines main.
+ We dont want this in cases like the z80 where the startup
+ code is provided by a seperate module.
+ */
+ bool glue_up_main;
+ } general;
+
+ /* assembler related information */
struct {
- /** Command to run (eg as-z80) */
- const char *exec_name;
- /** Arguments for debug mode */
+ /** Command to run and arguments (eg as-z80) */
+ const char **cmd;
+ /** Arguments for debug mode. PENDING: ignored */
const char *debug_opts;
- /** Arguments for normal assembly mode */
+ /** Arguments for normal assembly mode. PENDING: ignored */
const char *plain_opts;
- /** TRUE if the output file name should be pre-pended to the args */
- bool requires_output_name;
} assembler;
+
+ /* linker related info */
struct {
/** Command to run (eg link-z80) */
- const char *exec_name;
+ const char **cmd;
} linker;
+
+ struct {
+ /** Default peephole rules */
+ char *default_rules;
+ } peep;
+
/** Basic type sizes */
struct {
int char_size;
int float_size;
int max_base_size;
} s;
+
/** Names for all the memory regions */
struct {
const char *xstack_name;
const char *static_name;
const char *overlay_name;
} mem;
+
+ /* stack related information */
struct {
/** -1 for grows down (z80), +1 for grows up (mcs51) */
int direction;
} stack;
struct {
- /** One more than the smallest mul/div operation the processor can do nativley
+ /** One more than the smallest
+ mul/div operation the processor can do nativley
Eg if the processor has an 8 bit mul, nativebelow is 2 */
- int nativebelow;
+ int native_below;
} muldiv;
+
+ /** Called once the processor target has been selected.
+ First chance to initalise and set any port specific varibles.
+ 'port' is set before calling this. May be NULL.
+ */
+ void (*init)(void);
/** Parses one option + its arguments */
- bool (*parseOption)(int *pargc, char **argv);
+ bool (*parseOption)(int *pargc, char **argv, int *i);
/** Called after all the options have been parsed. */
void (*finaliseOptions)(void);
/** Called after the port has been selected but before any
void (*setDefaultOptions)(void);
/** Does the dirty work. */
void (*assignRegisters)(eBBlock **, int);
+
/** Returns the register name of a symbol.
Used so that 'regs' can be an incomplete type. */
const char *(*getRegName)(struct regs *reg);
+
+ /* list of keywords that are used by this
+ target (used by lexer) */
+ char **keywords;
+
+ /* Write any port specific assembler output. */
+ void (*genAssemblerPreamble)(FILE *of);
+
+ /* Write the port specific IVT. If genIVT is NULL or if
+ * it returns zero, default (8051) IVT generation code
+ * will be used.
+ */
+ int (*genIVT)(FILE *of, symbol **intTable, int intCount);
} PORT;
extern PORT *port;
#endif
-