annotate gcc/config/ft32/ft32.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 /* Target Definitions for ft32.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2015-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 Contributed by FTDI <support@ftdi.com>
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 it
kono
parents:
diff changeset
8 under the terms of the GNU General Public License as published
kono
parents:
diff changeset
9 by the Free Software Foundation; either version 3, or (at your
kono
parents:
diff changeset
10 option) any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful, but WITHOUT
kono
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
kono
parents:
diff changeset
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
kono
parents:
diff changeset
15 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_FT32_H
kono
parents:
diff changeset
22 #define GCC_FT32_H
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 #undef STARTFILE_SPEC
kono
parents:
diff changeset
25 #define STARTFILE_SPEC "crt0%O%s %{msim:crti.o%s} %{!msim:crti-hw.o%s} crtbegin.o%s"
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 /* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own
kono
parents:
diff changeset
28 magical crtend.o file (see crtstuff.c) which provides part of the
kono
parents:
diff changeset
29 support for getting C++ file-scope static object constructed before
kono
parents:
diff changeset
30 entering `main', followed by the normal svr3/svr4 "finalizer" file,
kono
parents:
diff changeset
31 which is either `gcrtn.o' or `crtn.o'. */
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 #undef ENDFILE_SPEC
kono
parents:
diff changeset
34 #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 /* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default
kono
parents:
diff changeset
37 standard C library (unless we are building a shared library) and
kono
parents:
diff changeset
38 the simulator BSP code. */
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 #undef LIB_SPEC
kono
parents:
diff changeset
41 #define LIB_SPEC "%{!shared:%{!symbolic:-lc}} \
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
42 %{mcompress:--relax} \
111
kono
parents:
diff changeset
43 %{msim:-Tsim.ld}"
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 #undef LINK_SPEC
kono
parents:
diff changeset
46 #define LINK_SPEC "%{h*} %{v:-V} \
kono
parents:
diff changeset
47 %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}"
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* Layout of Source Language Data Types */
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 #define INT_TYPE_SIZE 32
kono
parents:
diff changeset
52 #define SHORT_TYPE_SIZE 16
kono
parents:
diff changeset
53 #define LONG_TYPE_SIZE 32
kono
parents:
diff changeset
54 #define LONG_LONG_TYPE_SIZE 64
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 #define FLOAT_TYPE_SIZE 32
kono
parents:
diff changeset
57 #define DOUBLE_TYPE_SIZE 64
kono
parents:
diff changeset
58 #define LONG_DOUBLE_TYPE_SIZE 64
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 #define DEFAULT_SIGNED_CHAR 1
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 #undef SIZE_TYPE
kono
parents:
diff changeset
63 #define SIZE_TYPE "unsigned int"
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 #undef PTRDIFF_TYPE
kono
parents:
diff changeset
66 #define PTRDIFF_TYPE "int"
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 #undef WCHAR_TYPE
kono
parents:
diff changeset
69 #define WCHAR_TYPE "long int"
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 #undef WCHAR_TYPE_SIZE
kono
parents:
diff changeset
72 #define WCHAR_TYPE_SIZE BITS_PER_WORD
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 #define REGISTER_NAMES { \
kono
parents:
diff changeset
75 "$fp", "$sp", "$r0", "$r1", \
kono
parents:
diff changeset
76 "$r2", "$r3", "$r4", "$r5", \
kono
parents:
diff changeset
77 "$r6", "$r7", "$r8", "$r9", \
kono
parents:
diff changeset
78 "$r10", "$r11", "$r12", "$r13", \
kono
parents:
diff changeset
79 "$r14", "$r15", "$r16", "$r17", "$r18", "$r19", "$r20", "$r21", "$r22", "$r23", "$r24", "$r25", "$r26", "$r27", "$r28", "$cc", \
kono
parents:
diff changeset
80 "?fp", "?ap", "$pc", "?cc" }
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 #define FT32_FP 0
kono
parents:
diff changeset
83 #define FT32_SP 1
kono
parents:
diff changeset
84 #define FT32_R0 2
kono
parents:
diff changeset
85 #define FT32_R1 3
kono
parents:
diff changeset
86 #define FT32_R2 4
kono
parents:
diff changeset
87 #define FT32_R3 5
kono
parents:
diff changeset
88 #define FT32_R4 6
kono
parents:
diff changeset
89 #define FT32_R5 7
kono
parents:
diff changeset
90 #define FT32_R6 8
kono
parents:
diff changeset
91 #define FT32_R7 9
kono
parents:
diff changeset
92 #define FT32_R8 10
kono
parents:
diff changeset
93 #define FT32_R9 11
kono
parents:
diff changeset
94 #define FT32_R10 12
kono
parents:
diff changeset
95 #define FT32_R11 13
kono
parents:
diff changeset
96 #define FT32_R12 14
kono
parents:
diff changeset
97 #define FT32_R13 15
kono
parents:
diff changeset
98 #define FT32_R14 16
kono
parents:
diff changeset
99 #define FT32_R15 17
kono
parents:
diff changeset
100 #define FT32_R16 18
kono
parents:
diff changeset
101 #define FT32_R17 19
kono
parents:
diff changeset
102 #define FT32_R18 20
kono
parents:
diff changeset
103 #define FT32_R19 21
kono
parents:
diff changeset
104 #define FT32_R20 22
kono
parents:
diff changeset
105 #define FT32_R21 23
kono
parents:
diff changeset
106 #define FT32_R22 24
kono
parents:
diff changeset
107 #define FT32_R23 25
kono
parents:
diff changeset
108 #define FT32_R24 26
kono
parents:
diff changeset
109 #define FT32_R25 27
kono
parents:
diff changeset
110 #define FT32_R26 28
kono
parents:
diff changeset
111 #define FT32_R27 29
kono
parents:
diff changeset
112 #define FT32_R28 30
kono
parents:
diff changeset
113 #define FT32_R29 31
kono
parents:
diff changeset
114 #define FT32_QAP (32 + 1)
kono
parents:
diff changeset
115 #define FT32_PC (32 + 2)
kono
parents:
diff changeset
116 #define FT32_CC (32 + 3)
kono
parents:
diff changeset
117 #define FIRST_PSEUDO_REGISTER (32 + 4)
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 enum reg_class
kono
parents:
diff changeset
120 {
kono
parents:
diff changeset
121 NO_REGS,
kono
parents:
diff changeset
122 GENERAL_REGS,
kono
parents:
diff changeset
123 SPECIAL_REGS,
kono
parents:
diff changeset
124 CC_REGS,
kono
parents:
diff changeset
125 ALL_REGS,
kono
parents:
diff changeset
126 LIM_REG_CLASSES
kono
parents:
diff changeset
127 };
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 #define REG_CLASS_CONTENTS \
kono
parents:
diff changeset
130 { { 0x00000000, 0x00000000 }, /* Empty */ \
kono
parents:
diff changeset
131 { 0xFFFFFFFF, 0x00000003 }, /* $fp, $sp, $r0 to $r13, ?fp */ \
kono
parents:
diff changeset
132 { 0x00000000, 0x00000004 }, /* $pc */ \
kono
parents:
diff changeset
133 { 0x00000000, 0x00000008 }, /* ?cc */ \
kono
parents:
diff changeset
134 { 0xFFFFFFFF, 0x0000000F } /* All registers */ \
kono
parents:
diff changeset
135 }
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 #define N_REG_CLASSES LIM_REG_CLASSES
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 #define REG_CLASS_NAMES {\
kono
parents:
diff changeset
140 "NO_REGS", \
kono
parents:
diff changeset
141 "GENERAL_REGS", \
kono
parents:
diff changeset
142 "SPECIAL_REGS", \
kono
parents:
diff changeset
143 "CC_REGS", \
kono
parents:
diff changeset
144 "ALL_REGS" }
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 #define FIXED_REGISTERS /* fp sp r0 r1 */ { 1, 1, 0, 0, \
kono
parents:
diff changeset
147 /* r2 r3 r4 r5 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
148 /* r6 r7 r8 r9 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
149 /* r10 r11 r12 r13 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
150 /* r14 r15 r16 r17 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
151 /* r18 r19 r20 r21 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
152 /* r22 r23 r24 r25 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
153 /* r26 r27 r28 r29 */ 0, 0, 1, 1, \
kono
parents:
diff changeset
154 /* r30 r31 */ 1, 1, 1, 1 }
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 #define CALL_USED_REGISTERS \
kono
parents:
diff changeset
157 /* fp sp r0 r1 */ { 1, 1, 1, 1, \
kono
parents:
diff changeset
158 /* r2 r3 r4 r5 */ 1, 1, 1, 1, \
kono
parents:
diff changeset
159 /* r6 r7 r8 r9 */ 1, 1, 1, 1, \
kono
parents:
diff changeset
160 /* r10 r11 r12 r13 */ 1, 1, 1, 0, \
kono
parents:
diff changeset
161 /* r14 r15 r16 r17 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
162 /* r18 r19 r20 r21 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
163 /* r22 r23 r24 r25 */ 0, 0, 0, 0, \
kono
parents:
diff changeset
164 /* r26 r27 r28 r29 */ 0, 0, 1, 1, \
kono
parents:
diff changeset
165 /* r30 r31 */ 1, 1, 1, 1 }
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 /* We can't copy to or from our CC register. */
kono
parents:
diff changeset
168 #define AVOID_CCMODE_COPIES 1
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 /* A C expression whose value is a register class containing hard
kono
parents:
diff changeset
171 register REGNO. */
kono
parents:
diff changeset
172 #define REGNO_REG_CLASS(R) ((R < FT32_PC) ? GENERAL_REGS : \
kono
parents:
diff changeset
173 (R == FT32_CC ? CC_REGS : SPECIAL_REGS))
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 /* The Overall Framework of an Assembler File */
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 #undef ASM_SPEC
kono
parents:
diff changeset
178 #define ASM_COMMENT_START "#"
kono
parents:
diff changeset
179 #define ASM_APP_ON ""
kono
parents:
diff changeset
180 #define ASM_APP_OFF ""
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 #define FILE_ASM_OP "\t.file\n"
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 /* Switch to the text or data segment. */
kono
parents:
diff changeset
185 #define TEXT_SECTION_ASM_OP "\t.text"
kono
parents:
diff changeset
186 #define DATA_SECTION_ASM_OP "\t.data"
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 /* Assembler Commands for Alignment */
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 #define ASM_OUTPUT_ALIGN(STREAM,POWER) \
kono
parents:
diff changeset
191 fprintf (STREAM, "\t.p2align\t%d\n", POWER);
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 /* A C compound statement to output to stdio stream STREAM the
kono
parents:
diff changeset
194 assembler syntax for an instruction operand X. */
kono
parents:
diff changeset
195 #define PRINT_OPERAND(STREAM, X, CODE) ft32_print_operand (STREAM, X, CODE)
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 #define PRINT_OPERAND_ADDRESS(STREAM ,X) ft32_print_operand_address (STREAM, X)
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 /* Output and Generation of Labels */
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 #define GLOBAL_ASM_OP "\t.global\t"
kono
parents:
diff changeset
202
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
203 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_NOPM ? 0 : 1)
111
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 /* This is how to output an element of a case-vector that is absolute. */
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
208 fprintf (FILE, "\t.long\t.L%d\n", VALUE) \
111
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 /* Passing Arguments in Registers */
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 /* A C type for declaring a variable that is used as the first
kono
parents:
diff changeset
213 argument of `FUNCTION_ARG' and other related values. */
kono
parents:
diff changeset
214 #define CUMULATIVE_ARGS unsigned int
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 /* If defined, the maximum amount of space required for outgoing arguments
kono
parents:
diff changeset
217 will be computed and placed into the variable
kono
parents:
diff changeset
218 `current_function_outgoing_args_size'. No space will be pushed
kono
parents:
diff changeset
219 onto the stack for each call; instead, the function prologue should
kono
parents:
diff changeset
220 increase the stack frame size by this amount. */
kono
parents:
diff changeset
221 #define ACCUMULATE_OUTGOING_ARGS 1
kono
parents:
diff changeset
222
kono
parents:
diff changeset
223 /* A C statement (sans semicolon) for initializing the variable CUM
kono
parents:
diff changeset
224 for the state at the beginning of the argument list.
kono
parents:
diff changeset
225 For ft32, the first arg is passed in register 2 (aka $r0). */
kono
parents:
diff changeset
226 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
kono
parents:
diff changeset
227 (CUM = FT32_R0)
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 /* How Scalar Function Values Are Returned */
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 /* STACK AND CALLING */
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 /* Define this macro if pushing a word onto the stack moves the stack
kono
parents:
diff changeset
234 pointer to a smaller address. */
kono
parents:
diff changeset
235 #define STACK_GROWS_DOWNWARD 1
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 /* Offset from the argument pointer register to the first argument's
kono
parents:
diff changeset
238 address. On some machines it may depend on the data type of the
kono
parents:
diff changeset
239 function. */
kono
parents:
diff changeset
240 #define FIRST_PARM_OFFSET(F) 0
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 /* Define this macro to nonzero value if the addresses of local variable slots
kono
parents:
diff changeset
243 are at negative offsets from the frame pointer. */
kono
parents:
diff changeset
244 #define FRAME_GROWS_DOWNWARD 1
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
kono
parents:
diff changeset
247 the stack pointer does not matter. The value is tested only in
kono
parents:
diff changeset
248 functions that have frame pointers.
kono
parents:
diff changeset
249 No definition is equivalent to always zero. */
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251 #define EXIT_IGNORE_STACK 0
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 /* Define this macro as a C expression that is nonzero for registers that are
kono
parents:
diff changeset
254 used by the epilogue or the return pattern. The stack and frame
kono
parents:
diff changeset
255 pointer registers are already assumed to be used as needed. */
kono
parents:
diff changeset
256 #define EPILOGUE_USES(R) (R == FT32_R5)
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 /* A C expression whose value is RTL representing the location of the
kono
parents:
diff changeset
259 incoming return address at the beginning of any function, before
kono
parents:
diff changeset
260 the prologue. */
kono
parents:
diff changeset
261 #define INCOMING_RETURN_ADDR_RTX \
kono
parents:
diff changeset
262 gen_frame_mem (Pmode, \
kono
parents:
diff changeset
263 plus_constant (Pmode, stack_pointer_rtx, 333 * UNITS_PER_WORD))
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
kono
parents:
diff changeset
266 ((COUNT) == 0 \
kono
parents:
diff changeset
267 ? gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT (-4))) \
kono
parents:
diff changeset
268 : NULL_RTX)
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 /* Describe how we implement __builtin_eh_return. */
kono
parents:
diff changeset
271 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N+2) : INVALID_REGNUM)
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 /* Store the return handler into the call frame. */
kono
parents:
diff changeset
274 #define EH_RETURN_HANDLER_RTX \
kono
parents:
diff changeset
275 gen_frame_mem (Pmode, \
kono
parents:
diff changeset
276 plus_constant (Pmode, frame_pointer_rtx, UNITS_PER_WORD))
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 /* Storage Layout */
kono
parents:
diff changeset
279
kono
parents:
diff changeset
280 #define BITS_BIG_ENDIAN 0
kono
parents:
diff changeset
281 #define BYTES_BIG_ENDIAN 0
kono
parents:
diff changeset
282 #define WORDS_BIG_ENDIAN 0
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 /* Alignment required for a function entry point, in bits. */
kono
parents:
diff changeset
285 #define FUNCTION_BOUNDARY 32
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 #define BRANCH_COST(speed_p, predictable_p) 2
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 /* Define this macro as a C expression which is nonzero if accessing
kono
parents:
diff changeset
290 less than a word of memory (i.e. a `char' or a `short') is no
kono
parents:
diff changeset
291 faster than accessing a word of memory. */
kono
parents:
diff changeset
292 #define SLOW_BYTE_ACCESS 1
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 #define STORE_FLAG_VALUE 1
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 #define MOVE_RATIO(speed) ((speed) ? 6 : 2)
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 /* Number of storage units in a word; normally the size of a
kono
parents:
diff changeset
299 general-purpose register, a power of two from 1 or 8. */
kono
parents:
diff changeset
300 #define UNITS_PER_WORD 4
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 /* Define this macro to the minimum alignment enforced by hardware
kono
parents:
diff changeset
303 for the stack pointer on this machine. The definition is a C
kono
parents:
diff changeset
304 expression for the desired alignment (measured in bits). */
kono
parents:
diff changeset
305 #define STACK_BOUNDARY 32
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 /* Normal alignment required for function parameters on the stack, in
kono
parents:
diff changeset
308 bits. All stack parameters receive at least this much alignment
kono
parents:
diff changeset
309 regardless of data type. */
kono
parents:
diff changeset
310 #define PARM_BOUNDARY 32
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 /* Alignment of field after `int : 0' in a structure. */
kono
parents:
diff changeset
313 #define EMPTY_FIELD_BOUNDARY 32
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 /* No data type wants to be aligned rounder than this. */
kono
parents:
diff changeset
316 #define BIGGEST_ALIGNMENT 32
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 /* The best alignment to use in cases where we have a choice. */
kono
parents:
diff changeset
319 #define FASTEST_ALIGNMENT 32
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 /* Align definitions of arrays, unions and structures so that
kono
parents:
diff changeset
322 initializations and copies can be made more efficient. This is not
kono
parents:
diff changeset
323 ABI-changing, so it only affects places where we can see the
kono
parents:
diff changeset
324 definition. Increasing the alignment tends to introduce padding,
kono
parents:
diff changeset
325 so don't do this when optimizing for size/conserving stack space. */
kono
parents:
diff changeset
326 #define FT32_EXPAND_ALIGNMENT(COND, EXP, ALIGN) \
kono
parents:
diff changeset
327 (((COND) && ((ALIGN) < BITS_PER_WORD) \
kono
parents:
diff changeset
328 && (TREE_CODE (EXP) == ARRAY_TYPE \
kono
parents:
diff changeset
329 || TREE_CODE (EXP) == UNION_TYPE \
kono
parents:
diff changeset
330 || TREE_CODE (EXP) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332 /* Make arrays of chars word-aligned for the same reasons. */
kono
parents:
diff changeset
333 #define DATA_ALIGNMENT(TYPE, ALIGN) \
kono
parents:
diff changeset
334 (TREE_CODE (TYPE) == ARRAY_TYPE \
kono
parents:
diff changeset
335 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
kono
parents:
diff changeset
336 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
kono
parents:
diff changeset
337
kono
parents:
diff changeset
338 /* Similarly, make sure that objects on the stack are sensibly aligned. */
kono
parents:
diff changeset
339 #define LOCAL_ALIGNMENT(EXP, ALIGN) \
kono
parents:
diff changeset
340 FT32_EXPAND_ALIGNMENT(/*!flag_conserve_stack*/ 1, EXP, ALIGN)
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 /* Every structures size must be a multiple of 8 bits. */
kono
parents:
diff changeset
343 #define STRUCTURE_SIZE_BOUNDARY 8
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 /* Look at the fundamental type that is used for a bit-field and use
kono
parents:
diff changeset
346 that to impose alignment on the enclosing structure.
kono
parents:
diff changeset
347 struct s {int a:8}; should have same alignment as "int", not "char". */
kono
parents:
diff changeset
348 #define PCC_BITFIELD_TYPE_MATTERS 1
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350 /* Largest integer machine mode for structures. If undefined, the default
kono
parents:
diff changeset
351 is GET_MODE_SIZE(DImode). */
kono
parents:
diff changeset
352 #define MAX_FIXED_MODE_SIZE 32
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 /* Set this nonzero if move instructions will actually fail to work
kono
parents:
diff changeset
355 when given unaligned data. */
kono
parents:
diff changeset
356 #define STRICT_ALIGNMENT 1
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 /* Generating Code for Profiling */
kono
parents:
diff changeset
359 #define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0)
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 /* Trampolines for Nested Functions. */
kono
parents:
diff changeset
362 #define TRAMPOLINE_SIZE (2 + 6 + 6 + 2 + 2 + 6)
kono
parents:
diff changeset
363
kono
parents:
diff changeset
364 /* Alignment required for trampolines, in bits. */
kono
parents:
diff changeset
365 #define TRAMPOLINE_ALIGNMENT 32
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 /* An alias for the machine mode for pointers. */
kono
parents:
diff changeset
368 #define Pmode SImode
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
kono
parents:
diff changeset
371 do { \
kono
parents:
diff changeset
372 if (((MODE) == HImode) \
kono
parents:
diff changeset
373 || ((MODE) == QImode)) \
kono
parents:
diff changeset
374 (MODE) = SImode; \
kono
parents:
diff changeset
375 } while (0)
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 /* An alias for the machine mode used for memory references to
kono
parents:
diff changeset
378 functions being called, in `call' RTL expressions. */
kono
parents:
diff changeset
379 #define FUNCTION_MODE QImode
kono
parents:
diff changeset
380
kono
parents:
diff changeset
381 #define STATIC_CHAIN_REGNUM FT32_R28
kono
parents:
diff changeset
382
kono
parents:
diff changeset
383 /* The register number of the stack pointer register, which must also
kono
parents:
diff changeset
384 be a fixed register according to `FIXED_REGISTERS'. */
kono
parents:
diff changeset
385 #define STACK_POINTER_REGNUM FT32_SP
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 /* The register number of the frame pointer register, which is used to
kono
parents:
diff changeset
388 access automatic variables in the stack frame. */
kono
parents:
diff changeset
389 #define FRAME_POINTER_REGNUM FT32_FP
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 /* The register number of the arg pointer register, which is used to
kono
parents:
diff changeset
392 access the function's argument list. */
kono
parents:
diff changeset
393 #define ARG_POINTER_REGNUM FT32_QAP
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 #define ELIMINABLE_REGS \
kono
parents:
diff changeset
396 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
kono
parents:
diff changeset
397 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
kono
parents:
diff changeset
398 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400
kono
parents:
diff changeset
401 /* This macro returns the initial difference between the specified pair
kono
parents:
diff changeset
402 of registers. */
kono
parents:
diff changeset
403 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
kono
parents:
diff changeset
404 do { \
kono
parents:
diff changeset
405 (OFFSET) = ft32_initial_elimination_offset ((FROM), (TO)); \
kono
parents:
diff changeset
406 } while (0)
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 /* A C expression that is nonzero if REGNO is the number of a hard
kono
parents:
diff changeset
409 register in which function arguments are sometimes passed. */
kono
parents:
diff changeset
410 #define FUNCTION_ARG_REGNO_P(r) (r >= FT32_R0 && r <= FT32_R5)
kono
parents:
diff changeset
411
kono
parents:
diff changeset
412 /* A macro whose definition is the name of the class to which a valid
kono
parents:
diff changeset
413 base register must belong. A base register is one used in an
kono
parents:
diff changeset
414 address which is the register value plus a displacement. */
kono
parents:
diff changeset
415 #define BASE_REG_CLASS GENERAL_REGS
kono
parents:
diff changeset
416
kono
parents:
diff changeset
417 #define INDEX_REG_CLASS NO_REGS
kono
parents:
diff changeset
418
kono
parents:
diff changeset
419 #define HARD_REGNO_OK_FOR_BASE_P(NUM) \
kono
parents:
diff changeset
420 ((unsigned) (NUM) < FIRST_PSEUDO_REGISTER \
kono
parents:
diff changeset
421 && (REGNO_REG_CLASS(NUM) == GENERAL_REGS \
kono
parents:
diff changeset
422 || (NUM) == HARD_FRAME_POINTER_REGNUM))
kono
parents:
diff changeset
423
kono
parents:
diff changeset
424 /* A C expression which is nonzero if register number NUM is suitable
kono
parents:
diff changeset
425 for use as a base register in operand addresses. */
kono
parents:
diff changeset
426 #ifdef REG_OK_STRICT
kono
parents:
diff changeset
427 #define REGNO_OK_FOR_BASE_P(NUM) \
kono
parents:
diff changeset
428 (HARD_REGNO_OK_FOR_BASE_P(NUM) \
kono
parents:
diff changeset
429 || HARD_REGNO_OK_FOR_BASE_P(reg_renumber[(NUM)]))
kono
parents:
diff changeset
430 #else
kono
parents:
diff changeset
431 #define REGNO_OK_FOR_BASE_P(NUM) \
kono
parents:
diff changeset
432 ((NUM) >= FIRST_PSEUDO_REGISTER || HARD_REGNO_OK_FOR_BASE_P(NUM))
kono
parents:
diff changeset
433 #endif
kono
parents:
diff changeset
434
kono
parents:
diff changeset
435 /* A C expression which is nonzero if register number NUM is suitable
kono
parents:
diff changeset
436 for use as an index register in operand addresses. */
kono
parents:
diff changeset
437 #define REGNO_OK_FOR_INDEX_P(NUM) FT32_FP
kono
parents:
diff changeset
438
kono
parents:
diff changeset
439 /* The maximum number of bytes that a single instruction can move
kono
parents:
diff changeset
440 quickly between memory and registers or between two memory
kono
parents:
diff changeset
441 locations. */
kono
parents:
diff changeset
442 #define MOVE_MAX 4
kono
parents:
diff changeset
443
kono
parents:
diff changeset
444 /* Define this to be nonzero if shift instructions ignore all but the low-order
kono
parents:
diff changeset
445 few bits. */
kono
parents:
diff changeset
446 #define SHIFT_COUNT_TRUNCATED 1
kono
parents:
diff changeset
447
kono
parents:
diff changeset
448 /* All load operations zero extend. */
kono
parents:
diff changeset
449 #define LOAD_EXTEND_OP(MEM) ZERO_EXTEND
kono
parents:
diff changeset
450
kono
parents:
diff changeset
451 /* A number, the maximum number of registers that can appear in a
kono
parents:
diff changeset
452 valid memory address. */
kono
parents:
diff changeset
453 #define MAX_REGS_PER_ADDRESS 1
kono
parents:
diff changeset
454
kono
parents:
diff changeset
455 /* An alias for a machine mode name. This is the machine mode that
kono
parents:
diff changeset
456 elements of a jump-table should have. */
kono
parents:
diff changeset
457 #define CASE_VECTOR_MODE SImode
kono
parents:
diff changeset
458
kono
parents:
diff changeset
459 /* Run-time Target Specification */
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 #define TARGET_CPU_CPP_BUILTINS() \
kono
parents:
diff changeset
462 { \
kono
parents:
diff changeset
463 builtin_define ("__FT32__"); \
kono
parents:
diff changeset
464 }
kono
parents:
diff changeset
465
kono
parents:
diff changeset
466 #define HAS_LONG_UNCOND_BRANCH true
kono
parents:
diff changeset
467
kono
parents:
diff changeset
468 #define NO_FUNCTION_CSE 1
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 #define ADDR_SPACE_PM 1
kono
parents:
diff changeset
471
kono
parents:
diff changeset
472 #define REGISTER_TARGET_PRAGMAS() do { \
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
473 c_register_addr_space ("__flash__", TARGET_NOPM ? 0 : ADDR_SPACE_PM); \
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
474 } while (0)
111
kono
parents:
diff changeset
475
kono
parents:
diff changeset
476 extern int ft32_is_mem_pm(rtx o);
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 #define ASM_OUTPUT_SYMBOL_REF(stream, sym) \
kono
parents:
diff changeset
479 do { \
kono
parents:
diff changeset
480 assemble_name (stream, XSTR (sym, 0)); \
kono
parents:
diff changeset
481 int section_debug = in_section && \
kono
parents:
diff changeset
482 (SECTION_STYLE (in_section) == SECTION_NAMED) && \
kono
parents:
diff changeset
483 (in_section->named.common.flags & SECTION_DEBUG); \
kono
parents:
diff changeset
484 if (!section_debug && SYMBOL_REF_FLAGS (sym) & 0x1000) \
kono
parents:
diff changeset
485 asm_fprintf (stream, "-0x800000"); \
kono
parents:
diff changeset
486 } while (0)
kono
parents:
diff changeset
487
kono
parents:
diff changeset
488 #endif /* GCC_FT32_H */