Debian Codegraph @

arch/m68k/macdefs.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2011 Janne Johansson <[email protected]>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /*
18 * Machine-dependent defines for both passes.
19 */
20
21 /*
22 * Convert (multi-)character constant to integer.
23 */
24 #define makecc(val,i) lastcon = i ? (val<<8)|lastcon : val
25
26 #define ARGINIT 64 /* # bits above fp where arguments start */
27 #define AUTOINIT 0 /* # bits below fp where automatics start */
28
29 /*
30 * Storage space requirements
31 */
32 #define SZCHAR 8
33 #define SZBOOL 8
34 #define SZSHORT 16
35 #define SZINT 32
36 #define SZLONG 32
37 #define SZPOINT(t) 32
38 #define SZLONGLONG 64
39 #define SZFLOAT 32
40 #define SZDOUBLE 64
41 #define SZLDOUBLE 128
42
43 /*
44 * Alignment constraints
45 */
46 #define ALCHAR 8
47 #define ALBOOL 8
48 #define ALSHORT 16
49 #define ALINT 32
50 #define ALLONG 32
51 #define ALPOINT 32
52 #define ALLONGLONG 64
53 #define ALFLOAT 32
54 #define ALDOUBLE 64
55 #define ALLDOUBLE 32 /* ???? */
56 /* #undef ALSTRUCT m68k struct alignment is member defined */
57 #define ALSTACK 32
58 #define ALMAX 64
59
60 /*
61 * Min/max values.
62 */
63 #define MIN_CHAR -128
64 #define MAX_CHAR 127
65 #define MAX_UCHAR 255
66 #define MIN_SHORT -32768
67 #define MAX_SHORT 32767
68 #define MAX_USHORT 65535
69 #define MIN_INT (-0x7fffffff-1)
70 #define MAX_INT 0x7fffffff
71 #define MAX_UNSIGNED 0xffffffffU
72 #define MIN_LONG MIN_INT
73 #define MAX_LONG MAX_INT
74 #define MAX_ULONG MAX_UNSIGNED
75 #define MIN_LONGLONG 0x8000000000000000LL
76 #define MAX_LONGLONG 0x7fffffffffffffffLL
77 #define MAX_ULONGLONG 0xffffffffffffffffULL
78
79 /* Default char is signed */
80 #undef CHAR_UNSIGNED
81 #define BOOL_TYPE UCHAR /* what used to store _Bool */
82
83 /*
84 * Use large-enough types.
85 */
86 typedef long long CONSZ;
87 typedef unsigned long long U_CONSZ;
88 typedef long long OFFSZ;
89
90 #define CONFMT "%lld" /* format for printing constants */
91 #define LABFMT ".L%d" /* format for printing labels */
92 #define STABLBL ".LL%d" /* format for stab (debugging) labels */
93 #ifdef LANG_F77
94 #define BLANKCOMMON "_BLNK_"
95 #define MSKIREG (M(TYSHORT)|M(TYLONG))
96 #define TYIREG TYLONG
97 #define FSZLENG FSZLONG
98 #define AUTOREG EBP
99 #define ARGREG EBP
100 #define ARGOFFSET 8
101 #endif
102
103 #define STACK_DOWN /* stack grows negatively for automatics */
104
105 #undef FIELDOPS /* no bit-field instructions */
106 #define TARGET_ENDIAN TARGET_BE /* big-endian */
107
108 #undef FINDMOPS /* XXX FIXME */
109
110 #define CC_DIV_0 /* division by zero is safe in the compiler */
111
112 /* Definitions mostly used in pass2 */
113
114 #define BYTEOFF(x) ((x)&03)
115 #define wdal(k) (BYTEOFF(k)==0)
116
117 #define STOARG(p)
118 #define STOFARG(p)
119 #define STOSTARG(p)
120 #define genfcall(a,b) gencall(a,b)
121
122 /* How many integer registers are needed? (used for stack allocation) */
123 #define szty(t) ((t) == LDOUBLE ? 3 : \
124 (t) == DOUBLE || DEUNSIGN(t) == LONGLONG ? 2 : 1)
125
126 /*
127 * All registers are given a sequential number to
128 * identify it which must match rnames[] in local2.c.
129 *
130 * The classes used on m68k are:
131 * A - 32-bit data registers
132 * B - 32-bit address registers
133 * C - 64-bit combined registers
134 * D - 80-bit floating point registers
135 */
136 #define D0 0
137 #define D1 1
138 #define D2 2
139 #define D3 3
140 #define D4 4
141 #define D5 5
142 #define D6 6
143 #define D7 7
144
145 /* no support yet for using A registers for data calculations */
146 #define A0 8
147 #define A1 9
148 #define A2 10
149 #define A3 11
150 #define A4 12
151 #define A5 13
152 #define A6 14 /* frame pointer? Isnt it A4 on amigaos.. */
153 #define A7 15 /* Stack pointer */
154
155 #define D0D1 16
156 #define D1D2 17
157 #define D2D3 18
158 #define D3D4 19
159 #define D4D5 20
160 #define D5D6 21
161 #define D6D7 22
162
163 #define FP0 23
164 #define FP1 24
165 #define FP2 25
166 #define FP3 26
167 #define FP4 27
168 #define FP5 28
169 #define FP6 29
170 #define FP7 30
171
172 #define MAXREGS 31 /* 31 registers */
173
174 #define RSTATUS \
175 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|PERMREG, SAREG|PERMREG, \
176 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
177 SBREG|TEMPREG, SBREG|TEMPREG, SBREG|PERMREG, SBREG|PERMREG, \
178 SBREG|PERMREG, SBREG|PERMREG, 0, 0, /* fp and sp are ignored here */ \
179 SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \
180 SDREG|TEMPREG, SDREG|TEMPREG, SDREG|PERMREG, SDREG|PERMREG, \
181 SDREG|PERMREG, SDREG|PERMREG, SDREG|PERMREG, SDREG|PERMREG,
182
183
184 /* no overlapping registers at all */
185 #define ROVERLAP \
186 /* 8 data registers */ \
187 { D0D1, -1},\
188 { D1D2, D0D1, -1},\
189 { D2D3, D1D2,-1},\
190 { D3D4, D2D3,-1},\
191 { D4D5, D3D4,-1},\
192 { D5D6, D4D5,-1},\
193 { D6D7, D5D6,-1},\
194 { D6D7, -1},\
195 /* 8 adress registers */ \
196 { -1}, \
197 { -1}, \
198 { -1}, \
199 { -1}, \
200 { -1}, \
201 { -1}, \
202 { -1}, \
203 { -1}, \
204 { D0, D1, D1D2, -1}, \
205 { D1, D2, D0D1, D2D3, -1}, \
206 { D2, D3, D1D2, D3D4, -1}, \
207 { D3, D4, D2D3, D4D5, -1}, \
208 { D4, D5, D3D4, D5D6, -1}, \
209 { D5, D6, D4D5, D6D7, -1}, \
210 { D6, D7, D5D6, -1}, \
211 { -1}, \
212 { -1}, \
213 { -1}, \
214 { -1}, \
215 { -1}, \
216 { -1}, \
217 { -1}, \
218 { -1},
219
220
221 /* Return a register class based on the type of the node */
222 #define PCLASS(p) (p->n_type == FLOAT || p->n_type == DOUBLE || \
223 p->n_type == LDOUBLE ? SDREG : p->n_type == LONGLONG || \
224 p->n_type == ULONGLONG ? SCREG : p->n_type > BTMASK ? SBREG : SAREG)
225
226 #define NUMCLASS 4 /* highest number of reg classes used */
227
228 int COLORMAP(int c, int *r);
229 #define GCLASS(x) (x < 8 ? CLASSA : x < 16 ? CLASSB : x < 23 ? CLASSC : CLASSD)
230 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
231 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
232 #define ENCRA1(x) ((x) << 12) /* A1 */
233 #define ENCRA2(x) ((x) << 18) /* A2 */
234 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
235
236 #define RETREG(x) ((x) == FLOAT || (x) == DOUBLE || (x) == LDOUBLE ? FP0 : \
237 (x) == LONGLONG || (x) == ULONGLONG ? D0D1 : (x) > BTMASK ? A0 : D0)
238
239 #define FPREG A6 /* frame pointer */
240 #define STKREG A7 /* stack pointer */
241
242 #define HAVE_WEAKREF
243 #define TARGET_FLT_EVAL_METHOD 2 /* all as long double */
244
245 /*
246 * Extended assembler macros.
247 */
248 int targarg(char *w, void *arg);
249 #define XASM_TARGARG(w, ary) (w[1] == 'b' ? w++, 0 : targarg(w, ary))
250
251 /* floating point definitions */
252 #define USE_IEEEFP_32
253 #define FLT_PREFIX IEEEFP_32
254 #define USE_IEEEFP_64
255 #define DBL_PREFIX IEEEFP_64
256 #define LDBL_PREFIX IEEEFP_64
257