1
/* $Id: macdefs.h,v 1.2 2007/11/16 22:27:42 gmcgarry Exp $ */
3
* Copyright (c) 2006 Anders Magnusson (ragge@ludd.luth.se).
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
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
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.
30
* Machine-dependent defines for Data General Nova.
34
* Convert (multi-)character constant to integer.
36
#define makecc(val,i) lastcon = (lastcon<<8)|(val);
38
#define ARGINIT 16 /* adjusted in MD code */
39
#define AUTOINIT 16 /* adjusted in MD code */
42
* Storage space requirements
52
#define SZPOINT(t) 16 /* Actually 15 */
55
* Alignment constraints
75
#define MIN_SHORT -32768
76
#define MAX_SHORT 32767
77
#define MAX_USHORT 65535
78
#define MIN_INT MIN_SHORT
79
#define MAX_INT MAX_SHORT
80
#define MAX_UNSIGNED MAX_USHORT
81
#define MIN_LONG 0x80000000L
82
#define MAX_LONG 0x7fffffffL
83
#define MAX_ULONG 0xffffffffUL
84
#define MIN_LONGLONG MIN_LONG
85
#define MAX_LONGLONG MAX_LONG
86
#define MAX_ULONGLONG MAX_ULONG
88
/* Default char is unsigned */
92
* Use large-enough types.
95
typedef unsigned long U_CONSZ;
98
#define CONFMT "%ld" /* format for printing constants */
99
#define LABFMT ".L%d" /* format for printing labels */
100
#define STABLBL ".LL%d" /* format for stab (debugging) labels */
103
#define FLABELFMT "%s:\n"
104
#define USETEXT ".text"
105
#define USECONST ".data\t0" /* XXX - fix */
106
#define USEBSS ".data\t1" /* XXX - fix */
107
#define USEINIT ".data\t2" /* XXX - fix */
108
#define MAXREGVAR 3 /* XXX - fix */
109
#define BLANKCOMMON "_BLNK_"
110
#define MSKIREG (M(TYSHORT)|M(TYLONG))
111
#define TYIREG TYLONG
112
#define FSZLENG FSZLONG
113
#define FUDGEOFFSET 1
119
#define BACKAUTO /* stack grows negatively for automatics */
120
#define BACKTEMP /* stack grows negatively for temporaries */
122
#undef FIELDOPS /* no bit-field instructions */
123
#define RTOLBYTES /* bytes are numbered right to left */
125
#define ENUMSIZE(high,low) INT /* enums are always stored in full int */
127
/* Definitions mostly used in pass2 */
129
#define BYTEOFF(x) ((x)&01)
130
#define wdal(k) (BYTEOFF(k)==0)
131
#define BITOOR(x) (x) /* bit offset to oreg offset XXX die! */
136
#define genfcall(a,b) gencall(a,b)
138
#define szty(t) (((t) == DOUBLE || (t) == LDOUBLE) ? 4 : \
139
((t) == LONGLONG || (t) == ULONGLONG || \
140
(t) == LONG || (t) == ULONG) ? 2 : 1)
143
* The Nova has three register classes. Note that the space used in
144
* zero page is considered registers.
145
* Register 28 and 29 are FP and SP.
147
* The classes used on Nova are:
148
* A - AC0-AC3 (as non-index registers) : reg 0-3
149
* B - AC2-AC3 (as index registers) : reg 2-3
150
* C - address 50-77 in memory : reg 4-27
152
#define MAXREGS 30 /* 0-29 */
155
SAREG|TEMPREG, SAREG|TEMPREG, SAREG|SBREG|TEMPREG, SAREG|SBREG|TEMPREG,\
156
SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, \
157
SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, \
158
SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \
159
SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \
160
SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \
161
SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, SCREG|PERMREG, \
165
{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
166
{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
167
{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
168
{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 },
171
/* Return a register class based on the type of the node */
172
/* all types in all classes */
173
#define PCLASS(p) (SAREG|SBREG|SCREG)
175
#define NUMCLASS 4 /* highest number of reg classes used */
176
/* XXX - must be 4 */
178
int COLORMAP(int c, int *r);
179
#define GCLASS(x) (x < 4 ? CLASSA : CLASSC)
180
#define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
181
#define ENCRD(x) (x) /* Encode dest reg in n_reg */
182
#define ENCRA1(x) ((x) << 6) /* A1 */
183
#define ENCRA2(x) ((x) << 12) /* A2 */
184
#define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
185
#define RETREG(x) (0) /* ? Sanity */
188
#define FPREG 28 /* frame pointer */
189
#define STKREG 29 /* stack pointer */