Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20110605101924

Diff

Diff from 1.15 to:

Annotations

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

Annotated File View

ragge
1.15
1 /*      $Id: macdefs.h,v 1.15 2011/06/05 10:19:24 ragge 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
plunky
1.14
38 #if defined(os_netbsd)
gmcgarry
1.3
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 */
ragge
1.15
124 #define TARGET_ENDIAN TARGET_LE
ragge
1.1
125
126 /* Definitions mostly used in pass2 */
127
128 #define BYTEOFF(x)      ((x)&03)
gmcgarry
1.3
129 #define BITOOR(x)       (x)     /* bit offset to oreg offset */
ragge
1.1
130
gmcgarry
1.10
131 #define szty(t)         (((t) == DOUBLE || (t) == LDOUBLE || \
132         DEUNSIGN(t) == LONGLONG) ? 2 : 1)
ragge
1.1
133
134 /*
135  * Register names.  These must match rnames[] and rstatus[] in local2.c.
136  */
gmcgarry
1.3
137 #define ZERO    0
138 #define AT      1
139 #define V0      2
140 #define V1      3
141 #define A0      4
142 #define A1      5
143 #define A2      6
144 #define A3      7
145 #define A4      8
146 #define A5      9
147 #define A6      10
148 #define A7      11
gmcgarry
1.7
149 #if defined(MIPS_N32) || defined(MIPS_N64)
gmcgarry
1.3
150 #define T0      12
151 #define T1      13
152 #define T2      14
153 #define T3      15
154 #else
155 #define T0      8
156 #define T1      9
157 #define T2      10
158 #define T3      11
gmcgarry
1.7
159 #endif
gmcgarry
1.3
160 #define T4      12
161 #define T5      13
162 #define T6      14
163 #define T7      15
164 #define S0      16
165 #define S1      17
166 #define S2      18
167 #define S3      19
168 #define S4      20
169 #define S5      21
170 #define S6      22
171 #define S7      23
172 #define T8      24
173 #define T9      25
174 #define K0      26
175 #define K1      27
176 #define GP      28
177 #define SP      29
178 #define FP      30
179 #define RA      31
180
181 #define V0V1    32
182 #define A0A1    33
183 #define A1A2    34
184 #define A2A3    35
gmcgarry
1.7
185
186 /* we just use o32 naming here, but it works ok for n32/n64 */
187 #define A3T0    36
gmcgarry
1.3
188 #define T0T1    37
189 #define T1T2    38
190 #define T2T3    39
191 #define T3T4    40
192 #define T4T5    41
193 #define T5T6    42
194 #define T6T7    43
gmcgarry
1.7
195 #define T7T8    44
196
197 #define T8T9    45
198 #define S0S1    46
199 #define S1S2    47
200 #define S2S3    48
201 #define S3S4    49
202 #define S4S5    50
203 #define S5S6    51
204 #define S6S7    52
205
206 #define F0      53
207 #define F2      54
208 #define F4      55
209 #define F6      56
210 #define F8      57
211 #define F10     58
212 #define F12     59
213 #define F14     60
214 #define F16     61
215 #define F18     62
216 #define F20     63
gmcgarry
1.5
217 /* and the rest for later */
gmcgarry
1.7
218 #define F22     64
219 #define F24     65
220 #define F26     66
221 #define F28     67
222 #define F30     68
gmcgarry
1.2
223
gmcgarry
1.4
224 #define MAXREGS 64
gmcgarry
1.3
225 #define NUMCLASS 3
226
gmcgarry
1.6
227 #define RETREG(x)       (DEUNSIGN(x) == LONGLONG ? V0V1 : \
gmcgarry
1.5
228                             (x) == DOUBLE || (x) == LDOUBLE || (x) == FLOAT ? \
gmcgarry
1.6
229                             F0 : V0)
ragge
1.1
230 #define FPREG   FP      /* frame pointer */
gmcgarry
1.2
231
gmcgarry
1.5
232 #define MIPS_N32_NARGREGS       8
233 #define MIPS_O32_NARGREGS       4
ragge
1.1
234
gmcgarry
1.2
235 #define RSTATUS \
gmcgarry
1.3
236         00,                                                           \
237         SAREG|TEMPREGSAREG|TEMPREG,                                   \
gmcgarry
1.2
238         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
239         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
240         SAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREGSAREG|TEMPREG,     \
241         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,     \
242         SAREG|PERMREGSAREG|PERMREGSAREG|PERMREGSAREG|PERMREG,     \
gmcgarry
1.3
243         SAREG|TEMPREGSAREG|TEMPREG,                                   \
gmcgarry
1.2
244         00,                                                           \
gmcgarry
1.3
245         0000,                                                     \
246         \
247         SBREG|TEMPREG,                                                  \
248         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,                    \
gmcgarry
1.7
249         SBREG|TEMPREG,                                                  \
gmcgarry
1.3
250         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,                    \
gmcgarry
1.7
251         SBREG|TEMPREGSBREG|TEMPREG,                                   \
252         SBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREGSBREG|TEMPREG,     \
gmcgarry
1.3
253         SBREGSBREGSBREGSBREG,                                     \
254         SBREGSBREGSBREG,                                            \
gmcgarry
1.5
255         SCREGSCREGSCREGSCREG,                                     \
256         SCREGSCREGSCREGSCREG,                                     \
gmcgarry
1.7
257         SCREGSCREGSCREG,                                            \
gmcgarry
1.2
258
259 #define ROVERLAP \
gmcgarry
1.7
260         { -1 },                         /* $zero */                     \
261         { -1 },                         /* $at */                       \
262         { V0V1, -1 },                   /* $v0 */                       \
263         { V0V1, -1 },                   /* $v1 */                       \
264         { A0A1, -1 },                   /* $a0 */                       \
265         { A0A1A1A2, -1 },             /* $a1 */                       \
266         { A1A2A2A3, -1 },             /* $a2 */                       \
267         { A2A3A3T0, -1 },             /* $a3 */                       \
268         { A3T0T0T1, -1 },             /* $t0 */                       \
269         { T0T1T1T2, -1 },             /* $t1 */                       \
270         { T1T2T2T3, -1 },             /* $t2 */                       \
271         { T2T3T3T4, -1 },             /* $t3 */                       \
272         { T3T4T4T5, -1 },             /* $t4 */                       \
273         { T4T5T5T6, -1 },             /* $t5 */                       \
274         { T6T7T7T8, -1 },             /* $t6 */                       \
275         { T7T8T8T9, -1 },             /* $t7 */                       \
276         \
277         { S0S1, -1 },                   /* $s0 */                       \
278         { S0S1S1S2, -1 },             /* $s1 */                       \
279         { S1S2S2S3, -1 },             /* $s2 */                       \
280         { S2S3S3S4, -1 },             /* $s3 */                       \
281         { S3S4S4S5, -1 },             /* $s4 */                       \
282         { S4S5S5S6, -1 },             /* $s5 */                       \
283         { S5S6S6S7, -1 },             /* $s6 */                       \
284         { S6S7, -1 },                   /* $s7 */                       \
285         \
286         { T7T8T8T9, -1 },             /* $t8 */                       \
287         { T8T9, -1 },                   /* $t9 */                       \
288         \
289         { -1 },                         /* $k0 */                       \
290         { -1 },                         /* $k1 */                       \
291         { -1 },                         /* $gp */                       \
292         { -1 },                         /* $sp */                       \
293         { -1 },                         /* $fp */                       \
294         { -1 },                         /* $ra */                       \
295         \
296         { V0V1, -1 },                 /* $v0:$v1 */                   \
297         \
298         { A0A1A1A2, -1 },           /* $a0:$a1 */                   \
299         { A1A2A0A1A2A3, -1 },     /* $a1:$a2 */                   \
300         { A2A3A1A2A3T0, -1 },     /* $a2:$a3 */                   \
301         { A3T0A2A3T0T1, -1 },     /* $a3:$t0 */                   \
302         { T0T1A3T0T1T2, -1 },     /* $t0:$t1 */                   \
303         { T1T2T0T1T2T3, -1 },     /* $t1:$t2 */                   \
304         { T2T3T1T2T3T4, -1 },     /* $t2:$t3 */                   \
305         { T3T4T2T3T4T5, -1 },     /* $t3:$t4 */                   \
306         { T4T5T3T4T5T6, -1 },     /* $t4:$t5 */                   \
307         { T5T6T4T5T6T7, -1 },     /* $t5:$t6 */                   \
308         { T6T7T5T6T7T8, -1 },     /* $t6:$t7 */                   \
309         { T7T8T6T7T8T9, -1 },     /* $t7:$t8 */                   \
310         { T8T9T7T8, -1 },           /* $t8:$t9 */                   \
gmcgarry
1.3
311         \
gmcgarry
1.7
312         { S0S1S1S2, -1 },           /* $s0:$s1 */                   \
gmcgarry
1.3
313         { S1S2S0S1S2S3, -1 },                                     \
314         { S2S3S1S2S3S4, -1 },                                     \
315         { S3S4S2S3S4S5, -1 },                                     \
316         { S4S5S3S4S5S6, -1 },                                     \
317         { S5S6S4S5S6S7, -1 },                                     \
318         { S6S7S5S6, -1 },                                           \
319         \
gmcgarry
1.5
320         { -1 }, { -1 }, { -1 }, { -1 },                                 \
321         { -1 }, { -1 }, { -1 }, { -1 },                                 \
gmcgarry
1.7
322         { -1 }, { -1 }, { -1 },                                         \
gmcgarry
1.3
323
324 #define GCLASS(x)       (x < 32 ? CLASSA : (x < 52 ? CLASSB : CLASSC))
gmcgarry
1.4
325 #define PCLASS(p)       (1 << gclass((p)->n_type))
gmcgarry
1.2
326 #define DECRA(x,y)      (((x) >> (y*6)) & 63)   /* decode encoded regs */
327 #define ENCRA(x,y)      ((x) << (6+y*6))        /* encode regs in int */
gmcgarry
1.8
328 #define ENCRD(x)        (x)                     /* Encode dest reg in n_reg */
ragge
1.1
329
gmcgarry
1.2
330 int COLORMAP(int cint *r);
gmcgarry
1.5
331
332 extern int bigendian;
333 extern int nargregs;
gmcgarry
1.6
334
gmcgarry
1.7
335 #define SPCON           (MAXSPECIAL+1)  /* positive constant */
336
gmcgarry
1.6
337 #define TARGET_STDARGS
338 #define TARGET_BUILTINS                                         \
ragge
1.12
339         { "__builtin_stdarg_start"mips_builtin_stdarg_start2 },     \
340         { "__builtin_va_arg"mips_builtin_va_arg2 },         \
341         { "__builtin_va_end"mips_builtin_va_end1 },         \
342         { "__builtin_va_copy"mips_builtin_va_copy2 },
gmcgarry
1.6
343
344 struct node;
ragge
1.11
345 struct node *mips_builtin_stdarg_start(struct node *fstruct node *aunsigned int);
346 struct node *mips_builtin_va_arg(struct node *fstruct node *aunsigned int);
347 struct node *mips_builtin_va_end(struct node *fstruct node *aunsigned int);
348 struct node *mips_builtin_va_copy(struct node *fstruct node *aunsigned int);
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-09-15 04:05 +0200