]>
Commit | Line | Data |
---|---|---|
e430824f | 1 | /* Definitions of target machine for Altera Nios II. |
cbe34bb5 | 2 | Copyright (C) 2012-2017 Free Software Foundation, Inc. |
e430824f CLT |
3 | Contributed by Jonah Graham (jgraham@altera.com), |
4 | Will Reece (wreece@altera.com), and Jeff DaSilva (jdasilva@altera.com). | |
5 | Contributed by Mentor Graphics, Inc. | |
6 | ||
7 | This file is part of GCC. | |
8 | ||
9 | GCC is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU General Public License as published | |
11 | by the Free Software Foundation; either version 3, or (at your | |
12 | option) any later version. | |
13 | ||
14 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
17 | License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GCC; see the file COPYING3. If not see | |
21 | <http://www.gnu.org/licenses/>. */ | |
22 | ||
23 | #ifndef GCC_NIOS2_H | |
24 | #define GCC_NIOS2_H | |
25 | ||
77c50d73 SL |
26 | /* Indicate R2 ISA level support. */ |
27 | #define TARGET_ARCH_R2 (nios2_arch_option == ARCH_R2) | |
28 | ||
e430824f CLT |
29 | /* FPU insn codes declared here. */ |
30 | #include "config/nios2/nios2-opts.h" | |
31 | ||
32 | /* Define built-in preprocessor macros. */ | |
33 | #define TARGET_CPU_CPP_BUILTINS() \ | |
34 | do \ | |
35 | { \ | |
36 | builtin_define_std ("NIOS2"); \ | |
37 | builtin_define_std ("nios2"); \ | |
38 | if (TARGET_BIG_ENDIAN) \ | |
39 | builtin_define_std ("nios2_big_endian"); \ | |
40 | else \ | |
41 | builtin_define_std ("nios2_little_endian"); \ | |
77c50d73 SL |
42 | builtin_define_with_int_value ( \ |
43 | "__nios2_arch__", (int) nios2_arch_option); \ | |
44 | } \ | |
e430824f CLT |
45 | while (0) |
46 | ||
47 | /* We're little endian, unless otherwise specified by defining | |
48 | BIG_ENDIAN_FLAG. */ | |
49 | #ifndef TARGET_ENDIAN_DEFAULT | |
50 | # define TARGET_ENDIAN_DEFAULT 0 | |
51 | #endif | |
52 | ||
53 | /* Default target_flags if no switches specified. */ | |
54 | #ifndef TARGET_DEFAULT | |
55 | # define TARGET_DEFAULT (MASK_HAS_MUL | TARGET_ENDIAN_DEFAULT) | |
56 | #endif | |
57 | ||
77c50d73 SL |
58 | #define OPTION_DEFAULT_SPECS \ |
59 | {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" } | |
60 | ||
e430824f CLT |
61 | #define CC1_SPEC "%{G*}" |
62 | ||
63 | #if TARGET_ENDIAN_DEFAULT == 0 | |
77c50d73 | 64 | # define ASM_SPEC "%{!meb:-EL} %{meb:-EB} %{march=*:-march=%*}" |
e430824f CLT |
65 | # define LINK_SPEC_ENDIAN "%{!meb:-EL} %{meb:-EB}" |
66 | # define MULTILIB_DEFAULTS { "EL" } | |
67 | #else | |
77c50d73 | 68 | # define ASM_SPEC "%{!mel:-EB} %{mel:-EL} %{march=*:-march=%*}" |
e430824f CLT |
69 | # define LINK_SPEC_ENDIAN "%{!mel:-EB} %{mel:-EL}" |
70 | # define MULTILIB_DEFAULTS { "EB" } | |
71 | #endif | |
72 | ||
73 | #define LINK_SPEC LINK_SPEC_ENDIAN \ | |
74 | " %{shared:-shared} \ | |
75 | %{static:-Bstatic}" | |
76 | ||
77 | ||
78 | /* Storage layout. */ | |
79 | ||
80 | #define DEFAULT_SIGNED_CHAR 1 | |
81 | #define BITS_BIG_ENDIAN 0 | |
82 | #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0) | |
83 | #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0) | |
e430824f CLT |
84 | #define BITS_PER_WORD 32 |
85 | #define UNITS_PER_WORD 4 | |
86 | #define POINTER_SIZE 32 | |
87 | #define BIGGEST_ALIGNMENT 32 | |
88 | #define STRICT_ALIGNMENT 1 | |
89 | #define FUNCTION_BOUNDARY 32 | |
90 | #define PARM_BOUNDARY 32 | |
91 | #define STACK_BOUNDARY 32 | |
92 | #define PREFERRED_STACK_BOUNDARY 32 | |
93 | #define MAX_FIXED_MODE_SIZE 64 | |
94 | ||
95 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ | |
96 | ((TREE_CODE (EXP) == STRING_CST) \ | |
97 | && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) | |
98 | ||
3bbbe009 SL |
99 | #define LABEL_ALIGN(LABEL) nios2_label_align (LABEL) |
100 | ||
e430824f CLT |
101 | /* Layout of source language data types. */ |
102 | ||
103 | #define INT_TYPE_SIZE 32 | |
104 | #define SHORT_TYPE_SIZE 16 | |
105 | #define LONG_TYPE_SIZE 32 | |
106 | #define LONG_LONG_TYPE_SIZE 64 | |
107 | #define FLOAT_TYPE_SIZE 32 | |
108 | #define DOUBLE_TYPE_SIZE 64 | |
109 | #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE | |
110 | ||
111 | #undef SIZE_TYPE | |
112 | #define SIZE_TYPE "unsigned int" | |
113 | ||
114 | #undef PTRDIFF_TYPE | |
115 | #define PTRDIFF_TYPE "int" | |
116 | ||
117 | ||
118 | /* Basic characteristics of Nios II registers: | |
119 | ||
120 | Regno Name | |
121 | 0 r0 zero always zero | |
122 | 1 r1 at Assembler Temporary | |
123 | 2-3 r2-r3 Return Location | |
124 | 4-7 r4-r7 Register Arguments | |
125 | 8-15 r8-r15 Caller Saved Registers | |
126 | 16-22 r16-r22 Callee Saved Registers | |
127 | 22 r22 Global Offset Table pointer (Linux ABI only) | |
128 | 23 r23 Thread pointer (Linux ABI only) | |
129 | 24 r24 et Exception Temporary | |
130 | 25 r25 bt Breakpoint Temporary | |
131 | 26 r26 gp Global Pointer | |
132 | 27 r27 sp Stack Pointer | |
133 | 28 r28 fp Frame Pointer | |
134 | 29 r29 ea Exception Return Address | |
135 | 30 r30 ba Breakpoint Return Address | |
136 | 31 r31 ra Return Address | |
137 | ||
138 | 32 ctl0 status | |
139 | 33 ctl1 estatus STATUS saved by exception | |
140 | 34 ctl2 bstatus STATUS saved by break | |
141 | 35 ctl3 ipri Interrupt Priority Mask | |
142 | 36 ctl4 ecause Exception Cause | |
143 | ||
144 | 37 pc Not an actual register | |
145 | ||
146 | 38 fake_fp Fake Frame Pointer (always eliminated) | |
147 | 39 fake_ap Fake Argument Pointer (always eliminated) | |
148 | 40 First Pseudo Register | |
149 | ||
150 | In addition, r12 is used as the static chain register and r13, r14, and r15 | |
151 | are clobbered by PLT code sequences. | |
152 | ||
153 | The definitions for all the hard register numbers are located in nios2.md. | |
154 | */ | |
155 | ||
156 | #define FIXED_REGISTERS \ | |
157 | { \ | |
158 | /* +0 1 2 3 4 5 6 7 8 9 */ \ | |
159 | /* 0 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
160 | /* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | |
161 | /* 20 */ 0, 0, TARGET_LINUX_ABI, TARGET_LINUX_ABI, 1, 1, 1, 1, 0, 1, \ | |
162 | /* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
163 | } | |
164 | ||
165 | /* Call used == caller saved + fixed regs + args + ret vals. */ | |
166 | #define CALL_USED_REGISTERS \ | |
167 | { \ | |
168 | /* +0 1 2 3 4 5 6 7 8 9 */ \ | |
169 | /* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
170 | /* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \ | |
171 | /* 20 */ 0, 0, TARGET_LINUX_ABI, TARGET_LINUX_ABI, 1, 1, 1, 1, 0, 1, \ | |
172 | /* 30 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
173 | } | |
174 | ||
3bbbe009 SL |
175 | /* Order in which to allocate registers. Each register must be |
176 | listed once. This is the default ordering for R1 and non-CDX R2 | |
177 | code. For CDX, we overwrite this in ADJUST_REG_ALLOC_ORDER. */ | |
178 | #define REG_ALLOC_ORDER \ | |
179 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \ | |
180 | 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, \ | |
181 | 37, 38, 39 } | |
182 | ||
183 | #define ADJUST_REG_ALLOC_ORDER nios2_adjust_reg_alloc_order () | |
184 | ||
185 | /* Caller-save costs can be less emphasized under R2 CDX, where we can | |
186 | use push.n/pop.n. */ | |
187 | #define HONOR_REG_ALLOC_ORDER (TARGET_HAS_CDX) | |
188 | ||
e430824f CLT |
189 | /* Register Classes. */ |
190 | ||
191 | enum reg_class | |
192 | { | |
193 | NO_REGS, | |
194 | SIB_REGS, | |
3c8c9f0d | 195 | IJMP_REGS, |
e430824f CLT |
196 | GP_REGS, |
197 | ALL_REGS, | |
198 | LIM_REG_CLASSES | |
199 | }; | |
200 | ||
201 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
202 | ||
203 | #define REG_CLASS_NAMES \ | |
204 | { "NO_REGS", \ | |
205 | "SIB_REGS", \ | |
3c8c9f0d | 206 | "IJMP_REGS", \ |
e430824f CLT |
207 | "GP_REGS", \ |
208 | "ALL_REGS" } | |
209 | ||
210 | #define GENERAL_REGS ALL_REGS | |
211 | ||
212 | #define REG_CLASS_CONTENTS \ | |
213 | { \ | |
3c8c9f0d CLT |
214 | /* NO_REGS */ { 0, 0}, \ |
215 | /* SIB_REGS */ { 0xfe0c, 0}, \ | |
216 | /* IJMP_REGS */ { 0x7fffffff, 0}, \ | |
217 | /* GP_REGS */ {~0, 0}, \ | |
218 | /* ALL_REGS */ {~0,~0} \ | |
e430824f CLT |
219 | } |
220 | ||
221 | ||
222 | #define GP_REG_P(REGNO) ((unsigned)(REGNO) <= LAST_GP_REG) | |
223 | #define REGNO_REG_CLASS(REGNO) (GP_REG_P (REGNO) ? GP_REGS : ALL_REGS) | |
224 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
225 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) | |
226 | ||
3bbbe009 SL |
227 | #define CDX_REG_P(REGNO) \ |
228 | ((REGNO) == 16 || (REGNO) == 17 || (2 <= (REGNO) && (REGNO) <= 7)) | |
229 | ||
e430824f CLT |
230 | /* Tests for various kinds of constants used in the Nios II port. */ |
231 | ||
232 | #define SMALL_INT(X) ((unsigned HOST_WIDE_INT)(X) + 0x8000 < 0x10000) | |
42e6ab74 | 233 | #define SMALL_INT12(X) ((unsigned HOST_WIDE_INT)(X) + 0x800 < 0x1000) |
e430824f CLT |
234 | #define SMALL_INT_UNSIGNED(X) ((X) >= 0 && (X) < 0x10000) |
235 | #define UPPER16_INT(X) (((X) & 0xffff) == 0) | |
236 | #define SHIFT_INT(X) ((X) >= 0 && (X) <= 31) | |
237 | #define RDWRCTL_INT(X) ((X) >= 0 && (X) <= 31) | |
238 | #define CUSTOM_INSN_OPCODE(X) ((X) >= 0 && (X) <= 255) | |
3bbbe009 SL |
239 | #define ANDCLEAR_INT(X) \ |
240 | (((X) & 0xffff) == 0xffff || (((X) >> 16) & 0xffff) == 0xffff) | |
e430824f CLT |
241 | |
242 | /* Say that the epilogue uses the return address register. Note that | |
243 | in the case of sibcalls, the values "used by the epilogue" are | |
244 | considered live at the start of the called function. */ | |
245 | #define EPILOGUE_USES(REGNO) (epilogue_completed && (REGNO) == RA_REGNO) | |
246 | ||
247 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
248 | the stack pointer does not matter. The value is tested only in | |
249 | functions that have frame pointers. | |
250 | No definition is equivalent to always zero. */ | |
251 | ||
252 | #define EXIT_IGNORE_STACK 1 | |
253 | ||
254 | /* Trampolines use a 5-instruction sequence. */ | |
255 | #define TRAMPOLINE_SIZE 20 | |
256 | ||
257 | /* Stack layout. */ | |
62f9f30b | 258 | #define STACK_GROWS_DOWNWARD 1 |
e430824f CLT |
259 | #define STARTING_FRAME_OFFSET 0 |
260 | #define FIRST_PARM_OFFSET(FUNDECL) 0 | |
261 | ||
262 | /* Before the prologue, RA lives in r31. */ | |
240930c4 | 263 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RA_REGNO) |
e430824f CLT |
264 | #define RETURN_ADDR_RTX(C,F) nios2_get_return_address (C) |
265 | ||
266 | #define DWARF_FRAME_RETURN_COLUMN RA_REGNO | |
267 | ||
268 | /* The CFA includes the pretend args. */ | |
269 | #define ARG_POINTER_CFA_OFFSET(FNDECL) \ | |
270 | (gcc_assert ((FNDECL) == current_function_decl), \ | |
271 | FIRST_PARM_OFFSET (FNDECL) + crtl->args.pretend_args_size) | |
272 | ||
273 | /* Frame/arg pointer elimination settings. */ | |
274 | #define ELIMINABLE_REGS \ | |
275 | {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
276 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ | |
277 | { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | |
278 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} | |
279 | ||
280 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
281 | (OFFSET) = nios2_initial_elimination_offset ((FROM), (TO)) | |
282 | ||
283 | /* Calling convention definitions. */ | |
284 | typedef struct nios2_args | |
285 | { | |
286 | int regs_used; | |
287 | } CUMULATIVE_ARGS; | |
288 | ||
289 | #define NUM_ARG_REGS (LAST_ARG_REGNO - FIRST_ARG_REGNO + 1) | |
290 | ||
291 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ | |
292 | do { (CUM).regs_used = 0; } while (0) | |
293 | ||
e430824f | 294 | #define PAD_VARARGS_DOWN \ |
76b0cbf8 | 295 | (targetm.calls.function_arg_padding (TYPE_MODE (type), type) == PAD_DOWNWARD) |
e430824f CLT |
296 | |
297 | #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ | |
298 | (nios2_block_reg_padding ((MODE), (TYPE), (FIRST))) | |
299 | ||
300 | #define FUNCTION_ARG_REGNO_P(REGNO) \ | |
301 | ((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO) | |
302 | ||
303 | /* Passing function arguments on stack. */ | |
304 | #define PUSH_ARGS 0 | |
305 | #define ACCUMULATE_OUTGOING_ARGS 1 | |
306 | ||
307 | /* We define TARGET_RETURN_IN_MEMORY, so set to zero. */ | |
308 | #define DEFAULT_PCC_STRUCT_RETURN 0 | |
309 | ||
310 | /* Profiling. */ | |
311 | #define PROFILE_BEFORE_PROLOGUE | |
312 | #define NO_PROFILE_COUNTERS 1 | |
313 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
314 | nios2_function_profiler ((FILE), (LABELNO)) | |
315 | ||
316 | /* Addressing modes. */ | |
317 | ||
318 | #define CONSTANT_ADDRESS_P(X) \ | |
319 | (CONSTANT_P (X) && memory_address_p (SImode, X)) | |
320 | ||
321 | #define MAX_REGS_PER_ADDRESS 1 | |
322 | #define BASE_REG_CLASS ALL_REGS | |
323 | #define INDEX_REG_CLASS NO_REGS | |
324 | ||
325 | #define REGNO_OK_FOR_BASE_P(REGNO) nios2_regno_ok_for_base_p ((REGNO), true) | |
326 | #define REGNO_OK_FOR_INDEX_P(REGNO) 0 | |
327 | ||
328 | /* Describing Relative Costs of Operations. */ | |
329 | #define MOVE_MAX 4 | |
330 | #define SLOW_BYTE_ACCESS 1 | |
331 | ||
332 | /* It is as good to call a constant function address as to call an address | |
333 | kept in a register. */ | |
1e8552c2 | 334 | #define NO_FUNCTION_CSE 1 |
e430824f CLT |
335 | |
336 | /* Position independent code. */ | |
337 | ||
338 | #define PIC_OFFSET_TABLE_REGNUM 22 | |
339 | #define LEGITIMATE_PIC_OPERAND_P(X) nios2_legitimate_pic_operand_p (X) | |
340 | ||
341 | /* Define output assembler language. */ | |
342 | ||
343 | #define ASM_APP_ON "#APP\n" | |
344 | #define ASM_APP_OFF "#NO_APP\n" | |
345 | ||
346 | #define ASM_COMMENT_START "# " | |
347 | ||
348 | #define GLOBAL_ASM_OP "\t.global\t" | |
349 | ||
350 | #define REGISTER_NAMES \ | |
351 | { \ | |
352 | "zero", \ | |
353 | "at", \ | |
354 | "r2", \ | |
355 | "r3", \ | |
356 | "r4", \ | |
357 | "r5", \ | |
358 | "r6", \ | |
359 | "r7", \ | |
360 | "r8", \ | |
361 | "r9", \ | |
362 | "r10", \ | |
363 | "r11", \ | |
364 | "r12", \ | |
365 | "r13", \ | |
366 | "r14", \ | |
367 | "r15", \ | |
368 | "r16", \ | |
369 | "r17", \ | |
370 | "r18", \ | |
371 | "r19", \ | |
372 | "r20", \ | |
373 | "r21", \ | |
374 | "r22", \ | |
375 | "r23", \ | |
376 | "et", \ | |
377 | "bt", \ | |
378 | "gp", \ | |
379 | "sp", \ | |
380 | "fp", \ | |
381 | "ta", \ | |
382 | "ba", \ | |
383 | "ra", \ | |
384 | "status", \ | |
385 | "estatus", \ | |
386 | "bstatus", \ | |
387 | "ipri", \ | |
388 | "ecause", \ | |
389 | "pc", \ | |
390 | "fake_fp", \ | |
391 | "fake_ap", \ | |
392 | } | |
393 | ||
394 | #define ADDITIONAL_REGISTER_NAMES \ | |
395 | { \ | |
396 | {"r0", 0}, \ | |
397 | {"r1", 1}, \ | |
398 | {"r24", 24}, \ | |
399 | {"r25", 25}, \ | |
400 | {"r26", 26}, \ | |
401 | {"r27", 27}, \ | |
402 | {"r28", 28}, \ | |
403 | {"r29", 29}, \ | |
404 | {"r30", 30}, \ | |
405 | {"r31", 31} \ | |
406 | } | |
407 | ||
408 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
409 | do \ | |
410 | { \ | |
411 | fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ | |
412 | fprintf (FILE, ".L%u\n", (unsigned) (VALUE)); \ | |
413 | } \ | |
414 | while (0) | |
415 | ||
416 | #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL)\ | |
417 | do \ | |
418 | { \ | |
419 | fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), STREAM); \ | |
420 | fprintf (STREAM, ".L%u-.L%u\n", (unsigned) (VALUE), (unsigned) (REL)); \ | |
421 | } \ | |
422 | while (0) | |
423 | ||
424 | /* Section directives. */ | |
425 | ||
426 | /* Output before read-only data. */ | |
427 | #define TEXT_SECTION_ASM_OP "\t.section\t.text" | |
428 | ||
429 | /* Output before writable data. */ | |
430 | #define DATA_SECTION_ASM_OP "\t.section\t.data" | |
431 | ||
432 | /* Output before uninitialized data. */ | |
433 | #define BSS_SECTION_ASM_OP "\t.section\t.bss" | |
434 | ||
435 | /* Output before 'small' uninitialized data. */ | |
436 | #define SBSS_SECTION_ASM_OP "\t.section\t.sbss" | |
437 | ||
438 | #ifndef IN_LIBGCC2 | |
439 | /* Default the definition of "small data" to 8 bytes. */ | |
440 | extern unsigned HOST_WIDE_INT nios2_section_threshold; | |
441 | #endif | |
442 | ||
443 | #define NIOS2_DEFAULT_GVALUE 8 | |
444 | ||
445 | /* This says how to output assembler code to declare an | |
446 | uninitialized external linkage data object. Under SVR4, | |
447 | the linker seems to want the alignment of data objects | |
448 | to depend on their types. We do exactly that here. */ | |
449 | #undef COMMON_ASM_OP | |
450 | #define COMMON_ASM_OP "\t.comm\t" | |
451 | ||
452 | #define ASM_OUTPUT_ALIGN(FILE, LOG) \ | |
453 | do { \ | |
454 | fprintf ((FILE), "%s%d\n", ALIGN_ASM_OP, (LOG)); \ | |
455 | } while (0) | |
456 | ||
457 | #undef ASM_OUTPUT_ALIGNED_COMMON | |
458 | #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ | |
459 | do \ | |
460 | { \ | |
461 | fprintf ((FILE), "%s", COMMON_ASM_OP); \ | |
462 | assemble_name ((FILE), (NAME)); \ | |
16998094 | 463 | fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), \ |
e430824f CLT |
464 | (ALIGN) / BITS_PER_UNIT); \ |
465 | } \ | |
466 | while (0) | |
467 | ||
468 | ||
469 | /* This says how to output assembler code to declare an | |
470 | uninitialized internal linkage data object. Under SVR4, | |
471 | the linker seems to want the alignment of data objects | |
472 | to depend on their types. We do exactly that here. */ | |
473 | ||
474 | #undef ASM_OUTPUT_ALIGNED_LOCAL | |
475 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
476 | do { \ | |
477 | if ((SIZE) <= nios2_section_threshold) \ | |
478 | switch_to_section (sbss_section); \ | |
479 | else \ | |
480 | switch_to_section (bss_section); \ | |
481 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ | |
482 | if (!flag_inhibit_size_directive) \ | |
483 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ | |
484 | ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ | |
485 | ASM_OUTPUT_LABEL(FILE, NAME); \ | |
486 | ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ | |
487 | } while (0) | |
488 | ||
489 | /* Put the jump tables in .text because when using position-independent code, | |
490 | Nios II elf has no relocation that can represent arbitrary differences | |
491 | between symbols in different sections. */ | |
492 | #define JUMP_TABLES_IN_TEXT_SECTION 1 | |
493 | ||
494 | /* Exception handling. */ | |
495 | ||
496 | /* Describe __builtin_eh_return. */ | |
497 | #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, LAST_RETVAL_REGNO) | |
498 | #define EH_RETURN_DATA_REGNO(N) ((N) <= (LAST_ARG_REGNO - FIRST_ARG_REGNO) \ | |
499 | ? (N) + FIRST_ARG_REGNO : INVALID_REGNUM) | |
500 | ||
501 | /* Nios II has no appropriate relocations for a 32-bit PC-relative or | |
502 | section-relative pointer encoding. This therefore always chooses an | |
503 | absolute representation for pointers. An unfortunate consequence of | |
504 | this is that ld complains about the absolute fde encoding when linking | |
505 | with -shared or -fpie, but the warning is harmless and there seems to | |
506 | be no good way to suppress it. */ | |
507 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ | |
508 | (flag_pic ? DW_EH_PE_aligned : DW_EH_PE_sdata4) | |
509 | ||
510 | /* Misc. parameters. */ | |
511 | ||
512 | #define STORE_FLAG_VALUE 1 | |
513 | #define Pmode SImode | |
514 | #define FUNCTION_MODE QImode | |
515 | ||
516 | #define CASE_VECTOR_MODE Pmode | |
517 | ||
e430824f CLT |
518 | #define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND) |
519 | ||
9e11bfef | 520 | #define WORD_REGISTER_OPERATIONS 1 |
e430824f CLT |
521 | |
522 | #endif /* GCC_NIOS2_H */ |