annotate gcc/config/epiphany/epiphany.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Definitions of target machine for GNU compiler, Argonaut EPIPHANY cpu.
kono
parents:
diff changeset
2 Copyright (C) 1994-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3 Contributed by Embecosm on behalf of Adapteva, Inc.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #ifndef GCC_EPIPHANY_H
kono
parents:
diff changeset
22 #define GCC_EPIPHANY_H
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 #undef LINK_SPEC
kono
parents:
diff changeset
25 #undef STARTFILE_SPEC
kono
parents:
diff changeset
26 #undef ENDFILE_SPEC
kono
parents:
diff changeset
27 #undef SIZE_TYPE
kono
parents:
diff changeset
28 #undef PTRDIFF_TYPE
kono
parents:
diff changeset
29 #undef WCHAR_TYPE
kono
parents:
diff changeset
30 #undef WCHAR_TYPE_SIZE
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* Names to predefine in the preprocessor for this target machine. */
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 ("__epiphany__"); \
kono
parents:
diff changeset
37 builtin_define ("__little_endian__"); \
kono
parents:
diff changeset
38 builtin_define_with_int_value ("__EPIPHANY_STACK_OFFSET__", \
kono
parents:
diff changeset
39 epiphany_stack_offset); \
kono
parents:
diff changeset
40 builtin_assert ("cpu=epiphany"); \
kono
parents:
diff changeset
41 builtin_assert ("machine=epiphany"); \
kono
parents:
diff changeset
42 } while (0)
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 /* Pick up the libgloss library. One day we may do this by linker script, but
kono
parents:
diff changeset
45 for now its static.
kono
parents:
diff changeset
46 libgloss might use errno/__errno, which might not have been needed when we
kono
parents:
diff changeset
47 saw libc the first time, so link with libc a second time. */
kono
parents:
diff changeset
48 #undef LIB_SPEC
kono
parents:
diff changeset
49 #define LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}} -lepiphany %{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 #define LINK_SPEC "%{v}"
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 #define STARTFILE_SPEC "%{!shared:crt0.o%s} crti.o%s " \
kono
parents:
diff changeset
54 "%{mfp-mode=int:crtint.o%s} %{mfp-mode=truncate:crtrunc.o%s} " \
kono
parents:
diff changeset
55 "%{m1reg-r43:crtm1reg-r43.o%s} %{m1reg-r63:crtm1reg-r63.o%s} " \
kono
parents:
diff changeset
56 "crtbegin.o%s"
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 #define EPIPHANY_LIBRARY_EXTRA_SPEC \
kono
parents:
diff changeset
61 "-ffixed-r40 -ffixed-r41 -ffixed-r42 -ffixed-r43"
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 /* In the "spec:" rule,, t-epiphany changes this to epiphany_library_stub_spec
kono
parents:
diff changeset
64 and epiphany_library_extra_spec, respectively. */
kono
parents:
diff changeset
65 #define EXTRA_SPECS \
kono
parents:
diff changeset
66 { "epiphany_library_extra_spec", "" }, \
kono
parents:
diff changeset
67 { "epiphany_library_build_spec", EPIPHANY_LIBRARY_EXTRA_SPEC }, \
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 #define DRIVER_SELF_SPECS " %(epiphany_library_extra_spec) "
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 #undef USER_LABEL_PREFIX
kono
parents:
diff changeset
72 #define USER_LABEL_PREFIX "_"
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
kono
parents:
diff changeset
75 asm (SECTION_OP "\n\
kono
parents:
diff changeset
76 mov r0,%low(" USER_LABEL_PREFIX #FUNC")\n\
kono
parents:
diff changeset
77 movt r0,%high(" USER_LABEL_PREFIX #FUNC")\n\
kono
parents:
diff changeset
78 jalr r0\n\
kono
parents:
diff changeset
79 .text");
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 #if 0 /* We would like to use Posix for profiling, but the simulator
kono
parents:
diff changeset
82 interface still lacks mkdir. */
kono
parents:
diff changeset
83 #define TARGET_POSIX_IO
kono
parents:
diff changeset
84 #endif
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 /* Target machine storage layout. */
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 /* Define this if most significant bit is lowest numbered
kono
parents:
diff changeset
89 in instructions that operate on numbered bit-fields. */
kono
parents:
diff changeset
90 #define BITS_BIG_ENDIAN 0
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 /* Define this if most significant byte of a word is the lowest numbered. */
kono
parents:
diff changeset
93 #define BYTES_BIG_ENDIAN 0
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 /* Define this if most significant word of a multiword number is the lowest
kono
parents:
diff changeset
96 numbered. */
kono
parents:
diff changeset
97 #define WORDS_BIG_ENDIAN 0
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 /* Width of a word, in units (bytes). */
kono
parents:
diff changeset
100 #define UNITS_PER_WORD 4
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 /* Define this macro if it is advisable to hold scalars in registers
kono
parents:
diff changeset
103 in a wider mode than that declared by the program. In such cases,
kono
parents:
diff changeset
104 the value is constrained to be within the bounds of the declared
kono
parents:
diff changeset
105 type, but kept valid in the wider mode. The signedness of the
kono
parents:
diff changeset
106 extension may differ from that of the type. */
kono
parents:
diff changeset
107 /* It is far faster to zero extend chars than to sign extend them */
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
kono
parents:
diff changeset
110 if (GET_MODE_CLASS (MODE) == MODE_INT \
kono
parents:
diff changeset
111 && GET_MODE_SIZE (MODE) < 4) \
kono
parents:
diff changeset
112 { \
kono
parents:
diff changeset
113 if (MODE == QImode) \
kono
parents:
diff changeset
114 UNSIGNEDP = 1; \
kono
parents:
diff changeset
115 else if (MODE == HImode) \
kono
parents:
diff changeset
116 UNSIGNEDP = 1; \
kono
parents:
diff changeset
117 (MODE) = SImode; \
kono
parents:
diff changeset
118 }
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
kono
parents:
diff changeset
121 #define PARM_BOUNDARY 32
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 /* Boundary (in *bits*) on which stack pointer should be aligned. */
kono
parents:
diff changeset
124 #define STACK_BOUNDARY 64
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 /* ALIGN FRAMES on word boundaries */
kono
parents:
diff changeset
127 #define EPIPHANY_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 /* Allocation boundary (in *bits*) for the code of a function. */
kono
parents:
diff changeset
130 #define FUNCTION_BOUNDARY 32
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 /* Every structure's size must be a multiple of this. */
kono
parents:
diff changeset
133 #define STRUCTURE_SIZE_BOUNDARY 8
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 /* A bit-field declared as `int' forces `int' alignment for the struct. */
kono
parents:
diff changeset
136 #define PCC_BITFIELD_TYPE_MATTERS 1
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 /* No data type wants to be aligned rounder than this. */
kono
parents:
diff changeset
139 /* This is bigger than currently necessary for the EPIPHANY. If 8 byte floats are
kono
parents:
diff changeset
140 ever added it's not clear whether they'll need such alignment or not. For
kono
parents:
diff changeset
141 now we assume they will. We can always relax it if necessary but the
kono
parents:
diff changeset
142 reverse isn't true. */
kono
parents:
diff changeset
143 #define BIGGEST_ALIGNMENT 64
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 /* The best alignment to use in cases where we have a choice. */
kono
parents:
diff changeset
146 #define FASTEST_ALIGNMENT 64
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 #define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 /* Make arrays of chars dword-aligned for the same reasons.
kono
parents:
diff changeset
151 Also, align arrays of SImode items. */
kono
parents:
diff changeset
152 #define DATA_ALIGNMENT(TYPE, ALIGN) \
kono
parents:
diff changeset
153 (TREE_CODE (TYPE) == ARRAY_TYPE \
kono
parents:
diff changeset
154 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
kono
parents:
diff changeset
155 && (ALIGN) < FASTEST_ALIGNMENT \
kono
parents:
diff changeset
156 ? FASTEST_ALIGNMENT \
kono
parents:
diff changeset
157 : (TREE_CODE (TYPE) == ARRAY_TYPE \
kono
parents:
diff changeset
158 && TYPE_MODE (TREE_TYPE (TYPE)) == SImode \
kono
parents:
diff changeset
159 && (ALIGN) < FASTEST_ALIGNMENT) \
kono
parents:
diff changeset
160 ? FASTEST_ALIGNMENT \
kono
parents:
diff changeset
161 : (ALIGN))
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 /* Set this nonzero if move instructions will actually fail to work
kono
parents:
diff changeset
164 when given unaligned data. */
kono
parents:
diff changeset
165 /* On the EPIPHANY the lower address bits are masked to 0 as necessary. The chip
kono
parents:
diff changeset
166 won't croak when given an unaligned address, but the insn will still fail
kono
parents:
diff changeset
167 to produce the correct result. */
kono
parents:
diff changeset
168 #define STRICT_ALIGNMENT 1
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 /* layout_type overrides our ADJUST_ALIGNMENT settings from epiphany-modes.def
kono
parents:
diff changeset
171 for vector modes, so we have to override it back. */
kono
parents:
diff changeset
172 #define ROUND_TYPE_ALIGN(TYPE, MANGLED_ALIGN, SPECIFIED_ALIGN) \
kono
parents:
diff changeset
173 (TREE_CODE (TYPE) == VECTOR_TYPE && !TYPE_USER_ALIGN (TYPE) \
kono
parents:
diff changeset
174 && SPECIFIED_ALIGN <= GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
kono
parents:
diff changeset
175 ? GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
kono
parents:
diff changeset
176 : ((TREE_CODE (TYPE) == RECORD_TYPE \
kono
parents:
diff changeset
177 || TREE_CODE (TYPE) == UNION_TYPE \
kono
parents:
diff changeset
178 || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
kono
parents:
diff changeset
179 && !TYPE_PACKED (TYPE)) \
kono
parents:
diff changeset
180 ? epiphany_special_round_type_align ((TYPE), (MANGLED_ALIGN), \
kono
parents:
diff changeset
181 (SPECIFIED_ALIGN)) \
kono
parents:
diff changeset
182 : MAX ((MANGLED_ALIGN), (SPECIFIED_ALIGN)))
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
kono
parents:
diff changeset
185 epiphany_adjust_field_align((TYPE), (COMPUTED))
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 /* Layout of source language data types. */
kono
parents:
diff changeset
188
kono
parents:
diff changeset
189 #define SHORT_TYPE_SIZE 16
kono
parents:
diff changeset
190 #define INT_TYPE_SIZE 32
kono
parents:
diff changeset
191 #define LONG_TYPE_SIZE 32
kono
parents:
diff changeset
192 #define LONG_LONG_TYPE_SIZE 64
kono
parents:
diff changeset
193 #define FLOAT_TYPE_SIZE 32
kono
parents:
diff changeset
194 #define DOUBLE_TYPE_SIZE 64
kono
parents:
diff changeset
195 #define LONG_DOUBLE_TYPE_SIZE 64
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 /* Define this as 1 if `char' should by default be signed; else as 0. */
kono
parents:
diff changeset
198 #define DEFAULT_SIGNED_CHAR 0
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 #define SIZE_TYPE "long unsigned int"
kono
parents:
diff changeset
201 #define PTRDIFF_TYPE "long int"
kono
parents:
diff changeset
202 #define WCHAR_TYPE "unsigned int"
kono
parents:
diff changeset
203 #define WCHAR_TYPE_SIZE BITS_PER_WORD
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 /* Standard register usage. */
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 /* Number of actual hardware registers.
kono
parents:
diff changeset
208 The hardware registers are assigned numbers for the compiler
kono
parents:
diff changeset
209 from 0 to just below FIRST_PSEUDO_REGISTER.
kono
parents:
diff changeset
210 All registers that the compiler knows about must be given numbers,
kono
parents:
diff changeset
211 even those that are not normally considered general registers. */
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 #define FIRST_PSEUDO_REGISTER 78
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 /* General purpose registers. */
kono
parents:
diff changeset
217 #define GPR_FIRST 0 /* First gpr */
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 #define PIC_REGNO (GPR_FIRST + 28) /* PIC register. */
kono
parents:
diff changeset
220 #define GPR_LAST (GPR_FIRST + 63) /* Last gpr */
kono
parents:
diff changeset
221 #define CORE_CONTROL_FIRST CONFIG_REGNUM
kono
parents:
diff changeset
222 #define CORE_CONTROL_LAST IRET_REGNUM
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 #define GPR_P(R) IN_RANGE (R, GPR_FIRST, GPR_LAST)
kono
parents:
diff changeset
225 #define GPR_OR_AP_P(R) (GPR_P (R) || (R) == ARG_POINTER_REGNUM)
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 #define GPR_OR_PSEUDO_P(R) (GPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
kono
parents:
diff changeset
228 #define GPR_AP_OR_PSEUDO_P(R) (GPR_OR_AP_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 #define FIXED_REGISTERS \
kono
parents:
diff changeset
231 { /* Integer Registers */ \
kono
parents:
diff changeset
232 0, 0, 0, 0, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \
kono
parents:
diff changeset
233 0, 0, 0, 0, 0, 1, 0, 0, /* 008-015, gr8 - gr15 */ \
kono
parents:
diff changeset
234 0, 0, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \
kono
parents:
diff changeset
235 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
kono
parents:
diff changeset
236 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr39 */ \
kono
parents:
diff changeset
237 0, 0, 0, 0, 0, 0, 0, 0, /* 040-047, gr40 - gr47 */ \
kono
parents:
diff changeset
238 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \
kono
parents:
diff changeset
239 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \
kono
parents:
diff changeset
240 /* Other registers */ \
kono
parents:
diff changeset
241 1, /* 64 AP - fake arg ptr */ \
kono
parents:
diff changeset
242 1, /* soft frame pointer */ \
kono
parents:
diff changeset
243 1, /* CC_REGNUM - integer conditions */\
kono
parents:
diff changeset
244 1, /* CCFP_REGNUM - fp conditions */\
kono
parents:
diff changeset
245 1, 1, 1, 1, 1, 1, /* Core Control Registers. */ \
kono
parents:
diff changeset
246 1, 1, 1, /* FP_{NEAREST,...}_REGNUM */\
kono
parents:
diff changeset
247 1, /* UNKNOWN_REGNUM - placeholder. */\
kono
parents:
diff changeset
248 }
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
kono
parents:
diff changeset
251 general) by function calls as well as for fixed registers. This macro
kono
parents:
diff changeset
252 therefore identifies the registers that are not available for general
kono
parents:
diff changeset
253 allocation of values that must live across function calls.
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
kono
parents:
diff changeset
256 saves it on function entry and restores it on function exit, if the register
kono
parents:
diff changeset
257 is used within the function. */
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 #define CALL_USED_REGISTERS \
kono
parents:
diff changeset
260 { /* Integer Registers */ \
kono
parents:
diff changeset
261 1, 1, 1, 1, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \
kono
parents:
diff changeset
262 0, 0, 0, 0, 1, 1, 1, 0, /* 008-015, gr8 - gr15 */ \
kono
parents:
diff changeset
263 1, 1, 1, 1, 1, 1, 1, 1, /* 016-023, gr16 - gr23 */ \
kono
parents:
diff changeset
264 1, 1, 1, 1, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
kono
parents:
diff changeset
265 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr38 */ \
kono
parents:
diff changeset
266 0, 0, 0, 0, 1, 1, 1, 1, /* 040-047, gr40 - gr47 */ \
kono
parents:
diff changeset
267 1, 1, 1, 1, 1, 1, 1, 1, /* 048-055, gr48 - gr55 */ \
kono
parents:
diff changeset
268 1, 1, 1, 1, 1, 1, 1, 1, /* 056-063, gr56 - gr63 */ \
kono
parents:
diff changeset
269 1, /* 64 AP - fake arg ptr */ \
kono
parents:
diff changeset
270 1, /* soft frame pointer */ \
kono
parents:
diff changeset
271 1, /* 66 CC_REGNUM */ \
kono
parents:
diff changeset
272 1, /* 67 CCFP_REGNUM */ \
kono
parents:
diff changeset
273 1, 1, 1, 1, 1, 1, /* Core Control Registers. */ \
kono
parents:
diff changeset
274 1, 1, 1, /* FP_{NEAREST,...}_REGNUM */\
kono
parents:
diff changeset
275 1, /* UNKNOWN_REGNUM - placeholder. */\
kono
parents:
diff changeset
276 }
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 #define REG_ALLOC_ORDER \
kono
parents:
diff changeset
279 { \
kono
parents:
diff changeset
280 0, 1, 2, 3, /* Caller-saved 'small' registers. */ \
kono
parents:
diff changeset
281 12, /* Caller-saved unpaired register. */ \
kono
parents:
diff changeset
282 /* Caller-saved registers. */ \
kono
parents:
diff changeset
283 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \
kono
parents:
diff changeset
284 44, 45, 46, 47, \
kono
parents:
diff changeset
285 48, 49, 50, 51, 52, 53, 54, 55, \
kono
parents:
diff changeset
286 56, 57, 58, 59, 60, 61, 62, 63, \
kono
parents:
diff changeset
287 4, 5, 6, 7, /* Calle-saved 'small' registers. */ \
kono
parents:
diff changeset
288 15, /* Calle-saved unpaired register. */ \
kono
parents:
diff changeset
289 8, 9, 10, 11, /* Calle-saved registers. */ \
kono
parents:
diff changeset
290 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, \
kono
parents:
diff changeset
291 14, 13, /* Link register, stack pointer. */ \
kono
parents:
diff changeset
292 /* Can't allocate, but must name these... */ \
kono
parents:
diff changeset
293 28, 29, 30, 31, \
kono
parents:
diff changeset
294 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77 \
kono
parents:
diff changeset
295 }
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 #define HARD_REGNO_RENAME_OK(SRC, DST) epiphany_regno_rename_ok (SRC, DST)
kono
parents:
diff changeset
298
kono
parents:
diff changeset
299 /* Register classes and constants. */
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 /* Define the classes of registers for register constraints in the
kono
parents:
diff changeset
302 machine description. Also define ranges of constants.
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 One of the classes must always be named ALL_REGS and include all hard regs.
kono
parents:
diff changeset
305 If there is more than one class, another class must be named NO_REGS
kono
parents:
diff changeset
306 and contain no registers.
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308 The name GENERAL_REGS must be the name of a class (or an alias for
kono
parents:
diff changeset
309 another name such as ALL_REGS). This is the class of registers
kono
parents:
diff changeset
310 that is allowed by "g" or "r" in a register constraint.
kono
parents:
diff changeset
311 Also, registers outside this class are allocated only when
kono
parents:
diff changeset
312 instructions express preferences for them.
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 The classes must be numbered in nondecreasing order; that is,
kono
parents:
diff changeset
315 a larger-numbered class must never be contained completely
kono
parents:
diff changeset
316 in a smaller-numbered class.
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 For any two classes, it is very desirable that there be another
kono
parents:
diff changeset
319 class that represents their union.
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 It is important that any condition codes have class NO_REGS.
kono
parents:
diff changeset
322 See `register_operand'. */
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 enum reg_class {
kono
parents:
diff changeset
325 NO_REGS,
kono
parents:
diff changeset
326 LR_REGS,
kono
parents:
diff changeset
327 SHORT_INSN_REGS,
kono
parents:
diff changeset
328 SIBCALL_REGS,
kono
parents:
diff changeset
329 GENERAL_REGS,
kono
parents:
diff changeset
330 CORE_CONTROL_REGS,
kono
parents:
diff changeset
331 ALL_REGS,
kono
parents:
diff changeset
332 LIM_REG_CLASSES
kono
parents:
diff changeset
333 };
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 /* Give names of register classes as strings for dump file. */
kono
parents:
diff changeset
338 #define REG_CLASS_NAMES \
kono
parents:
diff changeset
339 { \
kono
parents:
diff changeset
340 "NO_REGS", \
kono
parents:
diff changeset
341 "LR_REGS", \
kono
parents:
diff changeset
342 "SHORT_INSN_REGS", \
kono
parents:
diff changeset
343 "SIBCALL_REGS", \
kono
parents:
diff changeset
344 "GENERAL_REGS", \
kono
parents:
diff changeset
345 "CORE_CONTROL_REGS", \
kono
parents:
diff changeset
346 "ALL_REGS" \
kono
parents:
diff changeset
347 }
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 /* Define which registers fit in which classes.
kono
parents:
diff changeset
350 This is an initializer for a vector of HARD_REG_SET
kono
parents:
diff changeset
351 of length N_REG_CLASSES. */
kono
parents:
diff changeset
352
kono
parents:
diff changeset
353 #define REG_CLASS_CONTENTS \
kono
parents:
diff changeset
354 { /* r0-r31 r32-r63 ap/sfp/cc1/cc2/iret/status */ \
kono
parents:
diff changeset
355 { 0x00000000,0x00000000,0x0}, /* NO_REGS */ \
kono
parents:
diff changeset
356 { 0x00004000,0x00000000,0x0}, /* LR_REGS */ \
kono
parents:
diff changeset
357 { 0x000000ff,0x00000000,0x0}, /* SHORT_INSN_REGS */ \
kono
parents:
diff changeset
358 { 0xffff100f,0xffffff00,0x0}, /* SIBCALL_REGS */ \
kono
parents:
diff changeset
359 { 0xffffffff,0xffffffff,0x0003}, /* GENERAL_REGS */ \
kono
parents:
diff changeset
360 { 0x00000000,0x00000000,0x03f0}, /* CORE_CONTROL_REGS */ \
kono
parents:
diff changeset
361 { 0xffffffff,0xffffffff,0x3fff}, /* ALL_REGS */ \
kono
parents:
diff changeset
362 }
kono
parents:
diff changeset
363
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 /* The same information, inverted:
kono
parents:
diff changeset
366 Return the class number of the smallest class containing
kono
parents:
diff changeset
367 reg number REGNO. This could be a conditional expression
kono
parents:
diff changeset
368 or could index an array. */
kono
parents:
diff changeset
369 extern enum reg_class epiphany_regno_reg_class[FIRST_PSEUDO_REGISTER];
kono
parents:
diff changeset
370 #define REGNO_REG_CLASS(REGNO) \
kono
parents:
diff changeset
371 (epiphany_regno_reg_class[REGNO])
kono
parents:
diff changeset
372
kono
parents:
diff changeset
373 /* The class value for index registers, and the one for base regs. */
kono
parents:
diff changeset
374 #define BASE_REG_CLASS GENERAL_REGS
kono
parents:
diff changeset
375 #define INDEX_REG_CLASS GENERAL_REGS
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 /* These assume that REGNO is a hard or pseudo reg number.
kono
parents:
diff changeset
378 They give nonzero only if REGNO is a hard reg of the suitable class
kono
parents:
diff changeset
379 or a pseudo reg currently allocated to a suitable hard reg.
kono
parents:
diff changeset
380 Since they use reg_renumber, they are safe only once reg_renumber
kono
parents:
diff changeset
381 has been allocated, which happens in reginfo.c during register
kono
parents:
diff changeset
382 allocation. */
kono
parents:
diff changeset
383 #define REGNO_OK_FOR_BASE_P(REGNO) \
kono
parents:
diff changeset
384 ((REGNO) < FIRST_PSEUDO_REGISTER || (unsigned) reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)
kono
parents:
diff changeset
385 #define REGNO_OK_FOR_INDEX_P(REGNO) \
kono
parents:
diff changeset
386 ((REGNO) < FIRST_PSEUDO_REGISTER || (unsigned) reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389
kono
parents:
diff changeset
390 /* Given an rtx X being reloaded into a reg required to be
kono
parents:
diff changeset
391 in class CLASS, return the class of reg to actually use.
kono
parents:
diff changeset
392 In general this is just CLASS; but on some machines
kono
parents:
diff changeset
393 in some cases it is preferable to use a more restrictive class. */
kono
parents:
diff changeset
394 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
kono
parents:
diff changeset
395 (CLASS)
kono
parents:
diff changeset
396
kono
parents:
diff changeset
397 /* Return the maximum number of consecutive registers
kono
parents:
diff changeset
398 needed to represent mode MODE in a register of class CLASS. */
kono
parents:
diff changeset
399 #define CLASS_MAX_NREGS(CLASS, MODE) \
kono
parents:
diff changeset
400 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
kono
parents:
diff changeset
401
kono
parents:
diff changeset
402 /* The letters I, J, K, L, M, N, O, P in a register constraint string
kono
parents:
diff changeset
403 can be used to stand for particular ranges of immediate operands.
kono
parents:
diff changeset
404 This macro defines what the ranges are.
kono
parents:
diff changeset
405 C is the letter, and VALUE is a constant value.
kono
parents:
diff changeset
406 Return 1 if VALUE is in the range specified by C. */
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 /* 'I' is used for 16 bit unsigned.
kono
parents:
diff changeset
409 'Cal' is used for long immediates (32 bits)
kono
parents:
diff changeset
410 'K' is used for any constant up to 5 bits.
kono
parents:
diff changeset
411 'L' is used for any 11 bit signed.
kono
parents:
diff changeset
412 */
kono
parents:
diff changeset
413
kono
parents:
diff changeset
414 #define IMM16(X) (IN_RANGE ((X), 0, 0xFFFF))
kono
parents:
diff changeset
415 #define SIMM16(X) (IN_RANGE ((X), -65536, 65535))
kono
parents:
diff changeset
416 #define SIMM11(X) (IN_RANGE ((X), -1024, 1023))
kono
parents:
diff changeset
417 #define IMM5(X) (IN_RANGE ((X), 0, 0x1F))
kono
parents:
diff changeset
418
kono
parents:
diff changeset
419 typedef struct GTY (()) machine_function
kono
parents:
diff changeset
420 {
kono
parents:
diff changeset
421 unsigned args_parsed : 1;
kono
parents:
diff changeset
422 unsigned pretend_args_odd : 1;
kono
parents:
diff changeset
423 unsigned lr_clobbered : 1;
kono
parents:
diff changeset
424 unsigned control_use_inserted : 1;
kono
parents:
diff changeset
425 unsigned lr_slot_known : 1;
kono
parents:
diff changeset
426 unsigned sw_entities_processed : 6;
kono
parents:
diff changeset
427 long lr_slot_offset;
kono
parents:
diff changeset
428 rtx and_mask;
kono
parents:
diff changeset
429 rtx or_mask;
kono
parents:
diff changeset
430 unsigned unknown_mode_uses;
kono
parents:
diff changeset
431 unsigned unknown_mode_sets;
kono
parents:
diff changeset
432 } machine_function_t;
kono
parents:
diff changeset
433
kono
parents:
diff changeset
434 #define MACHINE_FUNCTION(fun) (fun)->machine
kono
parents:
diff changeset
435
kono
parents:
diff changeset
436 #define INIT_EXPANDERS epiphany_init_expanders ()
kono
parents:
diff changeset
437
kono
parents:
diff changeset
438 /* Stack layout and stack pointer usage. */
kono
parents:
diff changeset
439
kono
parents:
diff changeset
440 /* Define this macro if pushing a word onto the stack moves the stack
kono
parents:
diff changeset
441 pointer to a smaller address. */
kono
parents:
diff changeset
442 #define STACK_GROWS_DOWNWARD 1
kono
parents:
diff changeset
443
kono
parents:
diff changeset
444 /* Define this to nonzero if the nominal address of the stack frame
kono
parents:
diff changeset
445 is at the high-address end of the local variables;
kono
parents:
diff changeset
446 that is, each additional local variable allocated
kono
parents:
diff changeset
447 goes at a more negative offset in the frame. */
kono
parents:
diff changeset
448 #define FRAME_GROWS_DOWNWARD 1
kono
parents:
diff changeset
449
kono
parents:
diff changeset
450 /* Offset from the stack pointer register to the first location at which
kono
parents:
diff changeset
451 outgoing arguments are placed. */
kono
parents:
diff changeset
452 #define STACK_POINTER_OFFSET epiphany_stack_offset
kono
parents:
diff changeset
453
kono
parents:
diff changeset
454 /* Offset of first parameter from the argument pointer register value. */
kono
parents:
diff changeset
455 /* 4 bytes for each of previous fp, return address, and previous gp.
kono
parents:
diff changeset
456 4 byte reserved area for future considerations. */
kono
parents:
diff changeset
457 #define FIRST_PARM_OFFSET(FNDECL) \
kono
parents:
diff changeset
458 (epiphany_stack_offset \
kono
parents:
diff changeset
459 + (MACHINE_FUNCTION (DECL_STRUCT_FUNCTION (FNDECL))->pretend_args_odd \
kono
parents:
diff changeset
460 ? 4 : 0))
kono
parents:
diff changeset
461
kono
parents:
diff changeset
462 #define INCOMING_FRAME_SP_OFFSET epiphany_stack_offset
kono
parents:
diff changeset
463
kono
parents:
diff changeset
464 /* Register to use for pushing function arguments. */
kono
parents:
diff changeset
465 #define STACK_POINTER_REGNUM GPR_SP
kono
parents:
diff changeset
466
kono
parents:
diff changeset
467 /* Base register for access to local variables of the function. */
kono
parents:
diff changeset
468 #define HARD_FRAME_POINTER_REGNUM GPR_FP
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 /* Register in which static-chain is passed to a function. This must
kono
parents:
diff changeset
471 not be a register used by the prologue. */
kono
parents:
diff changeset
472 #define STATIC_CHAIN_REGNUM GPR_IP
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474 /* Define the offset between two registers, one to be eliminated, and the other
kono
parents:
diff changeset
475 its replacement, at the start of a routine. */
kono
parents:
diff changeset
476
kono
parents:
diff changeset
477 #define ELIMINABLE_REGS \
kono
parents:
diff changeset
478 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
kono
parents:
diff changeset
479 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
kono
parents:
diff changeset
480 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
kono
parents:
diff changeset
481 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
kono
parents:
diff changeset
482 }
kono
parents:
diff changeset
483
kono
parents:
diff changeset
484 /* Define the offset between two registers, one to be eliminated, and the other
kono
parents:
diff changeset
485 its replacement, at the start of a routine. */
kono
parents:
diff changeset
486
kono
parents:
diff changeset
487 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
kono
parents:
diff changeset
488 ((OFFSET) = epiphany_initial_elimination_offset ((FROM), (TO)))
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 /* Function argument passing. */
kono
parents:
diff changeset
491
kono
parents:
diff changeset
492 /* If defined, the maximum amount of space required for outgoing
kono
parents:
diff changeset
493 arguments will be computed and placed into the variable
kono
parents:
diff changeset
494 `current_function_outgoing_args_size'. No space will be pushed
kono
parents:
diff changeset
495 onto the stack for each call; instead, the function prologue should
kono
parents:
diff changeset
496 increase the stack frame size by this amount. */
kono
parents:
diff changeset
497 #define ACCUMULATE_OUTGOING_ARGS 1
kono
parents:
diff changeset
498
kono
parents:
diff changeset
499 /* Define a data type for recording info about an argument list
kono
parents:
diff changeset
500 during the scan of that argument list. This data type should
kono
parents:
diff changeset
501 hold all necessary information about the function itself
kono
parents:
diff changeset
502 and about the args processed so far, enough to enable macros
kono
parents:
diff changeset
503 such as FUNCTION_ARG to determine where the next arg should go. */
kono
parents:
diff changeset
504 #define CUMULATIVE_ARGS int
kono
parents:
diff changeset
505
kono
parents:
diff changeset
506 /* Initialize a variable CUM of type CUMULATIVE_ARGS
kono
parents:
diff changeset
507 for a call to a function whose data type is FNTYPE.
kono
parents:
diff changeset
508 For a library call, FNTYPE is 0. */
kono
parents:
diff changeset
509 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
kono
parents:
diff changeset
510 ((CUM) = 0)
kono
parents:
diff changeset
511
kono
parents:
diff changeset
512 /* The number of registers used for parameter passing. Local to this file. */
kono
parents:
diff changeset
513 #define MAX_EPIPHANY_PARM_REGS 4
kono
parents:
diff changeset
514
kono
parents:
diff changeset
515 /* 1 if N is a possible register number for function argument passing. */
kono
parents:
diff changeset
516 #define FUNCTION_ARG_REGNO_P(N) \
kono
parents:
diff changeset
517 ((unsigned) (N) < MAX_EPIPHANY_PARM_REGS)
kono
parents:
diff changeset
518
kono
parents:
diff changeset
519 /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
kono
parents:
diff changeset
520 a reg. This includes arguments that have to be passed by reference as the
kono
parents:
diff changeset
521 pointer to them is passed in a reg if one is available (and that is what
kono
parents:
diff changeset
522 we're given).
kono
parents:
diff changeset
523 This macro is only used in this file. */
kono
parents:
diff changeset
524 /* We must use partial argument passing because of the chosen mode
kono
parents:
diff changeset
525 of varargs handling. */
kono
parents:
diff changeset
526 #define PASS_IN_REG_P(CUM, MODE, TYPE) \
kono
parents:
diff changeset
527 (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < MAX_EPIPHANY_PARM_REGS)
kono
parents:
diff changeset
528
kono
parents:
diff changeset
529 /* Tell GCC to use TARGET_RETURN_IN_MEMORY. */
kono
parents:
diff changeset
530 #define DEFAULT_PCC_STRUCT_RETURN 0
kono
parents:
diff changeset
531
kono
parents:
diff changeset
532 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
kono
parents:
diff changeset
533 the stack pointer does not matter. The value is tested only in
kono
parents:
diff changeset
534 functions that have frame pointers.
kono
parents:
diff changeset
535 No definition is equivalent to always zero. */
kono
parents:
diff changeset
536 #define EXIT_IGNORE_STACK 1
kono
parents:
diff changeset
537
kono
parents:
diff changeset
538 #define EPILOGUE_USES(REGNO) epiphany_epilogue_uses (REGNO)
kono
parents:
diff changeset
539
kono
parents:
diff changeset
540 /* Output assembler code to FILE to increment profiler label # LABELNO
kono
parents:
diff changeset
541 for profiling a function entry. */
kono
parents:
diff changeset
542 #define FUNCTION_PROFILER(FILE, LABELNO)
kono
parents:
diff changeset
543
kono
parents:
diff changeset
544 /* Given an rtx for the frame pointer,
kono
parents:
diff changeset
545 return an rtx for the address of the frame. */
kono
parents:
diff changeset
546 #define FRAME_ADDR_RTX(frame) \
kono
parents:
diff changeset
547 ((frame) == hard_frame_pointer_rtx ? arg_pointer_rtx : NULL)
kono
parents:
diff changeset
548
kono
parents:
diff changeset
549 #define EPIPHANY_RETURN_REGNO \
kono
parents:
diff changeset
550 ((current_function_decl != NULL \
kono
parents:
diff changeset
551 && epiphany_is_interrupt_p (current_function_decl)) \
kono
parents:
diff changeset
552 ? IRET_REGNUM : GPR_LR)
kono
parents:
diff changeset
553 /* This is not only for dwarf unwind info, but also for the benefit of
kono
parents:
diff changeset
554 df-scan.c to tell it that LR is live at the function start. */
kono
parents:
diff changeset
555 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, EPIPHANY_RETURN_REGNO)
kono
parents:
diff changeset
556
kono
parents:
diff changeset
557 /* However, we haven't implemented the rest needed for dwarf2 unwind info. */
kono
parents:
diff changeset
558 #define DWARF2_UNWIND_INFO 0
kono
parents:
diff changeset
559
kono
parents:
diff changeset
560 #define RETURN_ADDR_RTX(count, frame) \
kono
parents:
diff changeset
561 (count ? NULL_RTX \
kono
parents:
diff changeset
562 : gen_rtx_UNSPEC (SImode, gen_rtvec (1, const0_rtx), UNSPEC_RETURN_ADDR))
kono
parents:
diff changeset
563
kono
parents:
diff changeset
564 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (EPIPHANY_RETURN_REGNO)
kono
parents:
diff changeset
565
kono
parents:
diff changeset
566 /* Trampolines.
kono
parents:
diff changeset
567 An epiphany trampoline looks like this:
kono
parents:
diff changeset
568 mov r16,%low(fnaddr)
kono
parents:
diff changeset
569 movt r16,%high(fnaddr)
kono
parents:
diff changeset
570 mov ip,%low(cxt)
kono
parents:
diff changeset
571 movt ip,%high(cxt)
kono
parents:
diff changeset
572 jr r16 */
kono
parents:
diff changeset
573
kono
parents:
diff changeset
574 /* Length in units of the trampoline for entering a nested function. */
kono
parents:
diff changeset
575 #define TRAMPOLINE_SIZE 20
kono
parents:
diff changeset
576
kono
parents:
diff changeset
577 /* Addressing modes, and classification of registers for them. */
kono
parents:
diff changeset
578
kono
parents:
diff changeset
579 /* Maximum number of registers that can appear in a valid memory address. */
kono
parents:
diff changeset
580 #define MAX_REGS_PER_ADDRESS 2
kono
parents:
diff changeset
581
kono
parents:
diff changeset
582 /* We have post_modify (load/store with update). */
kono
parents:
diff changeset
583 #define HAVE_POST_INCREMENT TARGET_POST_INC
kono
parents:
diff changeset
584 #define HAVE_POST_DECREMENT TARGET_POST_INC
kono
parents:
diff changeset
585 #define HAVE_POST_MODIFY_DISP TARGET_POST_MODIFY
kono
parents:
diff changeset
586 #define HAVE_POST_MODIFY_REG TARGET_POST_MODIFY
kono
parents:
diff changeset
587
kono
parents:
diff changeset
588 /* Currently, the only users of the USE_*CREMENT macros are
kono
parents:
diff changeset
589 move_by_pieces / store_by_pieces_1 . We don't want them to use
kono
parents:
diff changeset
590 POST_MODIFY modes, because we got ample addressing range for the
kono
parents:
diff changeset
591 reg+offset addressing mode; besides, there are short index+offset loads,
kono
parents:
diff changeset
592 but the only short post-modify load uses POST_MODIFY_REG.
kono
parents:
diff changeset
593 Moreover, using auto-increment in move_by_pieces from structure copying
kono
parents:
diff changeset
594 in the prologue causes confused debug output.
kono
parents:
diff changeset
595 If another pass starts using these macros where the use of these
kono
parents:
diff changeset
596 addressing modes would make more sense, we can try checking the
kono
parents:
diff changeset
597 current pass. */
kono
parents:
diff changeset
598 #define USE_LOAD_POST_INCREMENT(MODE) 0
kono
parents:
diff changeset
599 #define USE_LOAD_POST_DECREMENT(MODE) 0
kono
parents:
diff changeset
600 #define USE_STORE_POST_INCREMENT(MODE) 0
kono
parents:
diff changeset
601 #define USE_STORE_POST_DECREMENT(MODE) 0
kono
parents:
diff changeset
602
kono
parents:
diff changeset
603 /* Recognize any constant value that is a valid address. */
kono
parents:
diff changeset
604 #define CONSTANT_ADDRESS_P(X) \
kono
parents:
diff changeset
605 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
kono
parents:
diff changeset
606 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
kono
parents:
diff changeset
607
kono
parents:
diff changeset
608 #define RTX_OK_FOR_OFFSET_P(MODE, X) \
kono
parents:
diff changeset
609 RTX_OK_FOR_OFFSET_1 (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
kono
parents:
diff changeset
610 && epiphany_vect_align == 4 \
kono
parents:
diff changeset
611 ? (machine_mode) SImode : (machine_mode) (MODE), X)
kono
parents:
diff changeset
612 #define RTX_OK_FOR_OFFSET_1(MODE, X) \
kono
parents:
diff changeset
613 (GET_CODE (X) == CONST_INT \
kono
parents:
diff changeset
614 && !(INTVAL (X) & (GET_MODE_SIZE (MODE) - 1)) \
kono
parents:
diff changeset
615 && INTVAL (X) >= -2047 * (int) GET_MODE_SIZE (MODE) \
kono
parents:
diff changeset
616 && INTVAL (X) <= 2047 * (int) GET_MODE_SIZE (MODE))
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 /* Frame offsets cannot be evaluated till the frame pointer is eliminated. */
kono
parents:
diff changeset
619 #define RTX_FRAME_OFFSET_P(X) \
kono
parents:
diff changeset
620 ((X) == frame_pointer_rtx \
kono
parents:
diff changeset
621 || (GET_CODE (X) == PLUS && XEXP ((X), 0) == frame_pointer_rtx \
kono
parents:
diff changeset
622 && CONST_INT_P (XEXP ((X), 1))))
kono
parents:
diff changeset
623
kono
parents:
diff changeset
624 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
kono
parents:
diff changeset
625 return the mode to be used for the comparison. */
kono
parents:
diff changeset
626 #define SELECT_CC_MODE(OP, X, Y) \
kono
parents:
diff changeset
627 epiphany_select_cc_mode (OP, X, Y)
kono
parents:
diff changeset
628
kono
parents:
diff changeset
629 /* Return nonzero if SELECT_CC_MODE will never return MODE for a
kono
parents:
diff changeset
630 floating point inequality comparison. */
kono
parents:
diff changeset
631
kono
parents:
diff changeset
632 #define REVERSE_CONDITION(CODE, MODE) \
kono
parents:
diff changeset
633 ((MODE) == CC_FPmode || (MODE) == CC_FP_EQmode || (MODE) == CC_FP_GTEmode \
kono
parents:
diff changeset
634 || (MODE) == CC_FP_ORDmode || (MODE) == CC_FP_UNEQmode \
kono
parents:
diff changeset
635 ? reverse_condition_maybe_unordered (CODE) \
kono
parents:
diff changeset
636 : (MODE) == CCmode ? reverse_condition (CODE) \
kono
parents:
diff changeset
637 : UNKNOWN)
kono
parents:
diff changeset
638
kono
parents:
diff changeset
639 /* We can reverse all CCmodes with REVERSE_CONDITION. */
kono
parents:
diff changeset
640 #define REVERSIBLE_CC_MODE(MODE) \
kono
parents:
diff changeset
641 ((MODE) == CCmode || (MODE) == CC_FPmode || (MODE) == CC_FP_EQmode \
kono
parents:
diff changeset
642 || (MODE) == CC_FP_GTEmode || (MODE) == CC_FP_ORDmode \
kono
parents:
diff changeset
643 || (MODE) == CC_FP_UNEQmode)
kono
parents:
diff changeset
644
kono
parents:
diff changeset
645 /* Costs. */
kono
parents:
diff changeset
646
kono
parents:
diff changeset
647 /* The cost of a branch insn. */
kono
parents:
diff changeset
648 /* ??? What's the right value here? Branches are certainly more
kono
parents:
diff changeset
649 expensive than reg->reg moves. */
kono
parents:
diff changeset
650 #define BRANCH_COST(speed_p, predictable_p) \
kono
parents:
diff changeset
651 (speed_p ? epiphany_branch_cost : 1)
kono
parents:
diff changeset
652
kono
parents:
diff changeset
653 /* Nonzero if access to memory by bytes is slow and undesirable.
kono
parents:
diff changeset
654 For RISC chips, it means that access to memory by bytes is no
kono
parents:
diff changeset
655 better than access by words when possible, so grab a whole word
kono
parents:
diff changeset
656 and maybe make use of that. */
kono
parents:
diff changeset
657 #define SLOW_BYTE_ACCESS 1
kono
parents:
diff changeset
658
kono
parents:
diff changeset
659 /* Define this macro if it is as good or better to call a constant
kono
parents:
diff changeset
660 function address than to call an address kept in a register. */
kono
parents:
diff changeset
661 /* On the EPIPHANY, calling through registers is slow. */
kono
parents:
diff changeset
662 #define NO_FUNCTION_CSE 1
kono
parents:
diff changeset
663
kono
parents:
diff changeset
664 /* Section selection. */
kono
parents:
diff changeset
665 /* WARNING: These section names also appear in dwarf2out.c. */
kono
parents:
diff changeset
666
kono
parents:
diff changeset
667 #define TEXT_SECTION_ASM_OP "\t.section .text"
kono
parents:
diff changeset
668 #define DATA_SECTION_ASM_OP "\t.section .data"
kono
parents:
diff changeset
669
kono
parents:
diff changeset
670 #undef READONLY_DATA_SECTION_ASM_OP
kono
parents:
diff changeset
671 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
kono
parents:
diff changeset
672
kono
parents:
diff changeset
673 #define BSS_SECTION_ASM_OP "\t.section .bss"
kono
parents:
diff changeset
674
kono
parents:
diff changeset
675 /* Define this macro if jump tables (for tablejump insns) should be
kono
parents:
diff changeset
676 output in the text section, along with the assembler instructions.
kono
parents:
diff changeset
677 Otherwise, the readonly data section is used.
kono
parents:
diff changeset
678 This macro is irrelevant if there is no separate readonly data section. */
kono
parents:
diff changeset
679 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
kono
parents:
diff changeset
680
kono
parents:
diff changeset
681 /* PIC */
kono
parents:
diff changeset
682
kono
parents:
diff changeset
683 /* The register number of the register used to address a table of static
kono
parents:
diff changeset
684 data addresses in memory. In some cases this register is defined by a
kono
parents:
diff changeset
685 processor's ``application binary interface'' (ABI). When this macro
kono
parents:
diff changeset
686 is defined, RTL is generated for this register once, as with the stack
kono
parents:
diff changeset
687 pointer and frame pointer registers. If this macro is not defined, it
kono
parents:
diff changeset
688 is up to the machine-dependent files to allocate such a register (if
kono
parents:
diff changeset
689 necessary). */
kono
parents:
diff changeset
690 #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? PIC_REGNO : INVALID_REGNUM)
kono
parents:
diff changeset
691
kono
parents:
diff changeset
692 /* Control the assembler format that we output. */
kono
parents:
diff changeset
693
kono
parents:
diff changeset
694 /* A C string constant describing how to begin a comment in the target
kono
parents:
diff changeset
695 assembler language. The compiler assumes that the comment will
kono
parents:
diff changeset
696 end at the end of the line. */
kono
parents:
diff changeset
697 #define ASM_COMMENT_START ";"
kono
parents:
diff changeset
698
kono
parents:
diff changeset
699 /* Output to assembler file text saying following lines
kono
parents:
diff changeset
700 may contain character constants, extra white space, comments, etc. */
kono
parents:
diff changeset
701 #define ASM_APP_ON ""
kono
parents:
diff changeset
702
kono
parents:
diff changeset
703 /* Output to assembler file text saying following lines
kono
parents:
diff changeset
704 no longer contain unusual constructs. */
kono
parents:
diff changeset
705 #define ASM_APP_OFF ""
kono
parents:
diff changeset
706
kono
parents:
diff changeset
707 /* Globalizing directive for a label. */
kono
parents:
diff changeset
708 #define GLOBAL_ASM_OP "\t.global\t"
kono
parents:
diff changeset
709
kono
parents:
diff changeset
710 /* How to refer to registers in assembler output.
kono
parents:
diff changeset
711 This sequence is indexed by compiler's hard-register-number (see above). */
kono
parents:
diff changeset
712
kono
parents:
diff changeset
713 #define REGISTER_NAMES \
kono
parents:
diff changeset
714 { \
kono
parents:
diff changeset
715 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
kono
parents:
diff changeset
716 "r8", "r9", "r10", "fp", "ip", "sp", "lr", "r15", \
kono
parents:
diff changeset
717 "r16", "r17","r18", "r19", "r20", "r21", "r22", "r23", \
kono
parents:
diff changeset
718 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
kono
parents:
diff changeset
719 "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
kono
parents:
diff changeset
720 "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \
kono
parents:
diff changeset
721 "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
kono
parents:
diff changeset
722 "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", \
kono
parents:
diff changeset
723 "ap", "sfp", "cc1", "cc2", \
kono
parents:
diff changeset
724 "config", "status", "lc", "ls", "le", "iret", \
kono
parents:
diff changeset
725 "fp_near", "fp_trunc", "fp_anyfp", "unknown" \
kono
parents:
diff changeset
726 }
kono
parents:
diff changeset
727
kono
parents:
diff changeset
728 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
kono
parents:
diff changeset
729 epiphany_final_prescan_insn (INSN, OPVEC, NOPERANDS)
kono
parents:
diff changeset
730
kono
parents:
diff changeset
731 #define LOCAL_LABEL_PREFIX "."
kono
parents:
diff changeset
732
kono
parents:
diff changeset
733 /* A C expression which evaluates to true if CODE is a valid
kono
parents:
diff changeset
734 punctuation character for use in the `PRINT_OPERAND' macro. */
kono
parents:
diff changeset
735 extern char epiphany_punct_chars[256];
kono
parents:
diff changeset
736 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
kono
parents:
diff changeset
737 epiphany_punct_chars[(unsigned char) (CHAR)]
kono
parents:
diff changeset
738
kono
parents:
diff changeset
739 /* This is how to output an element of a case-vector that is absolute. */
kono
parents:
diff changeset
740 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
kono
parents:
diff changeset
741 do { \
kono
parents:
diff changeset
742 if (CASE_VECTOR_MODE == Pmode) \
kono
parents:
diff changeset
743 asm_fprintf ((FILE), "\t.word %LL%d\n", (VALUE)); \
kono
parents:
diff changeset
744 else \
kono
parents:
diff changeset
745 asm_fprintf ((FILE), "\t.short %LL%d\n", (VALUE)); \
kono
parents:
diff changeset
746 } while (0)
kono
parents:
diff changeset
747
kono
parents:
diff changeset
748 /* This is how to output an element of a case-vector that is relative. */
kono
parents:
diff changeset
749 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
kono
parents:
diff changeset
750 do { \
kono
parents:
diff changeset
751 if (CASE_VECTOR_MODE == Pmode) \
kono
parents:
diff changeset
752 asm_fprintf ((FILE), "\t.word"); \
kono
parents:
diff changeset
753 else \
kono
parents:
diff changeset
754 asm_fprintf ((FILE), "\t.short"); \
kono
parents:
diff changeset
755 asm_fprintf ((FILE), " %LL%d-%LL%d\n", (VALUE), (REL)); \
kono
parents:
diff changeset
756 } while (0)
kono
parents:
diff changeset
757
kono
parents:
diff changeset
758 /* This is how to output an assembler line
kono
parents:
diff changeset
759 that says to advance the location counter
kono
parents:
diff changeset
760 to a multiple of 2**LOG bytes. */
kono
parents:
diff changeset
761 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
kono
parents:
diff changeset
762 do { if ((LOG) != 0) fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); } while (0)
kono
parents:
diff changeset
763
kono
parents:
diff changeset
764 /* Inside the text section, align with nops rather than zeros. */
kono
parents:
diff changeset
765 #define ASM_OUTPUT_ALIGN_WITH_NOP(FILE, LOG) \
kono
parents:
diff changeset
766 do \
kono
parents:
diff changeset
767 { \
kono
parents:
diff changeset
768 if ((LOG) != 0) fprintf (FILE, "\t.balignw %d,0x01a2\n", 1 << (LOG)); \
kono
parents:
diff changeset
769 } while (0)
kono
parents:
diff changeset
770
kono
parents:
diff changeset
771 /* This is how to declare the size of a function. */
kono
parents:
diff changeset
772 #undef ASM_DECLARE_FUNCTION_SIZE
kono
parents:
diff changeset
773 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
kono
parents:
diff changeset
774 do \
kono
parents:
diff changeset
775 { \
kono
parents:
diff changeset
776 const char *__name = (FNAME); \
kono
parents:
diff changeset
777 tree attrs = DECL_ATTRIBUTES ((DECL)); \
kono
parents:
diff changeset
778 \
kono
parents:
diff changeset
779 if (!flag_inhibit_size_directive) \
kono
parents:
diff changeset
780 { \
kono
parents:
diff changeset
781 if (lookup_attribute ("forwarder_section", attrs)) \
kono
parents:
diff changeset
782 { \
kono
parents:
diff changeset
783 const char *prefix = "__forwarder_dst_"; \
kono
parents:
diff changeset
784 char *dst_name \
kono
parents:
diff changeset
785 = (char *) alloca (strlen (prefix) + strlen (__name) + 1); \
kono
parents:
diff changeset
786 \
kono
parents:
diff changeset
787 strcpy (dst_name, prefix); \
kono
parents:
diff changeset
788 strcat (dst_name, __name); \
kono
parents:
diff changeset
789 __name = dst_name; \
kono
parents:
diff changeset
790 } \
kono
parents:
diff changeset
791 ASM_OUTPUT_MEASURED_SIZE ((FILE), __name); \
kono
parents:
diff changeset
792 } \
kono
parents:
diff changeset
793 } \
kono
parents:
diff changeset
794 while (0)
kono
parents:
diff changeset
795
kono
parents:
diff changeset
796 /* Debugging information. */
kono
parents:
diff changeset
797
kono
parents:
diff changeset
798 /* Generate DBX and DWARF debugging information. */
kono
parents:
diff changeset
799 #define DBX_DEBUGGING_INFO 1
kono
parents:
diff changeset
800
kono
parents:
diff changeset
801 #undef PREFERRED_DEBUGGING_TYPE
kono
parents:
diff changeset
802 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
kono
parents:
diff changeset
803
kono
parents:
diff changeset
804 /* Turn off splitting of long stabs. */
kono
parents:
diff changeset
805 #define DBX_CONTIN_LENGTH 0
kono
parents:
diff changeset
806
kono
parents:
diff changeset
807 /* Miscellaneous. */
kono
parents:
diff changeset
808
kono
parents:
diff changeset
809 /* Specify the machine mode that this machine uses
kono
parents:
diff changeset
810 for the index in the tablejump instruction. */
kono
parents:
diff changeset
811 #define CASE_VECTOR_MODE (TARGET_SMALL16 && optimize_size ? HImode : Pmode)
kono
parents:
diff changeset
812
kono
parents:
diff changeset
813 /* Define if operations between registers always perform the operation
kono
parents:
diff changeset
814 on the full register even if a narrower mode is specified. */
kono
parents:
diff changeset
815 #define WORD_REGISTER_OPERATIONS 1
kono
parents:
diff changeset
816
kono
parents:
diff changeset
817 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
kono
parents:
diff changeset
818 will either zero-extend or sign-extend. The value of this macro should
kono
parents:
diff changeset
819 be the code that says which one of the two operations is implicitly
kono
parents:
diff changeset
820 done, UNKNOWN if none. */
kono
parents:
diff changeset
821 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
kono
parents:
diff changeset
822
kono
parents:
diff changeset
823 /* Max number of bytes we can move from memory to memory
kono
parents:
diff changeset
824 in one reasonably fast instruction. */
kono
parents:
diff changeset
825 #define MOVE_MAX 8
kono
parents:
diff changeset
826
kono
parents:
diff changeset
827 /* Define this to be nonzero if shift instructions ignore all but the low-order
kono
parents:
diff changeset
828 few bits. */
kono
parents:
diff changeset
829 #define SHIFT_COUNT_TRUNCATED 1
kono
parents:
diff changeset
830
kono
parents:
diff changeset
831 /* Specify the machine mode that pointers have.
kono
parents:
diff changeset
832 After generation of rtl, the compiler makes no further distinction
kono
parents:
diff changeset
833 between pointers and any other objects of this machine mode. */
kono
parents:
diff changeset
834
kono
parents:
diff changeset
835 #define Pmode SImode
kono
parents:
diff changeset
836
kono
parents:
diff changeset
837 /* A function address in a call instruction. */
kono
parents:
diff changeset
838 #define FUNCTION_MODE SImode
kono
parents:
diff changeset
839
kono
parents:
diff changeset
840 /* EPIPHANY function types. */
kono
parents:
diff changeset
841 enum epiphany_function_type
kono
parents:
diff changeset
842 {
kono
parents:
diff changeset
843 EPIPHANY_FUNCTION_UNKNOWN, EPIPHANY_FUNCTION_NORMAL,
kono
parents:
diff changeset
844 EPIPHANY_FUNCTION_INTERRUPT
kono
parents:
diff changeset
845 };
kono
parents:
diff changeset
846
kono
parents:
diff changeset
847 #define EPIPHANY_INTERRUPT_P(TYPE) ((TYPE) == EPIPHANY_FUNCTION_INTERRUPT)
kono
parents:
diff changeset
848
kono
parents:
diff changeset
849 /* Compute the type of a function from its DECL. */
kono
parents:
diff changeset
850
kono
parents:
diff changeset
851 #define IMMEDIATE_PREFIX "#"
kono
parents:
diff changeset
852
kono
parents:
diff changeset
853 #define OPTIMIZE_MODE_SWITCHING(ENTITY) \
kono
parents:
diff changeset
854 (epiphany_optimize_mode_switching (ENTITY))
kono
parents:
diff changeset
855
kono
parents:
diff changeset
856 /* We have two fake entities for lazy code motion of the mask constants,
kono
parents:
diff changeset
857 one entity each for round-to-nearest / truncating
kono
parents:
diff changeset
858 with a different idea what FP_MODE_ROUND_UNKNOWN will be, and
kono
parents:
diff changeset
859 finally an entity that runs in a second mode switching pass to
kono
parents:
diff changeset
860 resolve FP_MODE_ROUND_UNKNOWN. */
kono
parents:
diff changeset
861 #define NUM_MODES_FOR_MODE_SWITCHING \
kono
parents:
diff changeset
862 { 2, 2, 2, \
kono
parents:
diff changeset
863 FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE, FP_MODE_NONE }
kono
parents:
diff changeset
864
kono
parents:
diff changeset
865 #define TARGET_INSERT_MODE_SWITCH_USE epiphany_insert_mode_switch_use
kono
parents:
diff changeset
866
kono
parents:
diff changeset
867 /* Mode switching entities. */
kono
parents:
diff changeset
868 enum
kono
parents:
diff changeset
869 {
kono
parents:
diff changeset
870 EPIPHANY_MSW_ENTITY_AND,
kono
parents:
diff changeset
871 EPIPHANY_MSW_ENTITY_OR,
kono
parents:
diff changeset
872 EPIPHANY_MSW_ENTITY_CONFIG, /* 1 means config is known or saved. */
kono
parents:
diff changeset
873 EPIPHANY_MSW_ENTITY_NEAREST,
kono
parents:
diff changeset
874 EPIPHANY_MSW_ENTITY_TRUNC,
kono
parents:
diff changeset
875 EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN,
kono
parents:
diff changeset
876 EPIPHANY_MSW_ENTITY_ROUND_KNOWN,
kono
parents:
diff changeset
877 EPIPHANY_MSW_ENTITY_FPU_OMNIBUS,
kono
parents:
diff changeset
878 EPIPHANY_MSW_ENTITY_NUM
kono
parents:
diff changeset
879 };
kono
parents:
diff changeset
880
kono
parents:
diff changeset
881 extern int epiphany_normal_fp_rounding;
kono
parents:
diff changeset
882 #ifndef IN_LIBGCC2
kono
parents:
diff changeset
883 extern rtl_opt_pass *make_pass_mode_switch_use (gcc::context *ctxt);
kono
parents:
diff changeset
884 extern rtl_opt_pass *make_pass_resolve_sw_modes (gcc::context *ctxt);
kono
parents:
diff changeset
885 #endif
kono
parents:
diff changeset
886
kono
parents:
diff changeset
887 /* This will need to be adjusted when FP_CONTRACT_ON is properly
kono
parents:
diff changeset
888 implemented. */
kono
parents:
diff changeset
889 #define TARGET_FUSED_MADD (flag_fp_contract_mode == FP_CONTRACT_FAST)
kono
parents:
diff changeset
890
kono
parents:
diff changeset
891 #undef ASM_DECLARE_FUNCTION_NAME
kono
parents:
diff changeset
892 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
kono
parents:
diff changeset
893 epiphany_start_function ((FILE), (NAME), (DECL))
kono
parents:
diff changeset
894
kono
parents:
diff changeset
895 /* This is how we tell the assembler that two symbols have the same value. */
kono
parents:
diff changeset
896 #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
kono
parents:
diff changeset
897 do \
kono
parents:
diff changeset
898 { \
kono
parents:
diff changeset
899 assemble_name (FILE, NAME1); \
kono
parents:
diff changeset
900 fputs (" = ", FILE); \
kono
parents:
diff changeset
901 assemble_name (FILE, NAME2); \
kono
parents:
diff changeset
902 fputc ('\n', FILE); \
kono
parents:
diff changeset
903 } \
kono
parents:
diff changeset
904 while (0)
kono
parents:
diff changeset
905
kono
parents:
diff changeset
906 #endif /* !GCC_EPIPHANY_H */