1
/* $Id: macdefs.h,v 1.5 2009/01/24 21:43:49 gmcgarry Exp $ */
3
* Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
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
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.
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.
36
# define makecc(val,i) lastcon = (lastcon<<8)|((val<<24)>>24);
45
# define SZLDOUBLE 64 /* XXX use longer? */
47
# define SZLONGLONG 64
49
# define SZPOINT(t) 32
57
# define ALLONGLONG 32
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
82
/* Default char is signed */
84
#define BOOL_TYPE CHAR /* what used to store _Bool */
86
/* size in which constants are converted */
87
/* should be long if feasable */
89
typedef long long CONSZ;
90
typedef unsigned long long U_CONSZ;
92
# define CONFMT "%lld"
93
# define LABFMT ".L%d"
94
# define STABLBL ".LL%d"
96
/* size in which offsets are kept
97
* should be large enough to cover address space in bits
99
typedef long long OFFSZ;
101
/* character set macro */
103
# define CCTRANS(x) x
105
/* register cookie for stack poINTer */
110
/* maximum and minimum register variables */
115
/* show stack grows negatively */
119
/* show field hardware support on VAX */
122
/* bytes are numbered from right to left */
125
/* we want prtree included */
131
# define ENUMSIZE(high,low) INT
133
/* VAX-11/780 Registers */
135
/* scratch registers */
143
/* register variables */
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 */
157
/* floating registers */
159
/* there are no floating point registers on the VAX */
160
/* but there are concatenated regs */
161
/* we call them XR? */
180
# define BYTEOFF(x) ((x)&03)
181
# define wdal(k) (BYTEOFF(k)==0)
182
# define BITOOR(x) ((x)>>3) /* bit offset to oreg offset */
188
//# define R2REGS /* permit double indexing */
190
# define STOARG(p) /* just evaluate the arguments, and be done with it... */
193
# define genfcall(a,b) gencall(a,b)
198
* Register allocator stuff.
199
* The register allocator sees this as 16 general regs (AREGs)
200
* and 11 64-bit concatenated regs. (BREGs)
202
#define MAXREGS 033 /* 27 registers */
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, \
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 },
241
#define NUMCLASS 2 /* highest number of reg classes used */
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 */
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 */
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);
259
#define SNCON (MAXSPECIAL+1) /* named constand */