Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20121201085340

Diff

Diff from 1.17 to:

Annotations

Annotate by Age | Author | Mixed | None
gmcgarry (224) ragge (131) plunky (1)
/fisheye/browse/pcc/pcc/arch/mips/macdefs.h

Annotated File View

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