1 | /* $Id: macdefs.h,v 1.5 2009/01/24 21:43:49 gmcgarry Exp $ */
|
---|
2 | /*
|
---|
3 | * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * Redistributions of source code and documentation must retain the above
|
---|
10 | * copyright notice, this list of conditions and the following disclaimer.
|
---|
11 | * Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditionsand the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * All advertising materials mentioning features or use of this software
|
---|
15 | * must display the following acknowledgement:
|
---|
16 | * This product includes software developed or owned by Caldera
|
---|
17 | * International, Inc.
|
---|
18 | * Neither the name of Caldera International, Inc. nor the names of other
|
---|
19 | * contributors may be used to endorse or promote products derived from
|
---|
20 | * this software without specific prior written permission.
|
---|
21 | *
|
---|
22 | * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
|
---|
23 | * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
|
---|
24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
---|
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
26 | * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
|
---|
27 | * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
30 | * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
|
---|
31 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
---|
32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
33 | * POSSIBILITY OF SUCH DAMAGE.
|
---|
34 | */
|
---|
35 |
|
---|
36 | # define makecc(val,i) lastcon = (lastcon<<8)|((val<<24)>>24);
|
---|
37 |
|
---|
38 | # define ARGINIT 32
|
---|
39 | # define AUTOINIT 0
|
---|
40 | # define SZCHAR 8
|
---|
41 | # define SZBOOL 8
|
---|
42 | # define SZINT 32
|
---|
43 | # define SZFLOAT 32
|
---|
44 | # define SZDOUBLE 64
|
---|
45 | # define SZLDOUBLE 64 /* XXX use longer? */
|
---|
46 | # define SZLONG 32
|
---|
47 | # define SZLONGLONG 64
|
---|
48 | # define SZSHORT 16
|
---|
49 | # define SZPOINT(t) 32
|
---|
50 | # define ALCHAR 8
|
---|
51 | # define ALBOOL 8
|
---|
52 | # define ALINT 32
|
---|
53 | # define ALFLOAT 32
|
---|
54 | # define ALDOUBLE 32
|
---|
55 | # define ALLDOUBLE 32
|
---|
56 | # define ALLONG 32
|
---|
57 | # define ALLONGLONG 32
|
---|
58 | # define ALSHORT 16
|
---|
59 | # define ALPOINT 32
|
---|
60 | # define ALSTRUCT 8
|
---|
61 | # define ALSTACK 32
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * Min/max values.
|
---|
65 | */
|
---|
66 | #define MIN_CHAR -128
|
---|
67 | #define MAX_CHAR 127
|
---|
68 | #define MAX_UCHAR 255
|
---|
69 | #define MIN_SHORT -32768
|
---|
70 | #define MAX_SHORT 32767
|
---|
71 | #define MAX_USHORT 65535
|
---|
72 | #define MIN_INT (-0x7fffffff-1)
|
---|
73 | #define MAX_INT 0x7fffffff
|
---|
74 | #define MAX_UNSIGNED 0xffffffff
|
---|
75 | #define MIN_LONG MIN_INT
|
---|
76 | #define MAX_LONG MAX_INT
|
---|
77 | #define MAX_ULONG MAX_UNSIGNED
|
---|
78 | #define MIN_LONGLONG 0x8000000000000000LL
|
---|
79 | #define MAX_LONGLONG 0x7fffffffffffffffLL
|
---|
80 | #define MAX_ULONGLONG 0xffffffffffffffffULL
|
---|
81 |
|
---|
82 | /* Default char is signed */
|
---|
83 | #undef CHAR_UNSIGNED
|
---|
84 | #define BOOL_TYPE CHAR /* what used to store _Bool */
|
---|
85 |
|
---|
86 | /* size in which constants are converted */
|
---|
87 | /* should be long if feasable */
|
---|
88 |
|
---|
89 | typedef long long CONSZ;
|
---|
90 | typedef unsigned long long U_CONSZ;
|
---|
91 |
|
---|
92 | # define CONFMT "%lld"
|
---|
93 | # define LABFMT ".L%d"
|
---|
94 | # define STABLBL ".LL%d"
|
---|
95 |
|
---|
96 | /* size in which offsets are kept
|
---|
97 | * should be large enough to cover address space in bits
|
---|
98 | */
|
---|
99 | typedef long long OFFSZ;
|
---|
100 |
|
---|
101 | /* character set macro */
|
---|
102 |
|
---|
103 | # define CCTRANS(x) x
|
---|
104 |
|
---|
105 | /* register cookie for stack poINTer */
|
---|
106 |
|
---|
107 | # define STKREG 13
|
---|
108 | # define ARGREG 12
|
---|
109 |
|
---|
110 | /* maximum and minimum register variables */
|
---|
111 |
|
---|
112 | # define MAXRVAR 11
|
---|
113 | # define MINRVAR 6
|
---|
114 |
|
---|
115 | /* show stack grows negatively */
|
---|
116 | #define BACKAUTO
|
---|
117 | #define BACKTEMP
|
---|
118 |
|
---|
119 | /* show field hardware support on VAX */
|
---|
120 | #define FIELDOPS
|
---|
121 |
|
---|
122 | /* bytes are numbered from right to left */
|
---|
123 | #define RTOLBYTES
|
---|
124 |
|
---|
125 | /* we want prtree included */
|
---|
126 | # define STDPRTREE
|
---|
127 | # ifndef FORT
|
---|
128 | # define ONEPASS
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | # define ENUMSIZE(high,low) INT
|
---|
132 |
|
---|
133 | /* VAX-11/780 Registers */
|
---|
134 |
|
---|
135 | /* scratch registers */
|
---|
136 | # define R0 0
|
---|
137 | # define R1 1
|
---|
138 | # define R2 2
|
---|
139 | # define R3 3
|
---|
140 | # define R4 4
|
---|
141 | # define R5 5
|
---|
142 |
|
---|
143 | /* register variables */
|
---|
144 | # define R6 6
|
---|
145 | # define R7 7
|
---|
146 | # define R8 8
|
---|
147 | # define R9 9
|
---|
148 | # define R10 10
|
---|
149 | # define R11 11
|
---|
150 |
|
---|
151 | /* special purpose */
|
---|
152 | # define AP 12 /* argument pointer */
|
---|
153 | # define FP 13 /* frame pointer */
|
---|
154 | # define SP 14 /* stack pointer */
|
---|
155 | # define PC 15 /* program counter */
|
---|
156 |
|
---|
157 | /* floating registers */
|
---|
158 |
|
---|
159 | /* there are no floating point registers on the VAX */
|
---|
160 | /* but there are concatenated regs */
|
---|
161 | /* we call them XR? */
|
---|
162 | #define XR0 16
|
---|
163 | #define XR1 17
|
---|
164 | #define XR2 18
|
---|
165 | #define XR3 19
|
---|
166 | #define XR4 20
|
---|
167 | #define XR5 21
|
---|
168 | #define XR6 22
|
---|
169 | #define XR7 23
|
---|
170 | #define XR8 24
|
---|
171 | #define XR9 25
|
---|
172 | #define XR10 26
|
---|
173 |
|
---|
174 |
|
---|
175 |
|
---|
176 |
|
---|
177 | extern int fregs;
|
---|
178 | extern int maxargs;
|
---|
179 |
|
---|
180 | # define BYTEOFF(x) ((x)&03)
|
---|
181 | # define wdal(k) (BYTEOFF(k)==0)
|
---|
182 | # define BITOOR(x) ((x)>>3) /* bit offset to oreg offset */
|
---|
183 |
|
---|
184 | # define REGSZ 16
|
---|
185 |
|
---|
186 | # define TMPREG FP
|
---|
187 |
|
---|
188 | //# define R2REGS /* permit double indexing */
|
---|
189 |
|
---|
190 | # define STOARG(p) /* just evaluate the arguments, and be done with it... */
|
---|
191 | # define STOFARG(p)
|
---|
192 | # define STOSTARG(p)
|
---|
193 | # define genfcall(a,b) gencall(a,b)
|
---|
194 |
|
---|
195 | # define NESTCALL
|
---|
196 |
|
---|
197 | /*
|
---|
198 | * Register allocator stuff.
|
---|
199 | * The register allocator sees this as 16 general regs (AREGs)
|
---|
200 | * and 11 64-bit concatenated regs. (BREGs)
|
---|
201 | */
|
---|
202 | #define MAXREGS 033 /* 27 registers */
|
---|
203 |
|
---|
204 | #define RSTATUS \
|
---|
205 | SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
|
---|
206 | SAREG|TEMPREG, SAREG|TEMPREG, SAREG|PERMREG, SAREG|PERMREG, \
|
---|
207 | SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
|
---|
208 | 0, 0, 0, 0, /* do not care about ap, fp, sp or pc */ \
|
---|
209 | SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \
|
---|
210 | SBREG, SBREG, SBREG,
|
---|
211 |
|
---|
212 | #define ROVERLAP \
|
---|
213 | { XR0, -1 }, \
|
---|
214 | { XR0, XR1, -1 }, \
|
---|
215 | { XR1, XR2, -1 }, \
|
---|
216 | { XR2, XR3, -1 }, \
|
---|
217 | { XR3, XR4, -1 }, \
|
---|
218 | { XR4, XR5, -1 }, \
|
---|
219 | { XR5, XR6, -1 }, \
|
---|
220 | { XR6, XR7, -1 }, \
|
---|
221 | { XR7, XR8, -1 }, \
|
---|
222 | { XR8, XR9, -1 }, \
|
---|
223 | { XR9, XR10, -1 }, \
|
---|
224 | { XR10, -1 }, \
|
---|
225 | { -1 }, \
|
---|
226 | { -1 }, \
|
---|
227 | { -1 }, \
|
---|
228 | { -1 }, \
|
---|
229 | { R0, R1, XR1, -1 }, \
|
---|
230 | { R1, R2, XR0, XR2, -1 }, \
|
---|
231 | { R2, R3, XR1, XR3, -1 }, \
|
---|
232 | { R3, R4, XR2, XR4, -1 }, \
|
---|
233 | { R4, R5, XR3, XR5, -1 }, \
|
---|
234 | { R5, R6, XR4, XR6, -1 }, \
|
---|
235 | { R6, R7, XR5, XR7, -1 }, \
|
---|
236 | { R7, R8, XR6, XR8, -1 }, \
|
---|
237 | { R8, R9, XR7, XR9, -1 }, \
|
---|
238 | { R9, R10, XR8, XR10, -1 }, \
|
---|
239 | { R10, R11, XR9, -1 },
|
---|
240 |
|
---|
241 | #define NUMCLASS 2 /* highest number of reg classes used */
|
---|
242 |
|
---|
243 | /* size, in registers, needed to hold thing of type t */
|
---|
244 | #define szty(t) (((t) == DOUBLE || (t) == LDOUBLE || (t) == FLOAT || \
|
---|
245 | (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
|
---|
246 | #define FPREG FP /* frame pointer */
|
---|
247 |
|
---|
248 | #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
|
---|
249 | #define ENCRD(x) (x) /* Encode dest reg in n_reg */
|
---|
250 | #define ENCRA1(x) ((x) << 6) /* A1 */
|
---|
251 | #define ENCRA2(x) ((x) << 12) /* A2 */
|
---|
252 | #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
|
---|
253 |
|
---|
254 | #define PCLASS(p) (szty(p->n_type) == 2 ? SBREG : SAREG)
|
---|
255 | #define RETREG(x) (szty(x) == 2 ? XR0 : R0)
|
---|
256 | #define GCLASS(x) (x < XR0 ? CLASSA : CLASSB)
|
---|
257 | int COLORMAP(int c, int *r);
|
---|
258 |
|
---|
259 | #define SNCON (MAXSPECIAL+1) /* named constand */
|
---|