Imported Upstream version 2.9.0
[debian/cc1111] / src / z80 / ralloc.h
1 /*-------------------------------------------------------------------------
2
3   SDCCralloc.h - header file register allocation
4
5                 Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
6
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.
11    
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.
16    
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.
20    
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
29
30 #define DEBUG_FAKE_EXTRA_REGS   0
31
32 enum
33   {
34     C_IDX = 0,
35     B_IDX,
36     E_IDX,
37     D_IDX,
38     L_IDX,
39     H_IDX,
40 #if DEBUG_FAKE_EXTRA_REGS
41     M_IDX,
42     N_IDX,
43     O_IDX,
44     P_IDX,
45     Q_IDX,
46     R_IDX,
47     S_IDX,
48     T_IDX,
49 #endif
50     CND_IDX
51   };
52
53 enum
54   {
55     REG_PTR = 1,
56     REG_GPR = 2,
57     REG_CND = 4,
58     REG_PAIR = 8
59   };
60
61 /* definition for the registers */
62 typedef struct regs
63   {
64     short type;                 /* can have value 
65                                    REG_GPR, REG_PTR or REG_CND */
66     short rIdx;                 /* index into register table */
67     char *name;                 /* name */
68     unsigned isFree:1;          /* is currently unassigned  */
69   }
70 regs;
71
72 extern regs *regsZ80;
73
74 void assignRegisters (eBBlock **, int);
75 regs *regWithIdx (int);
76
77 void z80_assignRegisters (ebbIndex *);
78 bitVect *z80_rUmaskForOp (operand * op);
79
80 #endif