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