Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:gmcgarry:20090124214348

Diff

Diff from 1.10 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/mips/macdefs.h

Annotated File View

gmcgarry
1.10
1 /*      $Id: macdefs.h,v 1.10 2009/01/24 21:43:49 gmcgarry Exp $        */
ragge
1.1
2 /*
3  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 /*
30  * MIPS port by Jan Enoksson (janeno-1@student.ltu.se) and
31  * Simon Olsson (simols-1@student.ltu.se) 2005.
32  */
33
34 /*
35  * Machine-dependent defines for both passes.
36  */
37
gmcgarry
1.3
38 #if TARGOS == netbsd
39 #define USE_GAS
40 #endif
41
ragge
1.1
42 /*
43  * Convert (multi-)character constant to integer.
44  * Assume: If only one value; store at left side (char size), otherwise 
45  * treat it as an integer.
46  */
47 #define makecc(val,i)   lastcon = (lastcon<<8)|((val<<24)>>24);
48
gmcgarry
1.7
49 #define ARGINIT         (16*8)  /* # bits above fp where arguments start */
gmcgarry
1.3
50 #define AUTOINIT        (0)     /* # bits below fp where automatics start */
ragge
1.1
51
52 /*
53  * Storage space requirements
54  */
55 #define SZCHAR          8
gmcgarry
1.2
56 #define SZBOOL          32
ragge
1.1
57 #define SZINT           32
58 #define SZFLOAT         32
59 #define SZDOUBLE        64
gmcgarry
1.7
60 #define SZLDOUBLE       64
ragge
1.1
61 #define SZLONG          32
62 #define SZSHORT         16
63 #define SZLONGLONG      64
64 #define SZPOINT(t)      32
65
66 /*
67  * Alignment constraints
68  */
69 #define ALCHAR          8
gmcgarry
1.2
70 #define ALBOOL          32
ragge
1.1
71 #define ALINT           32
gmcgarry
1.9
72 #define ALFLOAT         32
gmcgarry
1.7
73 #define ALDOUBLE        64
74 #define ALLDOUBLE       64
ragge
1.1
75 #define ALLONG          32
gmcgarry
1.7
76 #define ALLONGLONG      64
ragge
1.1
77 #define ALSHORT         16
78 #define ALPOINT         32
gmcgarry
1.10
79 #define ALSTRUCT        64
80 #define ALSTACK         32 
ragge
1.1
81
82 /*
83  * Min/max values.
84  */
85 #define MIN_CHAR        -128
86 #define MAX_CHAR        127
87 #define MAX_UCHAR       255
88 #define MIN_SHORT       -32768
89 #define MAX_SHORT       32767
90 #define MAX_USHORT      65535
91 #define MIN_INT         -1
92 #define MAX_INT         0x7fffffff
93 #define MAX_UNSIGNED    0xffffffff
94 #define MIN_LONG        MIN_INT
95 #define MAX_LONG        MAX_INT
96 #define MAX_ULONG       MAX_UNSIGNED
97 #define MIN_LONGLONG    0x8000000000000000LL
98 #define MAX_LONGLONG    0x7fffffffffffffffLL
99 #define MAX_ULONGLONG   0xffffffffffffffffULL
100
101 #undef  CHAR_UNSIGNED
gmcgarry
1.2
102 #define BOOL_TYPE       INT
ragge
1.1
103
104 /*
105  * Use large-enough types.
106  */
107 typedef long long CONSZ;
108 typedef unsigned long long U_CONSZ;
109 typedef long long OFFSZ;
110
111 #define CONFMT  "%lld"          /* format for printing constants */
gmcgarry
1.3
112 #ifdef USE_GAS
113 #define LABFMT  "$L%d"          /* format for printing labels */
114 #define STABLBL "$LL%d"         /* format for stab (debugging) labels */
115 #else
gmcgarry
1.2
116 #define LABFMT  "L%d"           /* format for printing labels */
117 #define STABLBL "LL%d"          /* format for stab (debugging) labels */
ragge
1.1
118 #endif
119
120 #define BACKAUTO                /* stack grows negatively for automatics */
121 #define BACKTEMP                /* stack grows negatively for temporaries */
122
123 #undef  FIELDOPS                /* no bit-field instructions */
gmcgarry
1.10
124 #define RTOLBYTES 1             /* bytes are numbered right to left */
ragge
1.1
125
126 #define ENUMSIZE(high,low) INT  /* enums are always stored in full int */
127
128 /* Definitions mostly used in pass2 */
129
130 #define BYTEOFF(x)      ((x)&03)
gmcgarry
1.3
131 #define BITOOR(x)       (x)     /* bit offset to oreg offset */
ragge
1.1
132
gmcgarry
1.10
133 #define szty(t)         (((t) == DOUBLE || (t) == LDOUBLE || \
134         DEUNSIGN(t) == LONGLONG) ? 2 : 1)
ragge
1.1
135
136 /*
137  * Register names.  These must match rnames[] and rstatus[] in local2.c.
138  */
gmcgarry
1.3
139 #define ZERO    0
140 #define AT      1
141 #define V0      2
142 #define V1      3
143 #define A0      4
144 #define A1      5
145 #define A2      6
146 #define A3      7
147 #define A4      8
148 #define A5      9
149 #define A6      10
150 #define A7      11
gmcgarry
1.7
151 #if defined(MIPS_N32) || defined(MIPS_N64)
gmcgarry
1.3
152 #define T0      12
153 #define T1      13
154 #define T2      14
155 #define T3      15
156 #else
157 #define T0      8
158 #define T1      9
159 #define T2      10
160 #define T3      11
gmcgarry
1.7
161 #endif
gmcgarry
1.3
162 #define T4      12
163 #define T5      13
164 #define T6      14
165 #define T7      15
166 #define S0      16
167 #define S1      17
168 #define S2      18
169 #define S3      19
170 #define S4      20
171 #define S5      21
172 #define S6      22
173 #define S7      23
174 #define T8      24
175 #define T9      25
176 #define K0      26
177 #define K1      27
178 #define GP      28
179 #define SP      29
180 #define FP      30
181 #define RA      31
182
183 #define V0V1    32
184 #define A0A1    33
185 #define A1A2    34
186 #define A2A3    35
gmcgarry
1.7
187
188 /* we just use o32 naming here, but it works ok for n32/n64 */
189 #define A3T0    36
gmcgarry
1.3
190 #define T0T1    37
191 #define T1T2    38
192 #define T2T3    39
193 #define T3T4    40
194 #define T4T5    41
195 #define T5T6    42
196 #define T6T7    43
gmcgarry
1.7
197 #define T7T8    44
198
199 #define T8T9    45
200 #define S0S1    46
201 #define S1S2    47
202 #define S2S3    48
203 #define S3S4    49
204 #define S4S5    50
205 #define S5S6    51
206 #define S6S7    52
207
208 #define F0      53
209 #define F2      54
210 #define F4      55
211 #define F6      56
212 #define F8      57
213 #define F10     58
214 #define F12     59
215 #define F14     60
216 #define F16     61
217 #define F18     62
218 #define F20     63
gmcgarry
1.5
219 /* and the rest for later */
gmcgarry
1.7
220 #define F22     64
221 #define F24     65
222 #define F26     66
223 #define F28     67
224 #define F30     68
gmcgarry
1.2
225
gmcgarry
1.4
226 #define MAXREGS 64
gmcgarry
1.3
227 #define NUMCLASS 3
228
gmcgarry
1.6
229 #define RETREG(x)       (DEUNSIGN(x) == LONGLONG ? V0V1 : \
gmcgarry
1.5
230                             (x) == DOUBLE || (x) == LDOUBLE || (x) == FLOAT ? \
gmcgarry
1.6
231                             F0 : V0)
ragge
1.1
232 #define FPREG   FP      /* frame pointer */
gmcgarry
1.2
233
gmcgarry
1.5
234 #define MIPS_N32_NARGREGS       8
235 #define MIPS_O32_NARGREGS       4
ragge
1.1
236
gmcgarry
1.2
237 #define RSTATUS \
gmcgarry
1.3
238         00,                                                           \
239         SAREG|TEMPREGSAREG|TEMPREG,                                   \
gmcgarry
1.2
240         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
241         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
242         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
243         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,     \
244         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,     \
gmcgarry
1.3
245         SAREG|TEMPREGSAREG|TEMPREG,                                   \
gmcgarry
1.2
246         00,                                                           \
gmcgarry
1.3
247         0000,                                                     \
248         \
249         SBREG|TEMPREG,                                                  \
250         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,                    \
gmcgarry
1.7
251         SBREG|TEMPREG,                                                  \
gmcgarry
1.3
252         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,                    \
gmcgarry
1.7
253         SBREG|TEMPREGSBREG|TEMPREG,                                   \
254         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,     \
gmcgarry
1.3
255         SBREGSBREGSBREGSBREG,                                     \
256         SBREGSBREGSBREG,                                            \
gmcgarry
1.5
257         SCREGSCREGSCREGSCREG,                                     \
258         SCREGSCREGSCREGSCREG,                                     \
gmcgarry
1.7
259         SCREGSCREGSCREG,                                            \
gmcgarry
1.2
260
261 #define ROVERLAP \
gmcgarry
1.7
262         { -1 },                         /* $zero */                     \
263         { -1 },                         /* $at */                       \
264         { V0V1, -1 },                   /* $v0 */                       \
265         { V0V1, -1 },                   /* $v1 */                       \
266         { A0A1, -1 },                   /* $a0 */                       \
267         { A0A1A1A2, -1 },             /* $a1 */                       \
268         { A1A2A2A3, -1 },             /* $a2 */                       \
269         { A2A3A3T0, -1 },             /* $a3 */                       \
270         { A3T0T0T1, -1 },             /* $t0 */                       \
271         { T0T1T1T2, -1 },             /* $t1 */                       \
272         { T1T2T2T3, -1 },             /* $t2 */                       \
273         { T2T3T3T4, -1 },             /* $t3 */                       \
274         { T3T4T4T5, -1 },             /* $t4 */                       \
275         { T4T5T5T6, -1 },             /* $t5 */                       \
276         { T6T7T7T8, -1 },             /* $t6 */                       \
277         { T7T8T8T9, -1 },             /* $t7 */                       \
278         \
279         { S0S1, -1 },                   /* $s0 */                       \
280         { S0S1S1S2, -1 },             /* $s1 */                       \
281         { S1S2S2S3, -1 },             /* $s2 */                       \
282         { S2S3S3S4, -1 },             /* $s3 */                       \
283         { S3S4S4S5, -1 },             /* $s4 */                       \
284         { S4S5S5S6, -1 },             /* $s5 */                       \
285         { S5S6S6S7, -1 },             /* $s6 */                       \
286         { S6S7, -1 },                   /* $s7 */                       \
287         \
288         { T7T8T8T9, -1 },             /* $t8 */                       \
289         { T8T9, -1 },                   /* $t9 */                       \
290         \
291         { -1 },                         /* $k0 */                       \
292         { -1 },                         /* $k1 */                       \
293         { -1 },                         /* $gp */                       \
294         { -1 },                         /* $sp */                       \
295         { -1 },                         /* $fp */                       \
296         { -1 },                         /* $ra */                       \
297         \
298         { V0V1, -1 },                 /* $v0:$v1 */                   \
299         \
300         { A0A1A1A2, -1 },           /* $a0:$a1 */                   \
301         { A1A2A0A1A2A3, -1 },     /* $a1:$a2 */                   \
302         { A2A3A1A2A3T0, -1 },     /* $a2:$a3 */                   \
303         { A3T0A2A3T0T1, -1 },     /* $a3:$t0 */                   \
304         { T0T1A3T0T1T2, -1 },     /* $t0:$t1 */                   \
305         { T1T2T0T1T2T3, -1 },     /* $t1:$t2 */                   \
306         { T2T3T1T2T3T4, -1 },     /* $t2:$t3 */                   \
307         { T3T4T2T3T4T5, -1 },     /* $t3:$t4 */                   \
308         { T4T5T3T4T5T6, -1 },     /* $t4:$t5 */                   \
309         { T5T6T4T5T6T7, -1 },     /* $t5:$t6 */                   \
310         { T6T7T5T6T7T8, -1 },     /* $t6:$t7 */                   \
311         { T7T8T6T7T8T9, -1 },     /* $t7:$t8 */                   \
312         { T8T9T7T8, -1 },           /* $t8:$t9 */                   \
gmcgarry
1.3
313         \
gmcgarry
1.7
314         { S0S1S1S2, -1 },           /* $s0:$s1 */                   \
gmcgarry
1.3
315         { S1S2S0S1S2S3, -1 },                                     \
316         { S2S3S1S2S3S4, -1 },                                     \
317         { S3S4S2S3S4S5, -1 },                                     \
318         { S4S5S3S4S5S6, -1 },                                     \
319         { S5S6S4S5S6S7, -1 },                                     \
320         { S6S7S5S6, -1 },                                           \
321         \
gmcgarry
1.5
322         { -1 }, { -1 }, { -1 }, { -1 },                                 \
323         { -1 }, { -1 }, { -1 }, { -1 },                                 \
gmcgarry
1.7
324         { -1 }, { -1 }, { -1 },                                         \
gmcgarry
1.3
325
326 #define GCLASS(x)       (x < 32 ? CLASSA : (x < 52 ? CLASSB : CLASSC))
gmcgarry
1.4
327 #define PCLASS(p)       (1 << gclass((p)->n_type))
gmcgarry
1.2
328 #define DECRA(x,y)      (((x) >> (y*6)) & 63)   /* decode encoded regs */
329 #define ENCRA(x,y)      ((x) << (6+y*6))        /* encode regs in int */
gmcgarry
1.8
330 #define ENCRD(x)        (x)                     /* Encode dest reg in n_reg */
ragge
1.1
331
gmcgarry
1.2
332 int COLORMAP(int cint *r);
gmcgarry
1.5
333
334 extern int bigendian;
335 extern int nargregs;
gmcgarry
1.6
336
gmcgarry
1.7
337 #define SPCON           (MAXSPECIAL+1)  /* positive constant */
338
gmcgarry
1.6
339 #define TARGET_STDARGS
340 #define TARGET_BUILTINS                                         \
341         { "__builtin_stdarg_start"mips_builtin_stdarg_start },        \
342         { "__builtin_va_arg"mips_builtin_va_arg },            \
343         { "__builtin_va_end"mips_builtin_va_end },            \
344         { "__builtin_va_copy"mips_builtin_va_copy },
345
346 struct node;
347 struct node *mips_builtin_stdarg_start(struct node *fstruct node *a);
348 struct node *mips_builtin_va_arg(struct node *fstruct node *a);
349 struct node *mips_builtin_va_end(struct node *fstruct node *a);
350 struct node *mips_builtin_va_copy(struct node *fstruct node *a);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-31 06:37 +0100