Debian Codegraph @

arch/pdp11/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.18 2021/10/08 15:59:07 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 * 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
16 *
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.
27 */
28
29 /*
30 * Machine-dependent defines for both passes.
31 */
32
33 /*
34 * Convert (multi-)character constant to integer.
35 */
36 #define makecc(val,i) lastcon = i ? (val<<8)|lastcon : val
37
38 #define ARGINIT 32 /* # bits above r5 where arguments start */
39 #define AUTOINIT 64 /* # bits below r5 where automatics start */
40
41 /*
42 * Storage space requirements
43 */
44 #define SZCHAR 8
45 #define SZBOOL 8
46 #define SZINT 16
47 #define SZFLOAT 32
48 #define SZDOUBLE 64
49 #define SZLDOUBLE 64
50 #define SZLONG 32
51 #define SZSHORT 16
52 #define SZLONGLONG 64
53 #define SZPOINT(t) 16
54
55 /*
56 * Alignment constraints
57 */
58 #define ALCHAR 8
59 #define ALBOOL 8
60 #define ALINT 16
61 #define ALFLOAT 16
62 #define ALDOUBLE 16
63 #define ALLDOUBLE 16
64 #define ALLONG 16
65 #define ALLONGLONG 16
66 #define ALSHORT 16
67 #define ALPOINT 16
68 #define ALSTRUCT 16
69 #define ALSTACK 16
70
71 /*
72 * Min/max values.
73 */
74 #define MIN_CHAR -128
75 #define MAX_CHAR 127
76 #define MAX_UCHAR 255
77 #define MIN_SHORT -32768
78 #define MAX_SHORT 32767
79 #define MAX_USHORT 65535
80 #define MIN_INT (-0x7fff-1)
81 #define MAX_INT 0x7fff
82 #define MAX_UNSIGNED 0xffff
83 #define MIN_LONG (-0x7fffffff-1)
84 #define MAX_LONG 0x7fffffff
85 #define MAX_ULONG 0xffffffff
86 #define MIN_LONGLONG 0x8000000000000000LL
87 #define MAX_LONGLONG 0x7fffffffffffffffLL
88 #define MAX_ULONGLONG 0xffffffffffffffffULL
89
90 /* Default char is signed */
91 #undef CHAR_UNSIGNED
92 #define BOOL_TYPE CHAR /* what used to store _Bool */
93
94 /*
95 * Use large-enough types.
96 */
97 typedef long long CONSZ;
98 typedef unsigned long long U_CONSZ;
99 typedef long long OFFSZ;
100
101 #define CONFMT "%llo" /* format for printing constants */
102 #define LABFMT "L%d" /* format for printing labels */
103 #ifdef LANG_F77
104 #define BLANKCOMMON "_BLNK_"
105 #define MSKIREG (M(TYSHORT)|M(TYLONG))
106 #define TYIREG TYLONG
107 #define FSZLENG FSZLONG
108 #define AUTOREG EBP
109 #define ARGREG EBP
110 #define ARGOFFSET 8
111 #endif
112
113 #define STACK_DOWN /* stack grows negatively for automatics */
114
115 #undef FIELDOPS /* no bit-field instructions */
116 #define TARGET_ENDIAN TARGET_LE /* XXX TARGET_PDP */
117 #define MYINSTRING
118 #define MYALIGN
119
120 /* Definitions mostly used in pass2 */
121
122 #define BYTEOFF(x) ((x)&01)
123 #define wdal(k) (BYTEOFF(k)==0)
124
125 #define STOARG(p)
126 #define STOFARG(p)
127 #define STOSTARG(p)
128
129 #define FINDMOPS /* pdp11 has instructions that modifies memory */
130 #define MYDOTFILE
131 #define printdotfile(x)
132
133 #define szty(t) ((t) == DOUBLE || (t) == LONGLONG || (t) == ULONGLONG ? 4 : \
134 (t) == FLOAT || (t) == LONG || (t) == ULONG ? 2 : 1)
135
136 /*
137 * The pdp11 has 4 register classes, 16-bit, 32-bit, floats and 64-bit.
138 * Class membership and overlaps are defined in the macros RSTATUS
139 * and ROVERLAP below.
140 *
141 * The classes used on pdp11 are:
142 * A - 16-bit
143 * B - 32-bit (concatenated 16-bit)
144 * C - floating point
145 * D - 64-bit (on stack, emulated)
146 */
147 #define R0 000 /* Scratch and return register */
148 #define R1 001 /* Scratch and secondary return register */
149 #define R2 002 /* Scratch register */
150 #define R3 003 /* Scratch register */
151 #define R4 004 /* Scratch register */
152 #define R5 005 /* Frame pointer */
153 #define SP 006 /* Stack pointer */
154 #define PC 007 /* Program counter */
155
156 #define R01 010
157 #define R12 011
158 #define R23 012
159 #define R34 013
160
161 #define FR0 020
162 #define FR1 021
163 #define FR2 022
164 #define FR3 023
165 #define FR4 024
166 #define FR5 025
167 #define FR6 026
168 #define FR7 027
169
170 #define LL0 030
171 #define LL1 031
172 #define LL2 032
173 #define LL3 033
174
175 #define MAXREGS 034 /* 28 registers */
176
177 #define RSTATUS \
178 SAREG|TEMPREG, SAREG|TEMPREG, SAREG, SAREG, SAREG, 0, 0, 0, \
179 SBREG, SBREG, SBREG, SBREG, 0, 0, 0, 0, \
180 SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, SCREG|TEMPREG, 0, 0, 0, 0, \
181 SDREG, SDREG, SDREG, SDREG,
182
183 #define ROVERLAP \
184 /* 8 basic registers */\
185 { R01, -1 }, \
186 { R01, R12, -1 }, \
187 { R12, R23, -1 }, \
188 { R23, R34, -1 }, \
189 { R34, -1 }, \
190 { -1 }, \
191 { -1 }, \
192 { -1 }, \
193 \
194 /* 4 long registers */\
195 { R0, R1, R12, -1 }, \
196 { R1, R2, R01, R23, -1 }, \
197 { R2, R3, R12, R34, -1 }, \
198 { R3, R4, R23, -1 }, \
199 { -1 }, \
200 { -1 }, \
201 { -1 }, \
202 { -1 }, \
203 \
204 /* The fp registers do not overlap with anything */\
205 { -1 },\
206 { -1 },\
207 { -1 },\
208 { -1 },\
209 { -1 },\
210 { -1 },\
211 { -1 },\
212 { -1 },\
213 \
214 /* Neither the four emulated long long regs */\
215 { -1 },\
216 { -1 },\
217 { -1 },\
218 { -1 }
219
220
221 /* Return a register class based on the type of the node */
222
223 #define PCLASS(p) (p->n_type < LONG || p->n_type > BTMASK ? SAREG : \
224 (p->n_type == LONG || p->n_type == ULONG ? SBREG : SCREG))
225
226 #define NUMCLASS 3 /* 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 < 24 ? CLASSC : CLASSD)
230 #define DECRA(x,y) (((x) >> (y*5)) & 31) /* decode encoded regs */
231 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
232 #define ENCRA1(x) ((x) << 5) /* A1 */
233 #define ENCRA2(x) ((x) << 10) /* A2 */
234 #define ENCRA(x,y) ((x) << (5+y*5)) /* encode regs in int */
235 #define RETREG(x) ((x) == LONG || (x) == ULONG ? R01 : \
236 (x) == FLOAT || (x) == DOUBLE ? FR0 : \
237 (x) == LONGLONG || (x) == ULONGLONG ? LL0: R0)
238
239 //#define R2REGS 1 /* permit double indexing */
240
241 /* XXX - to die */
242 #define FPREG R5 /* frame pointer */
243 #define STKREG SP /* stack pointer */
244
245 /* A bunch of specials to make life easier for pdp11 */
246 #define SANDSCON (MAXSPECIAL+1)
247 #define SINCB (MAXSPECIAL+2) /* post-increment */
248 #define SINCW (MAXSPECIAL+3) /* post-increment */
249 #define SARGSUB (MAXSPECIAL+4) /* arg pointer to array */
250 #define SARGINC (MAXSPECIAL+5) /* post-increment arg */
251
252 /* floating point definitions */
253 #define FDFLOAT
254 #define DEFAULT_FPI_DEFS { &fpi_ffloat, &fpi_dfloat, &fpi_dfloat }