annotate gcc/config/nios2/nios2.h @ 131:84e7813d76e9

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