* Added support for the gb.
[fw/sdcc] / 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 { C_IDX = 0,
33        B_IDX, 
34        E_IDX,
35        D_IDX, 
36        L_IDX, 
37        H_IDX,
38 #if DEBUG_FAKE_EXTRA_REGS
39        M_IDX,
40        N_IDX,
41        O_IDX,
42        P_IDX,
43        Q_IDX,
44        R_IDX,
45        S_IDX,
46        T_IDX,
47 #endif
48        CND_IDX };
49
50 #define REG_PTR 0x01
51 #define REG_GPR 0x02
52 #define REG_CND 0x04
53 /* definition for the registers */
54 typedef struct regs
55 {
56     short type;          /* can have value 
57                             REG_GPR, REG_PTR or REG_CND */
58     short rIdx ;         /* index into register table */
59     char *name ;         /* name */
60     unsigned isFree :1;  /* is currently unassigned  */    
61 } regs;
62
63 extern regs *regsZ80;
64
65 void   assignRegisters (eBBlock **, int );
66 regs  *regWithIdx (int);
67
68 void z80_assignRegisters (eBBlock **ebbs, int count);
69
70 #endif