Debian Codegraph @

arch/aarch64/macdefs.h

raw symbols SCIP
1 /* $Id: macdefs.h,v 1.2 2021/09/04 10:38:37 gmcgarry Exp $ */
2 /*
3 * Copyright (c) 2020 Puresoftware Ltd.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 /*
19 * Machine-dependent defines for both passes.
20 */
21
22 /*
23 * Convert (multi-)character constant to integer.
24 */
25 #define makecc(val,i) lastcon = (lastcon<<8)|((val<<24)>>24);
26
27 /*
28 * Storage space requirements
29 */
30 #define SZCHAR 8
31 #define SZBOOL 32
32 #define SZINT 32
33 #define SZFLOAT 32
34 #define SZDOUBLE 64
35 #define SZLDOUBLE 64
36 #define SZLONG 64
37 #define SZSHORT 16
38 #define SZLONGLONG 64
39 #define SZPOINT(t) 64
40
41 /*
42 * Alignment constraints
43 */
44 #define ALCHAR 8
45 #define ALBOOL 32
46 #define ALINT 32
47 #define ALFLOAT 32
48 #define ALDOUBLE 32
49 #define ALLDOUBLE 32
50 #define ALLONG 32
51 #define ALLONGLONG 32
52 #define ALSHORT 16
53 #define ALPOINT 32
54 #define ALSTRUCT 32
55 #define ALSTACK 32
56
57 /*
58 * Min/max values.
59 */
60 #define MIN_CHAR -128
61 #define MAX_CHAR 127
62 #define MAX_UCHAR 255
63 #define MIN_SHORT -32768
64 #define MAX_SHORT 32767
65 #define MAX_USHORT 65535
66 #define MIN_INT -1
67 #define MAX_INT 0x7fffffff
68 #define MAX_UNSIGNED 0xffffffff
69 #define MIN_LONG 0x8000000000000000L
70 #define MAX_LONG 0x7fffffffffffffffL
71 #define MAX_ULONG 0xffffffffffffffffUL
72 #define MIN_LONGLONG 0x8000000000000000LL
73 #define MAX_LONGLONG 0x7fffffffffffffffLL
74 #define MAX_ULONGLONG 0xffffffffffffffffULL
75
76 #define BOOL_TYPE INT /* what used to store _Bool */
77
78 /*
79 * Use large-enough types.
80 */
81 typedef long long CONSZ;
82 typedef unsigned long long U_CONSZ;
83 typedef long long OFFSZ;
84
85 #define CONFMT "%lld" /* format for printing constants */
86 #define LABFMT ".L%d" /* format for printing labels */
87 #define STABLBL "LL%d" /* format for stab (debugging) labels */
88 #define STAB_LINE_ABSOLUTE /* S_LINE fields use absolute addresses */
89
90 /* Definitions mostly used in pass2 */
91
92 #define BYTEOFF(x) ((x)&03)
93 #define wdal(k) (BYTEOFF(k)==0)
94
95 #define STOARG(p)
96 #define STOFARG(p)
97 #define STOSTARG(p)
98
99 #define szty(t) (((t) == DOUBLE || (t) == LDOUBLE || \
100 (t) == LONG || (t) == ULONG || (t) == LONGLONG || (t) == ULONGLONG) ? 2 : 1)
101
102 #define R0 0
103 #define R1 1
104 #define R2 2
105 #define R3 3
106 #define R4 4
107 #define R5 5
108 #define R6 6
109 #define R7 7
110 #define R8 8
111 #define R9 9
112 #define R10 10
113 #define R11 11
114 #define R12 12
115 #define R13 13
116 #define R14 14
117 #define R15 15
118 #define R16 16
119 #define R17 17
120 #define R18 18
121 #define R19 19
122 #define R20 20
123 #define R21 21
124 #define R22 22
125 #define R23 23
126 #define R24 24
127 #define R25 25
128 #define R26 26
129 #define R27 27
130 #define R28 28
131 #define R29 29
132 #define R30 30
133 #define R31 31 //SP register
134
135 #define FP R29
136 #define IP R16
137 #define SP R31
138 #define LR R30
139
140 #define NUMCLASS 3
141 #define MAXREGS 34
142
143 #define RSTATUS \
144 SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \
145 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
146 SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \
147 0, 0, 0, 0, 0, \
148 SBREG|TEMPREG, SBREG|TEMPREG, SBREG|TEMPREG, SBREG, \
149 SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \
150 SCREG, SCREG, SCREG, SCREG, \
151 SCREG, SCREG, SCREG, SCREG, \
152
153 /* no overlapping registers at all */
154 #define ROVERLAP \
155 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
156 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
157 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
158 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, \
159 { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 },
160
161 #define ARGINIT (16*8) /* # bits above fp where arguments start */
162 #define AUTOINIT (32*8) /* # bits above fp where automatics start */
163
164 #undef FIELDOPS /* no bit-field instructions */
165 #define TARGET_ENDIAN TARGET_LE
166
167 /* XXX - to die */
168 #define FPREG FP /* frame pointer */
169 #define SPREG SP /* Stack pointer */
170
171 /* Return a register class based on the type of the node */
172 #define PCLASS(p) (1 << gclass((p)->n_type))
173
174 #define GCLASS(x) (x < 16 ? CLASSA : x < 26 ? CLASSB : CLASSC)
175 #define DECRA(x,y) (((x) >> (y*6)) & 63) /* decode encoded regs */
176 #define ENCRD(x) (x) /* Encode dest reg in n_reg */
177 #define ENCRA1(x) ((x) << 6) /* A1 */
178 #define ENCRA2(x) ((x) << 12) /* A2 */
179 #define ENCRA(x,y) ((x) << (6+y*6)) /* encode regs in int */
180 #define RETREG(x) retreg(x)
181
182 int COLORMAP(int c, int *r);
183 int retreg(int ty);
184 int features(int f);
185
186 #define FEATURE_BIGENDIAN 0x00010000
187 #define FEATURE_HALFWORDS 0x00020000 /* ldrsh/ldrh, ldrsb */
188 #define FEATURE_EXTEND 0x00040000 /* sxth, sxtb, uxth, uxtb */
189 #define FEATURE_MUL 0x00080000
190 #define FEATURE_MULL 0x00100000
191 #define FEATURE_DIV 0x00200000
192 #define FEATURE_FPA 0x10000000
193 #define FEATURE_VFP 0x20000000
194 #define FEATURE_HARDFLOAT (FEATURE_FPA|FEATURE_VFP)
195
196 #undef NODE
197 #ifdef LANG_CXX
198 #define NODE struct node
199 #else
200 #define NODE struct p1node
201 #endif
202 struct node;
203 struct bitable;
204 NODE *arm_builtin_stdarg_start(const struct bitable *bt, NODE *a);
205 NODE *arm_builtin_va_arg(const struct bitable *bt, NODE *a);
206 NODE *arm_builtin_va_end(const struct bitable *bt, NODE *a);
207 NODE *arm_builtin_va_copy(const struct bitable *bt, NODE *a);
208 #undef NODE
209
210 #define COM "\t// "
211 #define NARGREGS 4
212
213 /* floating point definitions */
214 #define USE_IEEEFP_32
215 #define FLT_PREFIX IEEEFP_32
216 #define USE_IEEEFP_64
217 #define DBL_PREFIX IEEEFP_64
218 #define LDBL_PREFIX IEEEFP_64
219 #define DEFAULT_FPI_DEFS { &fpi_binary32, &fpi_binary64, &fpi_binary64 }