Update svn merge history.
[sdcc.git] / sdcc / src / hc08 / ralloc.h
blob2dfba64561eeca30431ca306b730d044d4b4cb9c
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 enum
32 A_IDX,
33 X_IDX,
34 H_IDX,
35 HX_IDX,
36 XA_IDX,
37 CND_IDX,
38 SP_IDX
42 #define REG_PTR 0x01
43 #define REG_GPR 0x02
44 #define REG_CND 0x04
46 /* Must preserve the relation HC08MASK_H > HC08MASK_X > MC08MASK_A */
47 /* so that HC08MASK_REV can be automatically applied when reversing */
48 /* the usual register pair ordering. */
49 #define HC08MASK_A 0x01
50 #define HC08MASK_X 0x02
51 #define HC08MASK_H 0x04
52 #define HC08MASK_REV 0x08
53 #define HC08MASK_XA (HC08MASK_X | HC08MASK_A)
54 #define HC08MASK_HX (HC08MASK_H | HC08MASK_X)
55 #define HC08MASK_AX (HC08MASK_REV | HC08MASK_X | HC08MASK_A)
57 /* definition for the registers */
58 typedef struct reg_info
60 short type; /* can have value
61 REG_GPR, REG_PTR or REG_CND */
62 short rIdx; /* index into register table */
63 char *name; /* name */
64 short mask; /* bitmask for pair allocation */
65 struct asmop *aop; /* last operand */
66 int aopofs; /* last operand offset */
67 unsigned isFree:1; /* is currently unassigned */
68 unsigned isDead:1; /* does not need to survive current instruction */
69 unsigned isLitConst:1; /* has an literal constant loaded */
70 int litConst; /* last literal constant */
72 reg_info;
73 extern reg_info regshc08[];
74 extern reg_info *hc08_reg_a;
75 extern reg_info *hc08_reg_x;
76 extern reg_info *hc08_reg_h;
77 extern reg_info *hc08_reg_hx;
78 extern reg_info *hc08_reg_xa;
79 extern reg_info *hc08_reg_sp;
81 reg_info *hc08_regWithIdx (int);
82 void hc08_useReg (reg_info * reg);
83 void hc08_freeReg (reg_info * reg);
84 void hc08_dirtyReg (reg_info * reg, bool freereg);
85 bitVect *hc08_rUmaskForOp (operand * op);
87 iCode *hc08_ralloc2_cc(ebbIndex *ebbi);
89 #endif