Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    Copyright (c) 1993 Open Software Foundation, Inc.
3
 
4
 
5
    All Rights Reserved
6
 
7
 
8
    Permission to use, copy, modify, and distribute this software
9
    and its documentation for any purpose and without fee is hereby
10
    granted, provided that the above copyright notice appears in all
11
    copies and that both the copyright notice and this permission
12
    notice appear in supporting documentation.
13
 
14
 
15
    OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING
16
    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
17
    PARTICULAR PURPOSE.
18
 
19
 
20
    IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
21
    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
    LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
23
    NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
24
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
*/
26
 
27
/*
28
    		 Crown Copyright (c) 1997
29
 
30
    This TenDRA(r) Computer Program is subject to Copyright
31
    owned by the United Kingdom Secretary of State for Defence
32
    acting through the Defence Evaluation and Research Agency
33
    (DERA).  It is made available to Recipients with a
34
    royalty-free licence for its use, reproduction, transfer
35
    to other parties and amendment for any purpose not excluding
36
    product development provided that any such use et cetera
37
    shall be deemed to be acceptance of the following conditions:-
38
 
39
        (1) Its Recipients shall ensure that this Notice is
40
        reproduced upon any copies or amended versions of it;
41
 
42
        (2) Any amended version of it shall be clearly marked to
43
        show both the nature of and the organisation responsible
44
        for the relevant amendment or amendments;
45
 
46
        (3) Its onward transfer from a recipient to another
47
        party shall be deemed to be that party's acceptance of
48
        these conditions;
49
 
50
        (4) DERA gives no warranty or assurance as to its
51
        quality or suitability for any purpose and DERA accepts
52
        no liability whatsoever in relation to any use to which
53
        it may be put.
54
*/
55
 
56
 
57
 
58
/**********************************************************************
59
$Author: release $
60
$Date: 1998/02/04 15:49:08 $
61
$Revision: 1.2 $
62
$Log: regmacs.h,v $
63
 * Revision 1.2  1998/02/04  15:49:08  release
64
 * Added OSF copyright message.
65
 *
66
 * Revision 1.1.1.1  1998/01/17  15:55:58  release
67
 * First version to be checked into rolling release.
68
 *
69
 * Revision 1.2  1996/10/04  16:04:15  pwe
70
 * add banners and mod for PWE ownership
71
 *
72
**********************************************************************/
73
 
74
 
75
#ifndef REGMACS_H
76
#define REGMACS_H
77
 
78
 
79
/* fixed point regs */
80
#define R_0	0
81
#define R_SP	1
82
#define R_TOC	2
83
#define R_3	3
84
#define R_4	4
85
#define R_5	5
86
#define R_6	6
87
#define R_7	7
88
#define R_8	8
89
#define R_9	9
90
#define R_10	10
91
#define R_11	11
92
#define R_12	12
93
#define R_13	13
94
#define R_14	14
95
#define R_15	15
96
#define R_16	16
97
#define R_17	17
98
#define R_18	18
99
#define R_19	19
100
#define R_20	20
101
#define R_21	21
102
#define R_22	22
103
#define R_23	23
104
#define R_24	24
105
#define R_25	25
106
#define R_26	26
107
#define R_27	27
108
#define R_28	28
109
#define R_29	29
110
#define R_30	30
111
#define R_31	31
112
 
113
 
114
 
115
/* float point regs */
116
#define FR_0	0
117
#define FR_1	1
118
#define FR_2	2
119
#define FR_3	3
120
#define FR_4	4
121
#define FR_5	5
122
#define FR_6	6
123
#define FR_7	7
124
#define FR_8	8
125
#define FR_9	9
126
#define FR_10	10
127
#define FR_11	11
128
#define FR_12	12
129
#define FR_13	13
130
#define FR_14	14
131
#define FR_15	15
132
#define FR_16	16
133
#define FR_17	17
134
#define FR_18	18
135
#define FR_19	19
136
#define FR_20	20
137
#define FR_21	21
138
#define FR_22	22
139
#define FR_23	23
140
#define FR_24	24
141
#define FR_25	25
142
#define FR_26	26
143
#define FR_27	27
144
#define FR_28	28
145
#define FR_29	29
146
#define FR_30	30
147
#define FR_31	31
148
 
149
/* frame pointer */
150
#define R_FP    R_31
151
/* top of frame pointer */
152
#define R_TP    R_30
153
 
154
/* temp scratch register than can be used without allocation */
155
#define R_TMP0		R_0		/* reg 0, which is not totally general */
156
 
157
#define IS_R_TMP(r)	((r) == R_TMP0)
158
 
159
 
160
/* registers used for proc paramaters */
161
#define R_FIRST_PARAM		R_3
162
#define R_LAST_PARAM		R_10
163
#define FR_FIRST_PARAM		FR_1
164
#define FR_LAST_PARAM		FR_13
165
 
166
#define IS_PARAM_REG(r)    ((r) >= R_FIRST_PARAM && (r)<= R_LAST_PARAM)
167
#define IS_FLT_PARAM_REG(r)    ((r) >= FR_FIRST_PARAM && (r)<= FR_LAST_PARAM)
168
 
169
/* registers used for proc results */
170
#define R_RESULT		R_3
171
#define FR_RESULT		FR_1
172
 
173
 
174
/* range R_FIRST..R_LAST to loop over fixed regs */
175
#define R_FIRST			R_0
176
#define R_LAST			R_31
177
 
178
/* range FR_FIRST..FR_LAST to loop over float regs */
179
#define FR_FIRST		FR_0
180
#define FR_LAST			FR_31
181
 
182
 
183
 
184
/*
185
 * POWER floating point registers
186
 *
187
 * Two representations are used in sparctrans,
188
 * 0..15 to represent 16 reg-pairs for doubles at the higher (eg fregalloc)
189
 * levels,
190
 * and 0..31 at the lower (assembler) levels.
191
 * This is somewhat confusing, conversion is one way using a 'frg<<1' like
192
 * expression, often in the parameter position of a XXX_ins() function call.
193
 */
194
 
195
/* range R_FLT_FIRST..R_FLT_LAST to loop over float regs */
196
#define R_FLT_FIRST	0
197
#define R_FLT_LAST	31
198
 
199
 
200
 
201
/* Codes, which can be used where register number is usual */
202
#define R_NO_REG	100	/* code for no reg allocated */
203
#define R_USE_RES_REG	101	/* code to indicate result reg to be used */
204
 
205
#define FR_NO_REG	R_NO_REG /* code for no reg allocated */
206
#define FR_DEFER_RESULT	34	/* code to indicate FR_RESULT to be used */
207
 
208
 
209
#define IS_R_NO_REG(r)		((r) == R_NO_REG || (r) == R_0)		/* +++ R_0 historical */
210
#define IS_FR_NO_REG(r)		((r) == FR_NO_REG)
211
 
212
 
213
/*
214
 * Register masks, a bit per reg, as used in 'space' etc.
215
 * A set bit indicates reg is not available for allocation.
216
 */
217
 
218
#define	RMASK(r)	(((unsigned long)1)<<(r))
219
 
220
 
221
/*
222
 * Register sets.
223
 */
224
 
225
 
226
#define IS_FIXREG(r)	((r) >= R_FIRST && (r) <= R_LAST  )
227
 
228
 
229
/* s reg, for local variables, preserved over calls: R_13..R_31  */
230
#define IS_SREG(r)	((r) >= R_13 && (r) <= R_31)
231
 
232
/* t reg, for temp use, not preserved over calls: R_3..R_12 */
233
#define IS_TREG(r)	((r) >= R_3 && (r) <= R_12)	/* R_0-2 special */
234
 
235
#define MAXFIX_SREGS	(R_31-R_13+1)
236
/* maxfix_tregs calculated in translat.c to permit differing reg conventions */
237
 
238
 
239
/* output parameter t fixed regs: R_3..R_10 */
240
#define PARAM_TREGS \
241
			(RMASK(R_3)|RMASK(R_4)|RMASK(R_5)|RMASK(R_6)| \
242
			RMASK(R_7)|RMASK(R_8)|RMASK(R_9)|RMASK(R_10))
243
 
244
 
245
/* output parameter t float regs: FR_1..FR_13 */
246
#define PARAM_FLT_TREGS \
247
			(RMASK(FR_1)|RMASK(FR_2)|RMASK(FR_3)|RMASK(FR_4)| \
248
			RMASK(FR_5)|RMASK(FR_6)|RMASK(FR_7)|RMASK(FR_8)| \
249
			RMASK(FR_9)|RMASK(FR_10)|RMASK(FR_11)|RMASK(FR_12)| \
250
			RMASK(FR_13))
251
 
252
/*
253
 * t regs mask available in proc
254
 *
255
 *	PROC_TREGS	fixed point regs: R_3..R_12
256
 *	PROC_FLT_TREGS	float point regs: FR_0..FR_13
257
 *
258
 * Note this mask sets a bit for those registers that are NOT a t reg.
259
 */
260
#define PROC_TREGS	(~0 - (PARAM_TREGS|RMASK(R_11)|RMASK(R_12)))
261
 
262
#define PROC_FLT_TREGS	(~0 - (RMASK(FR_0)|PARAM_FLT_TREGS))
263
 
264
 
265
/* float s reg, for local variables, preserved over calls: FR_14..FR_31  */
266
#define IS_FLT_SREG(r)	((r) >= FR_14 && (r) <= FR_LAST)
267
 
268
/* float t reg, for temp use, not preserved over calls: FR_0..FR_13 */
269
#define IS_FLT_TREG(r)	((r) >= FR_0 && (r) <= FR_13)
270
 
271
#define MAXFLT_SREGS	(FR_LAST-FR_14+1)
272
#define MAXFLT_TREGS	(FR_13-FR_0+1)
273
 
274
 
275
 
276
/* map fixreg s number 1..n onto real s-reg R_13..R_31 */
277
#define SREG_TO_REALREG(n)	((n) - 1 + R_13)
278
 
279
/* map floatreg s number 1..n onto real s-reg FR_14..FR_31 */
280
#define SFREG_TO_REALFREG(n)	((n) - 1 + FR_14)
281
 
282
 
283
 
284
/* Needed to restore s-regs in tail_call */
285
 
286
#define R_TEMP_FP    R_11
287
#define R_TEMP_TP    R_12
288
#define ALIGNNEXT(bitposn, bitalign)	(((bitposn)+(bitalign)-1) & ~((bitalign)-1))
289
#endif /* regmacs.h */
290
 
291