a) fixed some aliasing problems
[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 (eg as-z80) */
19         const char *exec_name;
20         /** Arguments for debug mode */
21         const char *debug_opts;
22         /** Arguments for normal assembly mode */
23         const char *plain_opts;
24         /** TRUE if the output file name should be pre-pended to the args */
25         bool requires_output_name;
26     } assembler;
27
28     /* linker related info */
29     struct {
30         /** Command to run (eg link-z80) */
31         const char *exec_name;
32     } linker;
33
34     /** Basic type sizes */
35     struct {
36         int char_size;
37         int short_size;
38         int int_size;
39         int long_size;
40         int ptr_size;
41         int fptr_size;
42         int gptr_size;
43         int bit_size;
44         int float_size;
45         int max_base_size;
46     } s;
47
48     /** Names for all the memory regions */
49     struct {
50         const char *xstack_name;
51         const char *istack_name;
52         const char *code_name;
53         const char *data_name;
54         const char *idata_name;
55         const char *xdata_name;
56         const char *bit_name;
57         const char *reg_name;
58         const char *static_name;
59         const char *overlay_name;
60     } mem;
61     
62     /* stack related information */
63     struct {
64         /** -1 for grows down (z80), +1 for grows up (mcs51) */
65         int direction;
66         /** Extra overhead when calling between banks */
67         int bank_overhead;
68         /** Extra overhead when the function is an ISR */
69         int isr_overhead;
70         /** Standard overhead for a function call */
71         int call_overhead;
72         /** Re-enterant space */
73         int reent_overhead;
74         
75     } stack;
76     struct {
77         /** One more than the smallest 
78             mul/div operation the processor can do nativley 
79             Eg if the processor has an 8 bit mul, nativebelow is 2 */
80         int nativebelow;
81     } muldiv;
82
83     /** Parses one option + its arguments */
84     bool (*parseOption)(int *pargc, char **argv);
85     /** Called after all the options have been parsed. */
86     void (*finaliseOptions)(void);
87     /** Called after the port has been selected but before any
88         options are parsed. */
89     void (*setDefaultOptions)(void);
90     /** Does the dirty work. */
91     void (*assignRegisters)(eBBlock **, int);
92     
93     /** Returns the register name of a symbol.
94         Used so that 'regs' can be an incomplete type. */
95     const char *(*getRegName)(struct regs *reg);
96
97     /* list of keywords that are used by this
98        target (used by lexer) */
99     char **keywords; 
100 } PORT;
101
102 extern PORT *port;
103
104 #endif
105