struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / src / z80 / ralloc.h
blob88e97d4fe21dadaf9b90c6c26864437acaac9fb9
1 /*-------------------------------------------------------------------------
3 SDCCralloc.h - header file register allocation
5 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 In other words, you are welcome to use, share and improve this program.
22 You are forbidden to forbid anyone else to use, share and improve
23 what you give them. Help stamp out software-hoarding!
24 -------------------------------------------------------------------------*/
25 #include "SDCCicode.h"
26 #include "SDCCBBlock.h"
27 #ifndef SDCCRALLOC_H
28 #define SDCCRALLOC_H 1
30 #define DEBUG_FAKE_EXTRA_REGS 0
32 #define USE_OLDSALLOC 0 // Change to 1 to use old stack allocator
34 enum
36 A_IDX = 0,
37 C_IDX,
38 B_IDX,
39 E_IDX,
40 D_IDX,
41 L_IDX,
42 H_IDX,
43 IYL_IDX,
44 IYH_IDX,
45 #if DEBUG_FAKE_EXTRA_REGS
46 M_IDX,
47 N_IDX,
48 O_IDX,
49 P_IDX,
50 Q_IDX,
51 R_IDX,
52 S_IDX,
53 T_IDX,
54 #endif
55 CND_IDX,
57 // These pairs are for internal use in code generation only.
58 IY_IDX,
59 BC_IDX,
60 DE_IDX,
61 HL_IDX
64 enum
66 REG_PTR = 1,
67 REG_GPR = 2,
68 REG_CND = 4,
69 REG_PAIR = 8
72 /* definition for the registers */
73 typedef struct reg_info
75 short type; /* can have value
76 REG_GPR, REG_PTR or REG_CND */
77 short rIdx; /* index into register table */
78 char *name; /* name */
79 unsigned isFree:1; /* is currently unassigned */
80 } reg_info;
82 extern reg_info *regsZ80;
84 void assignRegisters (eBBlock **, int);
85 reg_info *regWithIdx (int);
87 void z80_assignRegisters (ebbIndex *);
88 bitVect *z80_rUmaskForOp (const operand * op);
90 void z80SpillThis (symbol *);
91 iCode *z80_ralloc2_cc(ebbIndex *ebbi);
93 void Z80RegFix (eBBlock ** ebbs, int count);
94 #endif