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