* Removed svn:executable property from non-executable files
[fw/sdcc] / src / xa51 / 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 REG_PTR 0x01 // pointer register
31 #define REG_GPR 0x02 // general purpose register
32 #define REG_CND 0x04 // condition (bit) register
33 #define REG_SCR 0x40 // scratch register
34 #define REG_STK 0x80 // stack pointer register
35
36 // register ID's
37 enum {
38   R0L_ID=0x10,R0H_ID,R1L_ID,R1H_ID,R2L_ID,R2H_ID,R3L_ID,R3H_ID,
39   R4L_ID,R4H_ID,R5L_ID,R5H_ID,R6L_ID,R6H_ID,R7L_ID,R7H_ID,
40   R0_ID=0x20, R1_ID, R2_ID, R3_ID, R4_ID, R5_ID, R6_ID, R7_ID,
41   R8_ID, I9_ID, R10_ID, R11_ID, R12_ID, R13_ID, R14_ID, R15_ID,
42   R0R1_ID=0x40, R2R3_ID, R4R5_ID, R6R7_ID
43 };
44
45 typedef struct regs {
46   unsigned char rIdx; // the register ID
47   unsigned char size; // size of register (1,2,4)
48   unsigned char type; // scratch, pointer, general purpose, stack, condition (bit)
49   char *name;
50   unsigned long regMask;
51   bool isFree;
52   symbol *sym; // used by symbol
53 } regs;
54
55 extern regs regsXA51[];
56 extern unsigned long xa51RegsInUse;
57
58 regs *xa51_regWithIdx (int);
59
60 bitVect *xa51_rUmaskForOp (operand * op);
61
62 #endif