]> git.gag.com Git - fw/sdcc/blob - src/izt/izt.h
Began adding the code generation framework.
[fw/sdcc] / src / izt / izt.h
1 #include <common.h>
2 #include "gen.h"
3
4 typedef enum {
5     REG_ID_NONE,
6     // Z80
7     REG_ID_A,
8     REG_ID_B,
9     REG_ID_C,
10     REG_ID_D,
11     REG_ID_E,
12     REG_ID_H,
13     REG_ID_L,
14     REG_ID_AF,
15     REG_ID_BC,
16     REG_ID_DE,
17     REG_ID_HL,
18     REG_ID_IX,
19     REG_ID_IY,
20     // TLCS-900H
21     REG_ID_XBC,
22     REG_ID_XDE,
23     // i186
24     REG_ID_CL,
25     REG_ID_CH,
26     REG_ID_CX,
27     REG_ID_DL,
28     REG_ID_DH,
29     REG_ID_DX,
30     REG_ID_MAX
31 } REG_ID;
32
33 enum {
34     REG_USED = 1,
35     REG_USED_HIDDEN = 2
36 };
37
38 enum {
39     REG_TYPE_CND = 1,
40     REG_TYPE_GPR = 2
41 } REG_TYPE;
42
43 typedef struct regs {
44     int size;
45     REG_ID id;
46     const char *name;
47     int used;
48     REG_ID hides[3];
49 } REG;
50
51 #define TEST(_d, _a) \
52         (_a) ? (void)0 : (failures++, printf("Test %s \"%s\" failed.\n", #_a, _d), _dumpRegs())
53
54 #define NUM_OF(_a)      (sizeof(_a)/sizeof(*(_a)))
55
56 typedef struct {
57     REG *regs;
58 } IZT_PORT;
59
60 IZT_PORT *izt_port;
61
62 void izt_init(IZT_PORT *port);
63 void izt_assignRegisters (eBBlock **ebbs, int count);
64 void izt_gen(iCode *ic);