Debian Codegraph @

arch/arm/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.23 2021/10/08 15:59:06 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 = (lastcon<<8)|((val<<24)>>24);
37
38 /*
39 * Storage space requirements
40 */
41 #define SZCHAR 8
42 #define SZBOOL 32
43 #define SZINT 32
44 #define SZFLOAT 32
45 #define SZDOUBLE 64
46 #define SZLDOUBLE 64
47 #define SZLONG 32
48 #define SZSHORT 16
49 #define SZLONGLONG 64
50 #define SZPOINT(t) 32
51
52 /*
53 * Alignment constraints
54 */
55 #define ALCHAR 8
56 #define ALBOOL 32
57 #define ALINT 32
58 #define ALFLOAT 32
59 #define ALDOUBLE 32
60 #define ALLDOUBLE 32
61 #define ALLONG 32
62 #define ALLONGLONG 32
63 #define ALSHORT 16
64 #define ALPOINT 32
65 #define ALSTRUCT 32
66 #define ALSTACK 32
67
68 /*
69 * Min/max values.
70 */
71 #define MIN_CHAR -128
72 #define MAX_CHAR 127
73 #define MAX_UCHAR 255
74 #define MIN_SHORT -32768
75 #define MAX_SHORT 32767
76 #define MAX_USHORT 65535
77 #define MIN_INT -1
78 #define MAX_INT 0x7fffffff
79 #define MAX_UNSIGNED 0xffffffff
80 #define MIN_LONG MIN_INT
81 #define MAX_LONG MAX_INT
82 #define MAX_ULONG MAX_UNSIGNED
83 #define MIN_LONGLONG 0x8000000000000000LL
84 #define MAX_LONGLONG 0x7fffffffffffffffLL
85 #define MAX_ULONGLONG 0xffffffffffffffffULL
86
87 #define BOOL_TYPE INT /* what used to store _Bool */
88
89 /*
90 * Use large-enough types.
91 */
92 typedef long long CONSZ;
93 typedef unsigned long long U_CONSZ;
94 typedef long long OFFSZ;
95
96 #define CONFMT "%lld" /* format for printing constants */
97 #define LABFMT ".L%d" /* format for printing labels */
98 #define STABLBL "LL%d" /* format for stab (debugging) labels */
99 #define STAB_LINE_ABSOLUTE /* S_LINE fields use absolute addresses */
100
101 /* Definitions mostly used in pass2 */
102
103 #define BYTEOFF(x) ((x)&03)
104 #define wdal(k) (BYTEOFF(k)==0)
105
106 #define STOARG(p)
107 #define STOFARG(p)
108 #define STOSTARG(p)
109
110 #define szty(t) (((t) == DOUBLE || (t) == LDOUBLE || \
111 (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
112
113 #define R0 0
114 #define R1 1
115 #define R2 2
116 #define R3 3
117 #define R4 4
118 #define R5 5
119 #define R6 6
120 #define R7 7
121 #define R8 8
122 #define R9 9
123 #define R10 10
124 #define R11 11
125 #define R12 12
126 #define R13 13
127 #define R14 14
128 #define R15 15
129
130 #define SL R10
131 #define FP R11
132 #define IP R12
133 #define SP R13
134 #define LR R14
135 #define PC R15
136
137 #define R0R1 16
138 #define R1R2 17
139 #define R2R3 18
140 #define R3R4 19
141 #define R4R5 20
142 #define R5R6 21
143 #define R6R7 22
144 #define R7R8 23
145 #define R8R9 24
146 #define R9R10 25
147
148 #define F0 26
149 #define F1 27
150 #define F2 28
151 #define F3 29
152 #define F4 30
153 #define F5 31
154 #define F6 32
155 #define F7 33
156
157 #define NUMCLASS 3
158 #define MAXREGS 34
159
160 #define RSTATUS \
161 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
162 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
163 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
164 0, 0, 0, 0, 0, \
165 SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG, \
166 SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \
167 SCREG, SCREG, SCREG, SCREG, \
168 SCREG, SCREG, SCREG, SCREG, \
169
170 #define ROVERLAP \
171 { R0R1, -1 }, \
172 { R0R1, R1R2, -1 }, \
173 { R1R2, R2R3, -1 }, \
174 { R2R3, R3R4, -1 }, \
175 { R3R4, R4R5, -1 }, \
176 { R4R5, R5R6, -1 }, \
177 { R5R6, R6R7, -1 }, \
178 { R6R7, R7R8, -1 }, \
179 { R7R8, R8R9, -1 }, \
180 { R8R9, R9R10, -1 }, \
181 { R9R10, -1 }, \
182 { -1 }, \
183 { -1 }, \
184 { -1 }, \
185 { -1 }, \
186 { -1 }, \
187 { R0, R1, R1R2, -1 }, \
188 { R1, R2, R0R1, R2R3, -1 }, \
189 { R2, R3, R1R2, R3R4, -1 }, \
190 { R3, R4, R2R3, R4R5, -1 }, \
191 { R4, R5, R3R4, R5R6, -1 }, \
192 { R5, R6, R4R5, R6R7, -1 }, \
193 { R6, R7, R5R6, R7R8, -1 }, \
194 { R7, R8, R6R7, R8R9, -1 }, \
195 { R8, R9, R7R8, R9R10, -1 }, \
196 { R9, R10, R8R9, -1 }, \
197 { -1, }, \
198 { -1, }, \
199 { -1, }, \
200 { -1, }, \
201 { -1, }, \
202 { -1, }, \
203 { -1, }, \
204 { -1, }, \
205
206 #define STACK_DOWN /* stack grows negatively for temporaries */
207
208 #define ARGINIT (4*8) /* # bits above fp where arguments start */
209 #define AUTOINIT (12*8) /* # bits above fp where automatics start */
210
211 #undef FIELDOPS /* no bit-field instructions */
212 #define TARGET_ENDIAN TARGET_LE
213
214 /* XXX - to die */
215 #define FPREG FP /* frame pointer */
216
217 /* Return a register class based on the type of the node */
218 #define PCLASS(p) (1 << gclass((p)->n_type))
219
220 #define GCLASS(x) (x < 16 ? CLASSA : x < 26 ? CLASSB : CLASSC)
221 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
222 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
223 #define ENCRA1(x) ((x) << 6) /* A1 */
224 #define ENCRA2(x) ((x) << 12) /* A2 */
225 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
226 #define RETREG(x) retreg(x)
227
228 int COLORMAP(int c, int *r);
229 int retreg(int ty);
230 int features(int f);
231
232 #define FEATURE_BIGENDIAN 0x00010000
233 #define FEATURE_HALFWORDS 0x00020000 /* ldrsh/ldrh, ldrsb */
234 #define FEATURE_EXTEND 0x00040000 /* sxth, sxtb, uxth, uxtb */
235 #define FEATURE_MUL 0x00080000
236 #define FEATURE_MULL 0x00100000
237 #define FEATURE_DIV 0x00200000
238 #define FEATURE_FPA 0x10000000
239 #define FEATURE_VFP 0x20000000
240 #define FEATURE_HARDFLOAT (FEATURE_FPA|FEATURE_VFP)
241
242 #if 0
243 #define TARGET_STDARGS
244 #define TARGET_BUILTINS \
245 { "__builtin_stdarg_start", arm_builtin_stdarg_start }, \
246 { "__builtin_va_arg", arm_builtin_va_arg }, \
247 { "__builtin_va_end", arm_builtin_va_end }, \
248 { "__builtin_va_copy", arm_builtin_va_copy },
249 #endif
250
251 #undef NODE
252 #ifdef LANG_CXX
253 #define NODE struct node
254 #else
255 #define NODE struct p1node
256 #endif
257 struct node;
258 struct bitable;
259 NODE *arm_builtin_stdarg_start(const struct bitable *bt, NODE *a);
260 NODE *arm_builtin_va_arg(const struct bitable *bt, NODE *a);
261 NODE *arm_builtin_va_end(const struct bitable *bt, NODE *a);
262 NODE *arm_builtin_va_copy(const struct bitable *bt, NODE *a);
263 #undef NODE
264
265 #define COM "\t@ "
266 #define NARGREGS 4
267
268 /* floating point definitions */
269 #define USE_IEEEFP_32
270 #define FLT_PREFIX IEEEFP_32
271 #define USE_IEEEFP_64
272 #define DBL_PREFIX IEEEFP_64
273 #define LDBL_PREFIX IEEEFP_64
274 #define DEFAULT_FPI_DEFS { &fpi_binary32, &fpi_binary64, &fpi_binary64 }