Changed it so each target can have their own command line.
[fw/sdcc] / src / port.h
1 /** @file port.h
2     Definitions for what a port must provide.
3     All ports are referenced in SDCCmain.c.
4 */
5 #ifndef PORT_INCLUDE
6 #define PORT_INCLUDE
7
8 /* Processor specific names */
9 typedef struct {
10     /** Target name used for -m */
11     const char *target;
12
13     /** Target name string, used for --help */
14     const char *target_name;
15
16     /* assembler related information */
17     struct {
18         /** Command to run and arguments (eg as-z80) */
19         const char **cmd;
20         /** Arguments for debug mode.  PENDING: ignored */
21         const char *debug_opts;
22         /** Arguments for normal assembly mode.  PENDING: ignored */
23         const char *plain_opts;
24     } assembler;
25
26     /* linker related info */
27     struct {
28         /** Command to run (eg link-z80) */
29         const char **cmd;
30     } linker;
31
32     /** Basic type sizes */
33     struct {
34         int char_size;
35         int short_size;
36         int int_size;
37         int long_size;
38         int ptr_size;
39         int fptr_size;
40         int gptr_size;
41         int bit_size;
42         int float_size;
43         int max_base_size;
44     } s;
45
46     /** Names for all the memory regions */
47     struct {
48         const char *xstack_name;
49         const char *istack_name;
50         const char *code_name;
51         const char *data_name;
52         const char *idata_name;
53         const char *xdata_name;
54         const char *bit_name;
55         const char *reg_name;
56         const char *static_name;
57         const char *overlay_name;
58     } mem;
59     
60     /* stack related information */
61     struct {
62         /** -1 for grows down (z80), +1 for grows up (mcs51) */
63         int direction;
64         /** Extra overhead when calling between banks */
65         int bank_overhead;
66         /** Extra overhead when the function is an ISR */
67         int isr_overhead;
68         /** Standard overhead for a function call */
69         int call_overhead;
70         /** Re-enterant space */
71         int reent_overhead;
72         
73     } stack;
74     struct {
75         /** One more than the smallest 
76             mul/div operation the processor can do nativley 
77             Eg if the processor has an 8 bit mul, nativebelow is 2 */
78         int nativebelow;
79     } muldiv;
80
81     /** Parses one option + its arguments */
82     bool (*parseOption)(int *pargc, char **argv);
83     /** Called after all the options have been parsed. */
84     void (*finaliseOptions)(void);
85     /** Called after the port has been selected but before any
86         options are parsed. */
87     void (*setDefaultOptions)(void);
88     /** Does the dirty work. */
89     void (*assignRegisters)(eBBlock **, int);
90     
91     /** Returns the register name of a symbol.
92         Used so that 'regs' can be an incomplete type. */
93     const char *(*getRegName)(struct regs *reg);
94
95     /* list of keywords that are used by this
96        target (used by lexer) */
97     char **keywords; 
98 } PORT;
99
100 extern PORT *port;
101
102 #endif
103