]>
Commit | Line | Data |
---|---|---|
bdcee471 | 1 | /* score.h for Sunplus S+CORE processor |
2f83c7d6 | 2 | Copyright (C) 2005, 2007 Free Software Foundation, Inc. |
bdcee471 CL |
3 | Contributed by Sunnorth. |
4 | ||
5 | This file is part of GCC. | |
6 | ||
7 | GCC is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU General Public License as published | |
2f83c7d6 | 9 | by the Free Software Foundation; either version 3, or (at your |
bdcee471 CL |
10 | option) any later version. |
11 | ||
12 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
15 | License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
bdcee471 CL |
20 | |
21 | #include "score-conv.h" | |
22 | #include "score-version.h" | |
23 | ||
24 | /* Define the information needed to generate branch insns. This is | |
25 | stored from the compare operation. */ | |
26 | extern GTY(()) rtx cmp_op0; | |
27 | extern GTY(()) rtx cmp_op1; | |
28 | ||
29 | /* Controlling the Compilation Driver. */ | |
99fc2502 | 30 | #undef SWITCH_TAKES_ARG |
bdcee471 CL |
31 | #define SWITCH_TAKES_ARG(CHAR) \ |
32 | (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') | |
33 | ||
34 | /* CC1_SPEC is the set of arguments to pass to the compiler proper. */ | |
35 | #undef CC1_SPEC | |
99fc2502 | 36 | #define CC1_SPEC "%{G*} %{!mel:-meb}" |
bdcee471 CL |
37 | |
38 | #undef ASM_SPEC | |
39 | #define ASM_SPEC \ | |
c6681463 CL |
40 | "%{!mel:-EB} %{mel:-EL} %{mscore5:-SCORE5} %{mscore5u:-SCORE5U} \ |
41 | %{mscore7:%{!mmac:-SCORE7}} %{mscore7:%{mmac:-SCORE7D}} \ | |
42 | %{mscore7d:-SCORE7D} %{G*}" | |
bdcee471 CL |
43 | |
44 | #undef LINK_SPEC | |
99fc2502 | 45 | #define LINK_SPEC "%{!mel:-EB} %{mel:-EL} %{G*}" |
bdcee471 CL |
46 | |
47 | /* Run-time Target Specification. */ | |
48 | #define TARGET_CPU_CPP_BUILTINS() \ | |
49 | do { \ | |
50 | builtin_define ("SUNPLUS"); \ | |
51 | builtin_define ("__SCORE__"); \ | |
52 | builtin_define ("__score__"); \ | |
53 | if (TARGET_LITTLE_ENDIAN) \ | |
54 | builtin_define ("__scorele__"); \ | |
55 | else \ | |
56 | builtin_define ("__scorebe__"); \ | |
57 | if (TARGET_SCORE5U) \ | |
58 | builtin_define ("__score5u__"); \ | |
cf723ae8 TS |
59 | else \ |
60 | builtin_define ("__score7__"); \ | |
bdcee471 CL |
61 | } while (0) |
62 | ||
bdcee471 CL |
63 | #define TARGET_DEFAULT MASK_SCORE7 |
64 | ||
65 | #define TARGET_VERSION \ | |
66 | fprintf (stderr, "Sunplus S+CORE %s", SCORE_GCC_VERSION); | |
67 | ||
68 | #define OVERRIDE_OPTIONS score_override_options () | |
69 | ||
70 | /* Show we can debug even without a frame pointer. */ | |
71 | #define CAN_DEBUG_WITHOUT_FP | |
72 | ||
73 | /* Target machine storage layout. */ | |
74 | #define BITS_BIG_ENDIAN 0 | |
75 | #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0) | |
76 | #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0) | |
77 | ||
78 | /* Define this to set the endianness to use in libgcc2.c, which can | |
79 | not depend on target_flags. */ | |
80 | #if defined(__scorele__) | |
81 | #define LIBGCC2_WORDS_BIG_ENDIAN 0 | |
82 | #else | |
83 | #define LIBGCC2_WORDS_BIG_ENDIAN 1 | |
84 | #endif | |
85 | ||
86 | /* Width of a word, in units (bytes). */ | |
87 | #define UNITS_PER_WORD 4 | |
88 | ||
89 | /* Define this macro if it is advisable to hold scalars in registers | |
90 | in a wider mode than that declared by the program. In such cases, | |
91 | the value is constrained to be within the bounds of the declared | |
92 | type, but kept valid in the wider mode. The signedness of the | |
93 | extension may differ from that of the type. */ | |
94 | #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ | |
95 | if (GET_MODE_CLASS (MODE) == MODE_INT \ | |
96 | && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ | |
97 | (MODE) = SImode; | |
98 | ||
99 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
100 | #define PARM_BOUNDARY BITS_PER_WORD | |
99fc2502 | 101 | #define STACK_BOUNDARY BITS_PER_WORD |
bdcee471 CL |
102 | |
103 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
104 | #define FUNCTION_BOUNDARY BITS_PER_WORD | |
105 | ||
106 | /* There is no point aligning anything to a rounder boundary than this. */ | |
107 | #define BIGGEST_ALIGNMENT LONG_DOUBLE_TYPE_SIZE | |
108 | ||
109 | /* If defined, a C expression to compute the alignment for a static | |
110 | variable. TYPE is the data type, and ALIGN is the alignment that | |
111 | the object would ordinarily have. The value of this macro is used | |
112 | instead of that alignment to align the object. | |
113 | ||
114 | If this macro is not defined, then ALIGN is used. | |
115 | ||
116 | One use of this macro is to increase alignment of medium-size | |
117 | data to make it all fit in fewer cache lines. Another is to | |
118 | cause character arrays to be word-aligned so that `strcpy' calls | |
119 | that copy constants to character arrays can be done inline. */ | |
99fc2502 CL |
120 | #define DATA_ALIGNMENT(TYPE, ALIGN) \ |
121 | ((((ALIGN) < BITS_PER_WORD) \ | |
122 | && (TREE_CODE (TYPE) == ARRAY_TYPE \ | |
123 | || TREE_CODE (TYPE) == UNION_TYPE \ | |
bdcee471 CL |
124 | || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN)) |
125 | ||
99fc2502 CL |
126 | /* If defined, a C expression to compute the alignment given to a |
127 | constant that is being placed in memory. EXP is the constant | |
128 | and ALIGN is the alignment that the object would ordinarily have. | |
129 | The value of this macro is used instead of that alignment to align | |
130 | the object. | |
131 | ||
132 | If this macro is not defined, then ALIGN is used. | |
133 | ||
134 | The typical use of this macro is to increase alignment for string | |
135 | constants to be word aligned so that `strcpy' calls that copy | |
136 | constants can be done inline. */ | |
137 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ | |
138 | ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ | |
139 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
140 | ||
141 | /* If defined, a C expression to compute the alignment for a local | |
142 | variable. TYPE is the data type, and ALIGN is the alignment that | |
143 | the object would ordinarily have. The value of this macro is used | |
144 | instead of that alignment to align the object. | |
145 | ||
146 | If this macro is not defined, then ALIGN is used. | |
147 | ||
148 | One use of this macro is to increase alignment of medium-size | |
149 | data to make it all fit in fewer cache lines. */ | |
150 | #define LOCAL_ALIGNMENT(TYPE, ALIGN) \ | |
151 | ((TREE_CODE (TYPE) == ARRAY_TYPE \ | |
152 | && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ | |
153 | && (ALIGN) < BITS_PER_WORD) ? BITS_PER_WORD : (ALIGN)) | |
154 | ||
bdcee471 CL |
155 | /* Alignment of field after `int : 0' in a structure. */ |
156 | #define EMPTY_FIELD_BOUNDARY 32 | |
157 | ||
158 | /* All accesses must be aligned. */ | |
159 | #define STRICT_ALIGNMENT 1 | |
160 | ||
161 | /* Score requires that structure alignment is affected by bitfields. */ | |
162 | #define PCC_BITFIELD_TYPE_MATTERS 1 | |
163 | ||
164 | /* long double is not a fixed mode, but the idea is that, if we | |
165 | support long double, we also want a 128-bit integer type. */ | |
166 | #define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE | |
167 | ||
168 | #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT | |
169 | ||
170 | /* Layout of Data Type. */ | |
171 | /* Set the sizes of the core types. */ | |
172 | #define INT_TYPE_SIZE 32 | |
173 | #define SHORT_TYPE_SIZE 16 | |
174 | #define LONG_TYPE_SIZE 32 | |
175 | #define LONG_LONG_TYPE_SIZE 64 | |
176 | #define CHAR_TYPE_SIZE 8 | |
177 | #define FLOAT_TYPE_SIZE 32 | |
178 | #define DOUBLE_TYPE_SIZE 64 | |
179 | #define LONG_DOUBLE_TYPE_SIZE 64 | |
180 | ||
181 | /* Define this as 1 if `char' should by default be signed; else as 0. */ | |
182 | #undef DEFAULT_SIGNED_CHAR | |
183 | #define DEFAULT_SIGNED_CHAR 1 | |
184 | ||
185 | /* Default definitions for size_t and ptrdiff_t. */ | |
186 | #define SIZE_TYPE "unsigned int" | |
187 | ||
188 | /* Register Usage | |
189 | ||
190 | S+core have: | |
191 | - 32 integer registers | |
192 | - 16 control registers (cond) | |
193 | - 16 special registers (ceh/cel/cnt/lcr/scr/arg/fp) | |
194 | - 32 coprocessors 1 registers | |
195 | - 32 coprocessors 2 registers | |
196 | - 32 coprocessors 3 registers. */ | |
197 | #define FIRST_PSEUDO_REGISTER 160 | |
198 | ||
199 | /* By default, fix the kernel registers (r30 and r31), the global | |
200 | pointer (r28) and the stack pointer (r0). This can change | |
201 | depending on the command-line options. | |
202 | ||
203 | Regarding coprocessor registers: without evidence to the contrary, | |
204 | it's best to assume that each coprocessor register has a unique | |
205 | use. This can be overridden, in, e.g., override_options() or | |
206 | CONDITIONAL_REGISTER_USAGE should the assumption be inappropriate | |
207 | for a particular target. */ | |
208 | ||
209 | /* Control Registers, use mfcr/mtcr insn | |
210 | 32 cr0 PSR | |
211 | 33 cr1 Condition | |
212 | 34 cr2 ECR | |
213 | 35 cr3 EXCPVec | |
214 | 36 cr4 CCR | |
215 | 37 cr5 EPC | |
216 | 38 cr6 EMA | |
217 | 39 cr7 TLBLock | |
218 | 40 cr8 TLBPT | |
219 | 41 cr8 PEADDR | |
220 | 42 cr10 TLBRPT | |
221 | 43 cr11 PEVN | |
222 | 44 cr12 PECTX | |
223 | 45 cr13 | |
224 | 46 cr14 | |
225 | 47 cr15 | |
226 | ||
227 | Custom Engine Register, use mfce/mtce | |
228 | 48 CEH CEH | |
229 | 49 CEL CEL | |
230 | ||
231 | Special-Purpose Register, use mfsr/mtsr | |
232 | 50 sr0 CNT | |
233 | 51 sr1 LCR | |
234 | 52 sr2 SCR | |
235 | ||
236 | 53 ARG_POINTER_REGNUM | |
237 | 54 FRAME_POINTER_REGNUM | |
238 | but Control register have 32 registers, cr16-cr31. */ | |
239 | #define FIXED_REGISTERS \ | |
240 | { \ | |
93ef7c1f | 241 | /* General Purpose Registers */ \ |
bdcee471 | 242 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
99fc2502 | 243 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \ |
93ef7c1f | 244 | /* Control Registers */ \ |
bdcee471 CL |
245 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ |
246 | /* CEH/ CEL/ CNT/ LCR/ SCR / ARG_POINTER_REGNUM/ FRAME_POINTER_REGNUM */\ | |
247 | 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
248 | /* CP 1 Registers */ \ | |
249 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
250 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
251 | /* CP 2 Registers */ \ | |
252 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
253 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
93ef7c1f | 254 | /* CP 3 Registers */ \ |
bdcee471 CL |
255 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ |
256 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
257 | } | |
258 | ||
259 | #define CALL_USED_REGISTERS \ | |
260 | { \ | |
93ef7c1f | 261 | /* General purpose register */ \ |
bdcee471 CL |
262 | 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \ |
263 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
93ef7c1f | 264 | /* Control Registers */ \ |
bdcee471 CL |
265 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ |
266 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
267 | /* CP 1 Registers */ \ | |
268 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
269 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
270 | /* CP 2 Registers */ \ | |
271 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
272 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
273 | /* CP 3 Registers */ \ | |
274 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
275 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
276 | } | |
277 | ||
278 | #define REG_ALLOC_ORDER \ | |
99fc2502 CL |
279 | { 0, 1, 6, 7, 8, 9, 10, 11, 4, 5, 22, 23, 24, 25, 26, 27, \ |
280 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 28, 29, 30, 31, 2, 3, \ | |
bdcee471 CL |
281 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ |
282 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \ | |
283 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ | |
284 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, \ | |
285 | 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, \ | |
286 | 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, \ | |
287 | 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, \ | |
288 | 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159 } | |
289 | ||
c6681463 CL |
290 | /* Macro to conditionally modify fixed_regs/call_used_regs. */ |
291 | #define PIC_OFFSET_TABLE_REGNUM 29 | |
292 | ||
293 | #define CONDITIONAL_REGISTER_USAGE \ | |
294 | { \ | |
295 | if (!flag_pic) \ | |
296 | fixed_regs[PIC_OFFSET_TABLE_REGNUM] = \ | |
297 | call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 0; \ | |
298 | } | |
299 | ||
bdcee471 CL |
300 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
301 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
302 | ||
303 | /* Return true if REGNO is suitable for holding a quantity of type MODE. */ | |
304 | #define HARD_REGNO_MODE_OK(REGNO, MODE) score_hard_regno_mode_ok (REGNO, MODE) | |
305 | ||
306 | /* Value is 1 if it is a good idea to tie two pseudo registers | |
307 | when one has mode MODE1 and one has mode MODE2. | |
308 | If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, | |
309 | for any hard reg, then this must be 0 for correct output. */ | |
310 | #define MODES_TIEABLE_P(MODE1, MODE2) \ | |
311 | ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \ | |
312 | || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \ | |
313 | == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \ | |
314 | || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)) | |
315 | ||
316 | /* Register Classes. */ | |
317 | /* Define the classes of registers for register constraints in the | |
318 | machine description. Also define ranges of constants. */ | |
319 | enum reg_class | |
320 | { | |
321 | NO_REGS, | |
322 | G16_REGS, /* r0 ~ r15 */ | |
323 | G32_REGS, /* r0 ~ r31 */ | |
324 | T32_REGS, /* r8 ~ r11 | r22 ~ r27 */ | |
325 | ||
326 | HI_REG, /* hi */ | |
327 | LO_REG, /* lo */ | |
328 | CE_REGS, /* hi + lo */ | |
329 | ||
330 | CN_REG, /* cnt */ | |
331 | LC_REG, /* lcb */ | |
332 | SC_REG, /* scb */ | |
333 | SP_REGS, /* cnt + lcb + scb */ | |
334 | ||
335 | CR_REGS, /* cr0 - cr15 */ | |
336 | ||
337 | CP1_REGS, /* cp1 */ | |
338 | CP2_REGS, /* cp2 */ | |
339 | CP3_REGS, /* cp3 */ | |
340 | CPA_REGS, /* cp1 + cp2 + cp3 */ | |
341 | ||
342 | ALL_REGS, | |
343 | LIM_REG_CLASSES | |
344 | }; | |
345 | ||
346 | #define N_REG_CLASSES ((int) LIM_REG_CLASSES) | |
347 | ||
348 | #define GENERAL_REGS G32_REGS | |
349 | ||
350 | /* Give names of register classes as strings for dump file. */ | |
351 | #define REG_CLASS_NAMES \ | |
352 | { \ | |
353 | "NO_REGS", \ | |
354 | "G16_REGS", \ | |
355 | "G32_REGS", \ | |
356 | "T32_REGS", \ | |
357 | \ | |
358 | "HI_REG", \ | |
359 | "LO_REG", \ | |
360 | "CE_REGS", \ | |
361 | \ | |
362 | "CN_REG", \ | |
363 | "LC_REG", \ | |
364 | "SC_REG", \ | |
365 | "SP_REGS", \ | |
366 | \ | |
367 | "CR_REGS", \ | |
368 | \ | |
369 | "CP1_REGS", \ | |
370 | "CP2_REGS", \ | |
371 | "CP3_REGS", \ | |
372 | "CPA_REGS", \ | |
373 | \ | |
374 | "ALL_REGS", \ | |
375 | } | |
376 | ||
377 | /* Define which registers fit in which classes. */ | |
378 | #define REG_CLASS_CONTENTS \ | |
379 | { \ | |
380 | /* NO_REGS/G16/G32/T32 */ \ | |
381 | { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, \ | |
382 | { 0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, \ | |
383 | { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, \ | |
384 | { 0x0fc00f00, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, \ | |
385 | /* HI/LO/CE */ \ | |
386 | { 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000}, \ | |
387 | { 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000}, \ | |
388 | { 0x00000000, 0x00030000, 0x00000000, 0x00000000, 0x00000000}, \ | |
389 | /* CN/LC/SC/SP/CR */ \ | |
390 | { 0x00000000, 0x00040000, 0x00000000, 0x00000000, 0x00000000}, \ | |
391 | { 0x00000000, 0x00080000, 0x00000000, 0x00000000, 0x00000000}, \ | |
392 | { 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x00000000}, \ | |
393 | { 0x00000000, 0x001c0000, 0x00000000, 0x00000000, 0x00000000}, \ | |
394 | { 0x00000000, 0x0000ffff, 0x00000000, 0x00000000, 0x00000000}, \ | |
395 | /* CP1/CP2/CP3/CPA */ \ | |
396 | { 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000}, \ | |
397 | { 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000}, \ | |
398 | { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff}, \ | |
399 | { 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff}, \ | |
93ef7c1f | 400 | /* ALL_REGS */ \ |
bdcee471 CL |
401 | { 0xffffffff, 0x001fffff, 0xffffffff, 0xffffffff, 0xffffffff}, \ |
402 | } | |
403 | ||
404 | /* A C expression whose value is a register class containing hard | |
405 | register REGNO. In general there is more that one such class; | |
406 | choose a class which is "minimal", meaning that no smaller class | |
407 | also contains the register. */ | |
408 | #define REGNO_REG_CLASS(REGNO) score_reg_class (REGNO) | |
409 | ||
410 | /* A macro whose definition is the name of the class to which a | |
411 | valid base register must belong. A base register is one used in | |
412 | an address which is the register value plus a displacement. */ | |
413 | #define BASE_REG_CLASS G16_REGS | |
414 | ||
415 | /* The class value for index registers. */ | |
416 | #define INDEX_REG_CLASS NO_REGS | |
417 | ||
418 | #define REG_CLASS_FROM_LETTER(C) score_char_to_class[(unsigned char) (C)] | |
419 | ||
420 | /* Addressing modes, and classification of registers for them. */ | |
421 | #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \ | |
422 | score_regno_mode_ok_for_base_p (REGNO, 1) | |
423 | ||
424 | #define REGNO_OK_FOR_INDEX_P(NUM) 0 | |
425 | ||
426 | #define PREFERRED_RELOAD_CLASS(X, CLASS) \ | |
427 | score_preferred_reload_class (X, CLASS) | |
428 | ||
429 | /* If we need to load shorts byte-at-a-time, then we need a scratch. */ | |
99fc2502 | 430 | #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ |
bdcee471 CL |
431 | score_secondary_reload_class (CLASS, MODE, X) |
432 | ||
433 | /* Return the register class of a scratch register needed to copy IN into | |
434 | or out of a register in CLASS in MODE. If it can be done directly, | |
435 | NO_REGS is returned. */ | |
99fc2502 | 436 | #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ |
bdcee471 CL |
437 | score_secondary_reload_class (CLASS, MODE, X) |
438 | ||
439 | /* Return the maximum number of consecutive registers | |
440 | needed to represent mode MODE in a register of class CLASS. */ | |
99fc2502 | 441 | #define CLASS_MAX_NREGS(CLASS, MODE) \ |
bdcee471 CL |
442 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) |
443 | ||
444 | #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ | |
445 | (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ | |
446 | ? reg_classes_intersect_p (HI_REG, (CLASS)) : 0) | |
447 | ||
448 | /* The letters I, J, K, L, M, N, O, and P in a register constraint | |
449 | string can be used to stand for particular ranges of immediate | |
450 | operands. This macro defines what the ranges are. C is the | |
451 | letter, and VALUE is a constant value. Return 1 if VALUE is | |
452 | in the range specified by C. */ | |
453 | #define CONST_OK_FOR_LETTER_P(VALUE, C) score_const_ok_for_letter_p (VALUE, C) | |
454 | ||
455 | /* Similar, but for floating constants, and defining letters G and H. | |
456 | Here VALUE is the CONST_DOUBLE rtx itself. */ | |
457 | ||
458 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ | |
459 | ((C) == 'G' && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) | |
460 | ||
461 | /* Letters in the range `Q' through `U' may be defined in a | |
462 | machine-dependent fashion to stand for arbitrary operand types. | |
463 | The machine description macro `EXTRA_CONSTRAINT' is passed the | |
464 | operand as its first argument and the constraint letter as its | |
465 | second operand. */ | |
466 | #define EXTRA_CONSTRAINT(VALUE, C) score_extra_constraint (VALUE, C) | |
467 | ||
468 | /* Basic Stack Layout. */ | |
469 | /* Stack layout; function entry, exit and calling. */ | |
470 | #define STACK_GROWS_DOWNWARD | |
471 | ||
472 | #define STACK_PUSH_CODE PRE_DEC | |
473 | #define STACK_POP_CODE POST_INC | |
474 | ||
475 | /* The offset of the first local variable from the beginning of the frame. | |
476 | See compute_frame_size for details about the frame layout. */ | |
477 | #define STARTING_FRAME_OFFSET current_function_outgoing_args_size | |
478 | ||
479 | /* The argument pointer always points to the first argument. */ | |
480 | #define FIRST_PARM_OFFSET(FUNDECL) 0 | |
481 | ||
482 | /* A C expression whose value is RTL representing the value of the return | |
483 | address for the frame COUNT steps up from the current frame. */ | |
484 | #define RETURN_ADDR_RTX(count, frame) score_return_addr (count, frame) | |
485 | ||
486 | /* Pick up the return address upon entry to a procedure. */ | |
487 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (VOIDmode, RA_REGNUM) | |
488 | ||
489 | /* Exception handling Support. */ | |
490 | /* Use r0 to r3 to pass exception handling information. */ | |
491 | #define EH_RETURN_DATA_REGNO(N) \ | |
492 | ((N) < 4 ? (N) + ARG_REG_FIRST : INVALID_REGNUM) | |
493 | ||
494 | /* The register that holds the return address in exception handlers. */ | |
495 | #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, EH_REGNUM) | |
496 | ||
497 | /* Registers That Address the Stack Frame. */ | |
498 | /* Register to use for pushing function arguments. */ | |
499 | #define STACK_POINTER_REGNUM SP_REGNUM | |
500 | ||
501 | /* These two registers don't really exist: they get eliminated to either | |
502 | the stack or hard frame pointer. */ | |
503 | #define FRAME_POINTER_REGNUM 53 | |
504 | ||
505 | /* we use r2 as the frame pointer. */ | |
506 | #define HARD_FRAME_POINTER_REGNUM FP_REGNUM | |
507 | ||
508 | #define ARG_POINTER_REGNUM 54 | |
509 | ||
510 | /* Register in which static-chain is passed to a function. */ | |
511 | #define STATIC_CHAIN_REGNUM 23 | |
512 | ||
513 | /* Elimination Frame Pointer and Arg Pointer */ | |
514 | /* Value should be nonzero if functions must have frame pointers. | |
515 | Zero means the frame pointer need not be set up (and parms | |
516 | may be accessed via the stack pointer) in functions that seem suitable. | |
517 | This is computed in `reload', in reload1.c. */ | |
518 | #define FRAME_POINTER_REQUIRED current_function_calls_alloca | |
519 | ||
520 | #define ELIMINABLE_REGS \ | |
521 | {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
522 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | |
523 | { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
524 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} | |
525 | ||
526 | /* We can always eliminate to the hard frame pointer. We can eliminate | |
527 | to the stack pointer unless a frame pointer is needed. */ | |
528 | #define CAN_ELIMINATE(FROM, TO) \ | |
529 | (((TO) == HARD_FRAME_POINTER_REGNUM) \ | |
530 | || ((TO) == STACK_POINTER_REGNUM \ | |
531 | && !frame_pointer_needed)) | |
532 | ||
533 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
534 | (OFFSET) = score_initial_elimination_offset ((FROM), (TO)) | |
535 | ||
536 | /* Passing Function Arguments on the Stack. */ | |
537 | /* Allocate stack space for arguments at the beginning of each function. */ | |
538 | #define ACCUMULATE_OUTGOING_ARGS 1 | |
539 | ||
540 | /* reserve stack space for all argument registers. */ | |
541 | #define REG_PARM_STACK_SPACE(FNDECL) UNITS_PER_WORD | |
542 | ||
543 | /* Define this if it is the responsibility of the caller to | |
544 | allocate the area reserved for arguments passed in registers. | |
545 | If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect | |
546 | of this macro is to determine whether the space is included in | |
547 | `current_function_outgoing_args_size'. */ | |
c6681463 | 548 | #define OUTGOING_REG_PARM_STACK_SPACE 1 |
bdcee471 CL |
549 | |
550 | #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0 | |
551 | ||
552 | /* Passing Arguments in Registers */ | |
553 | /* Determine where to put an argument to a function. | |
554 | Value is zero to push the argument on the stack, | |
555 | or a hard register in which to store the argument. | |
556 | ||
557 | MODE is the argument's machine mode. | |
558 | TYPE is the data type of the argument (as a tree). | |
559 | This is null for libcalls where that information may | |
560 | not be available. | |
561 | CUM is a variable of type CUMULATIVE_ARGS which gives info about | |
562 | the preceding args and about the function being called. | |
563 | NAMED is nonzero if this argument is a named parameter | |
564 | (otherwise it is an extra parameter matching an ellipsis). */ | |
565 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ | |
566 | score_function_arg (&CUM, MODE, TYPE, NAMED) | |
567 | ||
568 | /* A C type for declaring a variable that is used as the first argument of | |
569 | `FUNCTION_ARG' and other related values. For some target machines, the | |
570 | type `int' suffices and can hold the number of bytes of argument so far. */ | |
571 | typedef struct score_args | |
572 | { | |
573 | unsigned int arg_number; /* how many arguments have been seen */ | |
574 | unsigned int num_gprs; /* number of gprs in use */ | |
575 | unsigned int stack_words; /* number of words in stack */ | |
576 | } score_args_t; | |
577 | ||
578 | #define CUMULATIVE_ARGS score_args_t | |
579 | ||
580 | /* Initialize a variable CUM of type CUMULATIVE_ARGS | |
581 | for a call to a function whose data type is FNTYPE. | |
582 | For a library call, FNTYPE is 0. */ | |
583 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, n_named_args) \ | |
584 | score_init_cumulative_args (&CUM, FNTYPE, LIBNAME) | |
585 | ||
586 | /* Update the data in CUM to advance over an argument | |
587 | of mode MODE and data type TYPE. | |
588 | (TYPE is null for libcalls where that information may not be available.) */ | |
589 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ | |
590 | score_function_arg_advance (&CUM, MODE, TYPE, NAMED) | |
591 | ||
592 | /* 1 if N is a possible register number for function argument passing. | |
593 | We have no FP argument registers when soft-float. When FP registers | |
594 | are 32 bits, we can't directly reference the odd numbered ones. */ | |
595 | #define FUNCTION_ARG_REGNO_P(REGNO) \ | |
596 | REG_CONTAIN (REGNO, ARG_REG_FIRST, ARG_REG_NUM) | |
597 | ||
598 | /* How Scalar Function Values Are Returned. */ | |
599 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ | |
600 | score_function_value ((VALTYPE), (FUNC), VOIDmode) | |
601 | ||
602 | #define LIBCALL_VALUE(MODE) score_function_value (NULL_TREE, NULL, (MODE)) | |
603 | ||
604 | /* 1 if N is a possible register number for a function value. */ | |
605 | #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == (ARG_REG_FIRST)) | |
606 | ||
607 | #define PIC_FUNCTION_ADDR_REGNUM (GP_REG_FIRST + 25) | |
608 | ||
609 | /* How Large Values Are Returned. */ | |
610 | #define STRUCT_VALUE 0 | |
611 | ||
612 | /* Function Entry and Exit */ | |
613 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
614 | the stack pointer does not matter. The value is tested only in | |
615 | functions that have frame pointers. | |
616 | No definition is equivalent to always zero. */ | |
617 | #define EXIT_IGNORE_STACK 1 | |
618 | ||
619 | /* Generating Code for Profiling */ | |
620 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
621 | for profiling a function entry. */ | |
622 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
623 | { \ | |
624 | fprintf (FILE, " .set r1 \n"); \ | |
625 | fprintf (FILE, " mv r%d,r%d \n", AT_REGNUM, RA_REGNUM); \ | |
626 | fprintf (FILE, " subi r%d, %d \n", STACK_POINTER_REGNUM, 8); \ | |
627 | fprintf (FILE, " jl _mcount \n"); \ | |
628 | fprintf (FILE, " .set nor1 \n"); \ | |
629 | } | |
630 | ||
64276d76 CL |
631 | #define TRAMPOLINE_TEMPLATE(STREAM) \ |
632 | { \ | |
633 | fprintf (STREAM, "\t.set r1\n"); \ | |
634 | fprintf (STREAM, "\tmv r31, r3\n"); \ | |
635 | fprintf (STREAM, "\tbl nextinsn\n"); \ | |
636 | fprintf (STREAM, "nextinsn:\n"); \ | |
637 | fprintf (STREAM, "\tlw r1, [r3, 6*4-8]\n"); \ | |
638 | fprintf (STREAM, "\tlw r23, [r3, 6*4-4]\n"); \ | |
639 | fprintf (STREAM, "\tmv r3, r31\n"); \ | |
640 | fprintf (STREAM, "\tbr! r1\n"); \ | |
641 | fprintf (STREAM, "\tnop!\n"); \ | |
642 | fprintf (STREAM, "\t.set nor1\n"); \ | |
643 | } | |
644 | ||
bdcee471 | 645 | /* Trampolines for Nested Functions. */ |
64276d76 | 646 | #define TRAMPOLINE_INSNS 6 |
bdcee471 CL |
647 | |
648 | /* A C expression for the size in bytes of the trampoline, as an integer. */ | |
64276d76 | 649 | #define TRAMPOLINE_SIZE (24 + GET_MODE_SIZE (ptr_mode) * 2) |
bdcee471 CL |
650 | |
651 | /* A C statement to initialize the variable parts of a trampoline. | |
652 | ADDR is an RTX for the address of the trampoline; FNADDR is an | |
653 | RTX for the address of the nested function; STATIC_CHAIN is an | |
654 | RTX for the static chain value that should be passed to the | |
655 | function when it is called. */ | |
656 | ||
657 | #define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \ | |
658 | score_initialize_trampoline (ADDR, FUNC, CHAIN) | |
659 | ||
660 | #define HAVE_PRE_INCREMENT 1 | |
661 | #define HAVE_PRE_DECREMENT 1 | |
662 | #define HAVE_POST_INCREMENT 1 | |
663 | #define HAVE_POST_DECREMENT 1 | |
99fc2502 CL |
664 | #define HAVE_PRE_MODIFY_DISP 1 |
665 | #define HAVE_POST_MODIFY_DISP 1 | |
bdcee471 CL |
666 | #define HAVE_PRE_MODIFY_REG 0 |
667 | #define HAVE_POST_MODIFY_REG 0 | |
668 | ||
669 | /* Recognize any constant value that is a valid address. */ | |
670 | #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) | |
671 | ||
672 | /* Maximum number of registers that can appear in a valid memory address. */ | |
673 | #define MAX_REGS_PER_ADDRESS 1 | |
674 | ||
675 | #ifdef REG_OK_STRICT | |
676 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ | |
677 | if (score_address_p (MODE, X, 1)) \ | |
678 | goto LABEL; | |
679 | #else | |
680 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ | |
681 | if (score_address_p (MODE, X, 0)) \ | |
682 | goto LABEL; | |
683 | #endif | |
684 | ||
685 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
686 | and check its validity for a certain class. | |
687 | We have two alternate definitions for each of them. | |
688 | The usual definition accepts all pseudo regs; the other rejects them all. | |
689 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
690 | ||
691 | Most source files want to accept pseudo regs in the hope that | |
692 | they will get allocated to the class that the insn wants them to be in. | |
693 | Some source files that are used after register allocation | |
694 | need to be strict. */ | |
695 | #ifndef REG_OK_STRICT | |
696 | #define REG_MODE_OK_FOR_BASE_P(X, MODE) \ | |
697 | score_regno_mode_ok_for_base_p (REGNO (X), 0) | |
698 | #else | |
699 | #define REG_MODE_OK_FOR_BASE_P(X, MODE) \ | |
700 | score_regno_mode_ok_for_base_p (REGNO (X), 1) | |
701 | #endif | |
702 | ||
703 | #define REG_OK_FOR_INDEX_P(X) 0 | |
704 | ||
705 | #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ | |
706 | do { \ | |
707 | if (score_legitimize_address (&(X))) \ | |
708 | goto WIN; \ | |
709 | } while (0) | |
710 | ||
711 | /* Go to LABEL if ADDR (a legitimate address expression) | |
712 | has an effect that depends on the machine mode it is used for. */ | |
713 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) {} | |
714 | ||
715 | #define LEGITIMATE_CONSTANT_P(X) 1 | |
716 | ||
99fc2502 CL |
717 | /* Condition Code Status. */ |
718 | #define SELECT_CC_MODE(OP, X, Y) score_select_cc_mode (OP, X, Y) | |
719 | ||
720 | /* Return nonzero if SELECT_CC_MODE will never return MODE for a | |
721 | floating point inequality comparison. */ | |
722 | #define REVERSIBLE_CC_MODE(MODE) 1 | |
723 | ||
bdcee471 CL |
724 | /* Describing Relative Costs of Operations */ |
725 | /* Compute extra cost of moving data between one register class and another. */ | |
726 | #define REGISTER_MOVE_COST(MODE, FROM, TO) \ | |
727 | score_register_move_cost (MODE, FROM, TO) | |
728 | ||
729 | /* Moves to and from memory are quite expensive */ | |
730 | #define MEMORY_MOVE_COST(MODE, CLASS, TO_P) \ | |
731 | (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) | |
732 | ||
733 | /* Try to generate sequences that don't involve branches. */ | |
734 | #define BRANCH_COST 2 | |
735 | ||
736 | /* Nonzero if access to memory by bytes is slow and undesirable. */ | |
737 | #define SLOW_BYTE_ACCESS 1 | |
738 | ||
739 | /* Define this macro if it is as good or better to call a constant | |
740 | function address than to call an address kept in a register. */ | |
741 | #define NO_FUNCTION_CSE 1 | |
742 | ||
743 | /* Dividing the Output into Sections (Texts, Data, ...). */ | |
744 | /* Define the strings to put out for each section in the object file. */ | |
745 | #define TEXT_SECTION_ASM_OP "\t.text" | |
746 | #define DATA_SECTION_ASM_OP "\t.data" | |
747 | #define SDATA_SECTION_ASM_OP "\t.sdata" | |
748 | ||
749 | #undef READONLY_DATA_SECTION_ASM_OP | |
750 | #define READONLY_DATA_SECTION_ASM_OP "\t.rdata" | |
751 | ||
752 | /* The Overall Framework of an Assembler File */ | |
753 | /* How to start an assembler comment. | |
754 | The leading space is important. */ | |
755 | #define ASM_COMMENT_START "#" | |
756 | ||
757 | /* Output to assembler file text saying following lines | |
758 | may contain character constants, extra white space, comments, etc. */ | |
759 | #define ASM_APP_ON "#APP\n\t.set volatile\n" | |
760 | ||
761 | /* Output to assembler file text saying following lines | |
762 | no longer contain unusual constructs. */ | |
763 | #define ASM_APP_OFF "#NO_APP\n\t.set optimize\n" | |
764 | ||
765 | /* Output of Uninitialized Variables. */ | |
766 | /* This says how to define a global common symbol. */ | |
767 | #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \ | |
768 | score_declare_object (STREAM, NAME, "\n\t.comm\t", \ | |
769 | ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ | |
770 | SIZE, ALIGN / BITS_PER_UNIT); | |
771 | ||
772 | /* This says how to define a local common symbol (i.e., not visible to | |
773 | linker). */ | |
774 | #undef ASM_OUTPUT_ALIGNED_LOCAL | |
775 | #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \ | |
776 | score_declare_object (STREAM, NAME, "\n\t.lcomm\t", \ | |
777 | ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ | |
778 | SIZE, ALIGN / BITS_PER_UNIT); | |
779 | ||
780 | /* Globalizing directive for a label. */ | |
781 | #define GLOBAL_ASM_OP "\t.globl\t" | |
782 | ||
783 | /* Output and Generation of Labels */ | |
784 | /* This is how to declare a function name. The actual work of | |
785 | emitting the label is moved to function_prologue, so that we can | |
786 | get the line number correctly emitted before the .ent directive, | |
787 | and after any .file directives. Define as empty so that the function | |
788 | is not declared before the .ent directive elsewhere. */ | |
789 | #undef ASM_DECLARE_FUNCTION_NAME | |
790 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) | |
791 | ||
792 | #undef ASM_DECLARE_OBJECT_NAME | |
793 | #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ | |
586de218 | 794 | score_declare_object (STREAM, NAME, "", ":\n") |
bdcee471 CL |
795 | |
796 | /* This says how to output an external. It would be possible not to | |
797 | output anything and let undefined symbol become external. However | |
798 | the assembler uses length information on externals to allocate in | |
799 | data/sdata bss/sbss, thereby saving exec time. */ | |
6d0ceb76 | 800 | #undef ASM_OUTPUT_EXTERNAL |
bdcee471 CL |
801 | #define ASM_OUTPUT_EXTERNAL(STREAM, DECL, NAME) \ |
802 | score_output_external (STREAM, DECL, NAME) | |
803 | ||
804 | /* This handles the magic '..CURRENT_FUNCTION' symbol, which means | |
805 | 'the start of the function that this code is output in'. */ | |
806 | #define ASM_OUTPUT_LABELREF(STREAM, NAME) \ | |
807 | fprintf ((STREAM), "%s", (NAME)) | |
808 | ||
809 | /* Local compiler-generated symbols must have a prefix that the assembler | |
810 | understands. */ | |
811 | #define LOCAL_LABEL_PREFIX "." | |
812 | ||
813 | #undef ASM_GENERATE_INTERNAL_LABEL | |
814 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ | |
815 | sprintf ((LABEL), "*%s%s%ld", (LOCAL_LABEL_PREFIX), (PREFIX), (long) (NUM)) | |
816 | ||
817 | /* Output of Assembler Instructions. */ | |
99fc2502 CL |
818 | #define REGISTER_NAMES \ |
819 | { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ | |
820 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ | |
821 | "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ | |
822 | "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ | |
823 | \ | |
824 | "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ | |
825 | "cr8", "cr9", "cr10", "cr11", "cr12", "cr13", "cr14", "cr15", \ | |
826 | \ | |
827 | "ceh", "cel", "sr0", "sr1", "sr2", "_arg", "_frame", "", \ | |
828 | "cr24", "cr25", "cr26", "cr27", "cr28", "cr29", "cr30", "cr31", \ | |
829 | \ | |
830 | "c1r0", "c1r1", "c1r2", "c1r3", "c1r4", "c1r5", "c1r6", "c1r7", \ | |
831 | "c1r8", "c1r9", "c1r10", "c1r11", "c1r12", "c1r13", "c1r14", "c1r15", \ | |
832 | "c1r16", "c1r17", "c1r18", "c1r19", "c1r20", "c1r21", "c1r22", "c1r23", \ | |
833 | "c1r24", "c1r25", "c1r26", "c1r27", "c1r28", "c1r29", "c1r30", "c1r31", \ | |
834 | \ | |
835 | "c2r0", "c2r1", "c2r2", "c2r3", "c2r4", "c2r5", "c2r6", "c2r7", \ | |
836 | "c2r8", "c2r9", "c2r10", "c2r11", "c2r12", "c2r13", "c2r14", "c2r15", \ | |
837 | "c2r16", "c2r17", "c2r18", "c2r19", "c2r20", "c2r21", "c2r22", "c2r23", \ | |
838 | "c2r24", "c2r25", "c2r26", "c2r27", "c2r28", "c2r29", "c2r30", "c2r31", \ | |
839 | \ | |
840 | "c3r0", "c3r1", "c3r2", "c3r3", "c3r4", "c3r5", "c3r6", "c3r7", \ | |
841 | "c3r8", "c3r9", "c3r10", "c3r11", "c3r12", "c3r13", "c3r14", "c3r15", \ | |
842 | "c3r16", "c3r17", "c3r18", "c3r19", "c3r20", "c3r21", "c3r22", "c3r23", \ | |
843 | "c3r24", "c3r25", "c3r26", "c3r27", "c3r28", "c3r29", "c3r30", "c3r31", \ | |
bdcee471 CL |
844 | } |
845 | ||
846 | /* Print operand X (an rtx) in assembler syntax to file FILE. */ | |
847 | #define PRINT_OPERAND(STREAM, X, CODE) score_print_operand (STREAM, X, CODE) | |
848 | ||
849 | /* A C expression which evaluates to true if CODE is a valid | |
850 | punctuation character for use in the `PRINT_OPERAND' macro. */ | |
851 | #define PRINT_OPERAND_PUNCT_VALID_P(C) ((C) == '[' || (C) == ']') | |
852 | ||
853 | /* Print a memory address as an operand to reference that memory location. */ | |
854 | #define PRINT_OPERAND_ADDRESS(STREAM, X) \ | |
855 | score_print_operand_address (STREAM, X) | |
856 | ||
857 | /* By default on the S+core, external symbols do not have an underscore | |
858 | prepended. */ | |
859 | #define USER_LABEL_PREFIX "" | |
860 | ||
861 | /* This is how to output an insn to push a register on the stack. */ | |
862 | #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ | |
863 | do { \ | |
864 | fprintf (STREAM, "\tpush! %s,[%s]\n", \ | |
865 | reg_names[REGNO], \ | |
866 | reg_names[STACK_POINTER_REGNUM]); \ | |
867 | } while (0) | |
868 | ||
869 | /* This is how to output an insn to pop a register from the stack. */ | |
870 | #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \ | |
871 | do { \ | |
872 | fprintf (STREAM, "\tpop! %s,[%s]\n", \ | |
873 | reg_names[REGNO], \ | |
874 | reg_names[STACK_POINTER_REGNUM]); \ | |
875 | } while (0) | |
876 | ||
877 | /* Output of Dispatch Tables. */ | |
878 | /* This is how to output an element of a case-vector. We can make the | |
879 | entries PC-relative in GP-relative when .gp(d)word is supported. */ | |
880 | #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ | |
881 | do { \ | |
882 | if (flag_pic) \ | |
883 | fprintf (STREAM, "\t.gpword %sL%d\n", LOCAL_LABEL_PREFIX, VALUE); \ | |
884 | else \ | |
885 | fprintf (STREAM, "\t.word %sL%d\n", LOCAL_LABEL_PREFIX, VALUE); \ | |
886 | } while (0) | |
887 | ||
888 | /* This is how to output an element of a case-vector that is absolute. */ | |
889 | #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ | |
890 | fprintf (STREAM, "\t.word %sL%d\n", LOCAL_LABEL_PREFIX, VALUE) | |
891 | ||
892 | /* Assembler Commands for Exception Regions */ | |
893 | /* Since the S+core is encoded in the least-significant bit | |
894 | of the address, mask it off return addresses for purposes of | |
895 | finding exception handling regions. */ | |
896 | #define MASK_RETURN_ADDR constm1_rtx | |
897 | ||
898 | /* Assembler Commands for Alignment */ | |
899 | /* This is how to output an assembler line to advance the location | |
900 | counter by SIZE bytes. */ | |
901 | #undef ASM_OUTPUT_SKIP | |
902 | #define ASM_OUTPUT_SKIP(STREAM, SIZE) \ | |
903 | fprintf (STREAM, "\t.space\t"HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)) | |
904 | ||
905 | /* This is how to output an assembler line | |
906 | that says to advance the location counter | |
907 | to a multiple of 2**LOG bytes. */ | |
908 | #define ASM_OUTPUT_ALIGN(STREAM, LOG) \ | |
909 | fprintf (STREAM, "\t.align\t%d\n", (LOG)) | |
910 | ||
911 | /* Macros Affecting All Debugging Formats. */ | |
912 | #ifndef PREFERRED_DEBUGGING_TYPE | |
913 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
914 | #endif | |
915 | ||
916 | /* Specific Options for DBX Output. */ | |
917 | #define DBX_DEBUGGING_INFO 1 | |
918 | ||
919 | /* By default, turn on GDB extensions. */ | |
920 | #define DEFAULT_GDB_EXTENSIONS 1 | |
921 | ||
922 | #define DBX_CONTIN_LENGTH 0 | |
923 | ||
924 | /* File Names in DBX Format. */ | |
925 | #define DWARF2_DEBUGGING_INFO 1 | |
926 | ||
927 | /* The DWARF 2 CFA column which tracks the return address. */ | |
928 | #define DWARF_FRAME_RETURN_COLUMN 3 | |
929 | ||
930 | /* Specify the machine mode that this machine uses | |
931 | for the index in the tablejump instruction. */ | |
932 | #define CASE_VECTOR_MODE SImode | |
933 | ||
934 | /* Define if operations between registers always perform the operation | |
935 | on the full register even if a narrower mode is specified. */ | |
936 | #define WORD_REGISTER_OPERATIONS | |
937 | ||
938 | /* All references are zero extended. */ | |
939 | #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND | |
940 | ||
941 | /* Define if loading short immediate values into registers sign extends. */ | |
942 | #define SHORT_IMMEDIATES_SIGN_EXTEND | |
943 | ||
944 | /* Max number of bytes we can move from memory to memory | |
945 | in one reasonably fast instruction. */ | |
946 | #define MOVE_MAX 4 | |
947 | ||
948 | /* Define this to be nonzero if shift instructions ignore all but the low-order | |
949 | few bits. */ | |
950 | #define SHIFT_COUNT_TRUNCATED 1 | |
951 | ||
952 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits | |
953 | is done just by pretending it is already truncated. */ | |
954 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
955 | ||
956 | /* Specify the machine mode that pointers have. | |
957 | After generation of rtl, the compiler makes no further distinction | |
958 | between pointers and any other objects of this machine mode. */ | |
959 | #define Pmode SImode | |
960 | ||
961 | /* Give call MEMs SImode since it is the "most permissive" mode | |
962 | for 32-bit targets. */ | |
963 | #define FUNCTION_MODE Pmode | |
964 | ||
965 | struct extern_list GTY ((chain_next ("%h.next"))) | |
966 | { | |
967 | struct extern_list *next; /* next external */ | |
968 | const char *name; /* name of the external */ | |
969 | int size; /* size in bytes */ | |
970 | }; | |
971 | ||
99fc2502 | 972 | extern GTY (()) struct extern_list *extern_head; |