Debian Codegraph @

arch/pdp10/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.38 2022/03/30 14:11:59 ragge Exp $ */
2 /*
3 * Copyright (c) 2003 Anders Magnusson ([email protected]).
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 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 /*
28 * Machine-dependent defines for both passes.
29 */
30
31 /*
32 * Convert (multi-)character constant to integer.
33 * Assume: If only one value; store at left side (char size), otherwise
34 * treat it as an integer.
35 */
36 #define makecc(val,i) { \
37 if (i == 0) { lastcon = val; \
38 } else if (i == 1) { lastcon = (lastcon << 9) | val; lastcon <<= 18; \
39 } else { lastcon |= (val << (27 - (i * 9))); } }
40
41 #define ARGINIT 36 /* # bits below fp where arguments start */
42 #define AUTOINIT 36 /* # bits above fp where automatics start */
43
44 /*
45 * Storage space requirements
46 */
47 #define SZCHAR 9
48 #define SZBOOL 36
49 #define SZINT 36
50 #define SZFLOAT 36
51 #define SZDOUBLE 72
52 #define SZLDOUBLE 72
53 #define SZLONG 36
54 #define SZSHORT 18
55 #define SZPOINT(x) 36
56 #define SZLONGLONG 72
57
58 /*
59 * Alignment constraints
60 */
61 #define ALCHAR 9
62 #define ALBOOL 36
63 #define ALINT 36
64 #define ALFLOAT 36
65 #define ALDOUBLE 36
66 #define ALLDOUBLE 36
67 #define ALLONG 36
68 #define ALLONGLONG 36
69 #define ALSHORT 18
70 #define ALPOINT 36
71 #define ALSTRUCT 36
72 #define ALSTACK 36
73
74 /*
75 * Max values.
76 */
77 #define MIN_CHAR -256
78 #define MAX_CHAR 255
79 #define MAX_UCHAR 511
80 #define MIN_SHORT -131072
81 #define MAX_SHORT 131071
82 #define MAX_USHORT 262143
83 #define MIN_INT (-0377777777777LL-1)
84 #define MAX_INT 0377777777777LL
85 #define MAX_UNSIGNED 0777777777777ULL
86 #define MIN_LONG (-0377777777777LL-1)
87 #define MAX_LONG 0377777777777LL
88 #define MAX_ULONG 0777777777777ULL
89 #define MIN_LONGLONG (000777777777777777777777LL-1) /* XXX cross */
90 #define MAX_LONGLONG 000777777777777777777777LL /* XXX cross */
91 #define MAX_ULONGLONG 001777777777777777777777ULL /* XXX cross */
92
93 /* Default char is unsigned */
94 #define TARGET_STDARGS
95 #define CHAR_UNSIGNED
96 #define BOOL_TYPE INT
97 #define WORD_ADDRESSED
98
99 /*
100 * Use large-enough types.
101 */
102 typedef long long CONSZ;
103 typedef unsigned long long U_CONSZ;
104 typedef long long OFFSZ;
105
106 #define CONFMT "0%llo" /* format for printing constants */
107 #define LABFMT ".L%d" /* format for printing labels */
108 #define STABLBL ".LL%d" /* format for stab (debugging) labels */
109
110 #undef STACK_DOWN /* stack grows negatively for automatics */
111
112 #undef FIELDOPS /* no bit-field instructions */
113 #define TARGET_ENDIAN TARGET_BE
114
115 /* Definitions mostly used in pass2 */
116
117 #define BYTEOFF(x) ((x)&03)
118 #define wdal(k) (BYTEOFF(k)==0)
119
120 #define STOARG(p)
121 #define STOFARG(p)
122 #define STOSTARG(p)
123 #define genfcall(a,b) gencall(a,b)
124
125 #define szty(t) (((t) == DOUBLE || (t) == FLOAT || \
126 (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
127
128 #define shltype(o, p) \
129 ((o) == REG || (o) == NAME || (o) == ICON || \
130 (o) == OREG || ((o) == UMUL && shumul((p)->n_left, SOREG)))
131
132 #undef SPECIAL_INTEGERS
133
134 /*
135 * Special shapes used in code generation.
136 */
137 #define SUSHCON (SPECIAL|6) /* unsigned short constant */
138 #define SNSHCON (SPECIAL|7) /* negative short constant */
139 #define SILDB (SPECIAL|8) /* use ildb here */
140
141 /*
142 * Register allocator definitions.
143 *
144 * The pdp10 has 16 general-purpose registers, but the two
145 * highest are used as sp and fp. Register 0 has special
146 * constraints in its possible use as index register.
147 * All regs can be used as pairs, named by the lowest number.
148 * In here we call the registers Rn and the pairs XRn, in assembler
149 * just its number prefixed with %.
150 *
151 * R1/XR1 are return registers.
152 *
153 * R0 is currently not used.
154 */
155
156 #define MAXREGS 29 /* 16 + 13 regs */
157 #define NUMCLASS 2
158
159 #define R0 00
160 #define R1 01
161 #define R2 02
162 #define R3 03
163 #define R4 04
164 #define R5 05
165 #define R6 06
166 #define R7 07
167 #define R10 010
168 #define R11 011
169 #define R12 012
170 #define R13 013
171 #define R14 014
172 #define R15 015
173 #define R16 016
174 #define R17 017
175 #define FPREG R16 /* frame pointer */
176 #define STKREG R17 /* stack pointer */
177
178
179 #define XR0 020
180 #define XR1 021
181 #define XR2 022
182 #define XR3 023
183 #define XR4 024
184 #define XR5 025
185 #define XR6 026
186 #define XR7 027
187 #define XR10 030
188 #define XR11 031
189 #define XR12 032
190 #define XR13 033
191 #define XR14 034
192
193
194 #define RSTATUS \
195 0, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
196 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
197 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
198 SAREG|PERMREG, SAREG|PERMREG, 0, 0, \
199 SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \
200 SBREG, SBREG, SBREG, SBREG, SBREG,
201
202 #define ROVERLAP \
203 { XR0, -1 }, \
204 { XR0, XR1, -1 }, \
205 { XR1, XR2, -1 }, \
206 { XR2, XR3, -1 }, \
207 { XR3, XR4, -1 }, \
208 { XR4, XR5, -1 }, \
209 { XR5, XR6, -1 }, \
210 { XR6, XR7, -1 }, \
211 { XR7, XR10, -1 }, \
212 { XR10, XR11, -1 }, \
213 { XR11, XR12, -1 }, \
214 { XR12, XR13, -1 }, \
215 { XR13, XR14, -1 }, \
216 { XR14, -1 }, \
217 { -1 }, \
218 { -1 }, \
219 { R0, R1, XR1, -1 }, \
220 { R1, R2, XR0, XR2, -1 }, \
221 { R2, R3, XR1, XR3, -1 }, \
222 { R3, R4, XR2, XR4, -1 }, \
223 { R4, R5, XR3, XR5, -1 }, \
224 { R5, R6, XR4, XR6, -1 }, \
225 { R6, R7, XR5, XR7, -1 }, \
226 { R7, R10, XR6, XR10, -1 }, \
227 { R10, R11, XR7, XR11, -1 }, \
228 { R11, R12, XR10, XR12, -1 }, \
229 { R12, R13, XR11, XR13, -1 }, \
230 { R13, R14, XR12, XR14, -1 }, \
231 { R14, R15, XR13, -1 },
232
233 /* Return a register class based on the type of the node */
234 #define PCLASS(p) (szty(p->n_type) == 2 ? SBREG : SAREG)
235 #define RETREG(x) (szty(x) == 2 ? XR1 : R1)
236 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
237 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
238 #define ENCRA1(x) ((x) << 6) /* A1 */
239 #define ENCRA2(x) ((x) << 12) /* A2 */
240 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
241 #define GCLASS(x) (x < 16 ? CLASSA : CLASSB)
242 int COLORMAP(int c, int *r);
243
244 /* floating point definitions */
245 /* XXX needs fixing for pdp10 */
246 #define FDFLOAT
247 #define DEFAULT_FPI_DEFS { &fpi_ffloat, &fpi_dfloat, &fpi_dfloat }
248