comparison gcc/config/rs6000/darwin.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Target definitions for PowerPC running Darwin (Mac OS X). 1 /* Target definitions for PowerPC running Darwin (Mac OS X).
2 Copyright (C) 1997-2018 Free Software Foundation, Inc. 2 Copyright (C) 1997-2020 Free Software Foundation, Inc.
3 Contributed by Apple Computer Inc. 3 Contributed by Apple Computer Inc.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it 7 GCC is free software; you can redistribute it and/or modify it
41 /* Size of the Obj-C jump buffer. */ 41 /* Size of the Obj-C jump buffer. */
42 #define OBJC_JBLEN ((TARGET_64BIT) ? (26*2 + 18*2 + 129 + 1) : (26 + 18*2 + 129 + 1)) 42 #define OBJC_JBLEN ((TARGET_64BIT) ? (26*2 + 18*2 + 129 + 1) : (26 + 18*2 + 129 + 1))
43 43
44 /* We're not ever going to do TOCs. */ 44 /* We're not ever going to do TOCs. */
45 45
46 #define TARGET_TOC 0 46 #define TARGET_HAS_TOC 0
47 #define TARGET_NO_TOC 1
48 47
49 /* Override the default rs6000 definition. */ 48 /* Override the default rs6000 definition. */
50 #undef PTRDIFF_TYPE 49 #undef PTRDIFF_TYPE
51 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") 50 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
52 51
53 #define TARGET_OS_CPP_BUILTINS() \ 52 #define TARGET_OS_CPP_BUILTINS() \
54 do \ 53 do \
55 { \ 54 { \
56 if (!TARGET_64BIT) builtin_define ("__ppc__"); \
57 if (TARGET_64BIT) builtin_define ("__ppc64__"); \
58 builtin_define ("__POWERPC__"); \ 55 builtin_define ("__POWERPC__"); \
56 builtin_define ("__PPC__"); \
57 if (TARGET_64BIT) \
58 { \
59 builtin_define ("__ppc64__"); \
60 builtin_define ("__PPC64__"); \
61 builtin_define ("__powerpc64__"); \
62 builtin_assert ("cpu=powerpc64"); \
63 builtin_assert ("machine=powerpc64"); \
64 } \
65 else \
66 { \
67 builtin_define ("__ppc__"); \
68 builtin_define_std ("PPC"); \
69 builtin_assert ("cpu=powerpc"); \
70 builtin_assert ("machine=powerpc"); \
71 } \
59 builtin_define ("__NATURAL_ALIGNMENT__"); \ 72 builtin_define ("__NATURAL_ALIGNMENT__"); \
60 darwin_cpp_builtins (pfile); \ 73 darwin_cpp_builtins (pfile); \
61 } \ 74 } \
62 while (0) 75 while (0)
63
64 /* Generate branch islands stubs if this is true. */
65 extern int darwin_emit_branch_islands;
66 76
67 #define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options () 77 #define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options ()
68 78
69 #define C_COMMON_OVERRIDE_OPTIONS do { \ 79 #define C_COMMON_OVERRIDE_OPTIONS do { \
70 /* On powerpc, __cxa_get_exception_ptr is available starting in the \ 80 /* On powerpc, __cxa_get_exception_ptr is available starting in the \
82 consistency; arithmetic will work even if libc and libm support is 92 consistency; arithmetic will work even if libc and libm support is
83 not available. */ 93 not available. */
84 94
85 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 95 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
86 96
97 /* Machine dependent libraries.
98 Include libmx when targeting Darwin 7.0 and above, but before libSystem,
99 since the functions are actually in libSystem but for 7.x compatibility
100 we want them to be looked for in libmx first.
101 Include libSystemStubs when compiling against 10.3 - 10.5 SDKs (we assume
102 this is the case when targetting these) - but not for 64-bit long double.
103 Don't do either for m64, the library is either a dummy or non-existent.
104 */
105
106 #undef LIB_SPEC
107 #define LIB_SPEC \
108 "%{!static: \
109 %{!m64:%{!mlong-double-64: \
110 %{pg:%:version-compare(>< 10.3 10.5 mmacosx-version-min= -lSystemStubs_profile)} \
111 %{!pg:%:version-compare(>< 10.3 10.5 mmacosx-version-min= -lSystemStubs)} \
112 %:version-compare(>< 10.3 10.4 mmacosx-version-min= -lmx)}} \
113 -lSystem \
114 }"
87 115
88 /* We want -fPIC by default, unless we're using -static to compile for 116 /* We want -fPIC by default, unless we're using -static to compile for
89 the kernel or some such. The "-faltivec" option should have been 117 the kernel or some such. The "-faltivec" option should have been
90 called "-maltivec" all along. */ 118 called "-maltivec" all along. */
91 119
96 %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \ 124 %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
97 %{faltivec:-maltivec -include altivec.h} %{fno-altivec:-mno-altivec} \ 125 %{faltivec:-maltivec -include altivec.h} %{fno-altivec:-mno-altivec} \
98 %<faltivec %<fno-altivec " \ 126 %<faltivec %<fno-altivec " \
99 DARWIN_CC1_SPEC 127 DARWIN_CC1_SPEC
100 128
101 #define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}" 129 /* Default to PPC for single arch builds. */
130 #define DARWIN_ARCH_SPEC "ppc"
102 131
103 #define DARWIN_SUBARCH_SPEC " \ 132 #define DARWIN_SUBARCH_SPEC " \
104 %{m64: ppc64} \
105 %{!m64: \
106 %{mcpu=601:ppc601; \ 133 %{mcpu=601:ppc601; \
107 mcpu=603:ppc603; \ 134 mcpu=603:ppc603; \
108 mcpu=603e:ppc603; \ 135 mcpu=603e:ppc603; \
109 mcpu=604:ppc604; \ 136 mcpu=604:ppc604; \
110 mcpu=604e:ppc604e; \ 137 mcpu=604e:ppc604e; \
115 mcpu=G4:ppc7400; \ 142 mcpu=G4:ppc7400; \
116 mcpu=7450:ppc7450; \ 143 mcpu=7450:ppc7450; \
117 mcpu=970:ppc970; \ 144 mcpu=970:ppc970; \
118 mcpu=power4:ppc970; \ 145 mcpu=power4:ppc970; \
119 mcpu=G5:ppc970; \ 146 mcpu=G5:ppc970; \
120 :ppc}}" 147 :ppc}"
121 148
122 /* We need to jam the crt to 10.5 for 10.6 (Rosetta) use. */ 149 /* We need to jam the crt to 10.5 for 10.6 (Rosetta) use. */
123 #undef DARWIN_CRT1_SPEC 150 #undef DARWIN_CRT1_SPEC
124 #define DARWIN_CRT1_SPEC \ 151 #define DARWIN_CRT1_SPEC \
125 "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \ 152 "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
126 %:version-compare(>< 10.5 10.7 mmacosx-version-min= -lcrt1.10.5.o) \ 153 %:version-compare(>< 10.5 10.7 mmacosx-version-min= -lcrt1.10.5.o) \
127 %{fgnu-tm: -lcrttms.o}" 154 %{fgnu-tm: -lcrttms.o}"
128 155
129 /* crt2.o is at least partially required for 10.3.x and earlier. */ 156 /* crt2.o is at least partially required for 10.3.x and earlier.
157 It deals with registration of the unwind frames, where this is not
158 automatically provided by the system. So we need it for any case that
159 might use exceptions. */
160 #undef DARWIN_CRT2_SPEC
130 #define DARWIN_CRT2_SPEC \ 161 #define DARWIN_CRT2_SPEC \
131 "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}" 162 "%{!m64:%{shared-libgcc|static-libstdc++|fexceptions|fobjc-exceptions|fgnu-runtime: \
163 %:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s) \
164 }}"
165
166 /* crt3 deals with providing cxa_atexit on earlier systems (or fixing it up,
167 for broken versions). It's only needed for c++ code, so we can make it
168 conditional on shared-libgcc since that's forced on for c++. */
169 #undef DARWIN_CRT3_SPEC
170 #define DARWIN_CRT3_SPEC \
171 "%{!m64:%{shared-libgcc|static-libstdc++: \
172 %:version-compare(>< 10.4 10.5 mmacosx-version-min= crt3.o%s) \
173 %:version-compare(!> 10.4 mmacosx-version-min= crt3_2.o%s) \
174 }}"
175
176 /* As for crt1, we need to force the dylib crt for 10.6. */
177 #undef DARWIN_DYLIB1_SPEC
178 #define DARWIN_DYLIB1_SPEC \
179 "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o) \
180 %:version-compare(>< 10.5 10.7 mmacosx-version-min= -ldylib1.10.5.o)"
181
182 /* Likewise, the bundle crt. */
183 #undef DARWIN_BUNDLE1_SPEC
184 #define DARWIN_BUNDLE1_SPEC \
185 "%{!static:%:version-compare(< 10.7 mmacosx-version-min= -lbundle1.o) \
186 %{fgnu-tm: -lcrttms.o}}"
187
188 /* The PPC regs save/restore functions are leaves and could, conceivably
189 be used by the tm destructor. */
190 #undef ENDFILE_SPEC
191 #define ENDFILE_SPEC TM_DESTRUCTOR " -lef_ppc"
132 192
133 #undef SUBTARGET_EXTRA_SPECS 193 #undef SUBTARGET_EXTRA_SPECS
134 #define SUBTARGET_EXTRA_SPECS \ 194 #define SUBTARGET_EXTRA_SPECS \
135 DARWIN_EXTRA_SPECS \ 195 DARWIN_EXTRA_SPECS \
136 { "darwin_arch", DARWIN_ARCH_SPEC }, \ 196 { "darwin_arch", DARWIN_ARCH_SPEC }, \
137 { "darwin_crt2", DARWIN_CRT2_SPEC }, \ 197 { "darwin_crt2", DARWIN_CRT2_SPEC }, \
138 { "darwin_subarch", DARWIN_SUBARCH_SPEC }, 198 { "darwin_subarch", DARWIN_SUBARCH_SPEC },
139 199
140 /* We need to jam the dylib crt to 10.5 for 10.6 (Rosetta) use. */
141 #undef DARWIN_DYLIB1_SPEC
142 #define DARWIN_DYLIB1_SPEC \
143 "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o) \
144 %:version-compare(>< 10.5 10.7 mmacosx-version-min= -ldylib1.10.5.o)"
145
146 /* Output a .machine directive. */ 200 /* Output a .machine directive. */
147 #undef TARGET_ASM_FILE_START 201 #undef TARGET_ASM_FILE_START
148 #define TARGET_ASM_FILE_START rs6000_darwin_file_start 202 #define TARGET_ASM_FILE_START rs6000_darwin_file_start
149 203
150 /* Make both r2 and r13 available for allocation. */ 204 /* Make both r2 and r13 available for allocation. */
157 #define HARD_FRAME_POINTER_REGNUM 30 211 #define HARD_FRAME_POINTER_REGNUM 30
158 212
159 #undef RS6000_PIC_OFFSET_TABLE_REGNUM 213 #undef RS6000_PIC_OFFSET_TABLE_REGNUM
160 #define RS6000_PIC_OFFSET_TABLE_REGNUM 31 214 #define RS6000_PIC_OFFSET_TABLE_REGNUM 31
161 215
162 /* Pad the outgoing args area to 16 bytes instead of the usual 8. */ 216 /* Darwin's stack must remain 16-byte aligned for both 32 and 64 bit
217 ABIs. */
218
219 #undef STACK_BOUNDARY
220 #define STACK_BOUNDARY 128
221
222 /* Offset within stack frame to start allocating local variables at.
223 For supported Darwin versions, FRAME_GROWS_DOWNWARD is true, therefore
224 this value is the offset to the END of the first local allocated.
225
226 On the RS/6000, the frame pointer is the same as the stack pointer,
227 except for dynamic allocations. So we start after the fixed area and
228 outgoing parameter area.
229
230 If the function uses dynamic stack space (CALLS_ALLOCA is set), that
231 space needs to be aligned to STACK_BOUNDARY, i.e. the sum of the
232 sizes of the fixed area and the parameter area must be a multiple of
233 STACK_BOUNDARY. */
163 234
164 #undef RS6000_STARTING_FRAME_OFFSET 235 #undef RS6000_STARTING_FRAME_OFFSET
165 #define RS6000_STARTING_FRAME_OFFSET \ 236 #define RS6000_STARTING_FRAME_OFFSET \
166 (RS6000_ALIGN (crtl->outgoing_args_size, 16) \ 237 (cfun->calls_alloca \
167 + RS6000_SAVE_AREA) 238 ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \
239 : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
240
241 /* Offset from the stack pointer register to an item dynamically
242 allocated on the stack, e.g., by `alloca'.
243
244 The default value for this macro is `STACK_POINTER_OFFSET' plus the
245 length of the outgoing arguments. The default is correct for most
246 machines. See `function.c' for details.
247
248 This value must be a multiple of STACK_BOUNDARY (hard coded in
249 `emit-rtl.c'). */
168 250
169 #undef STACK_DYNAMIC_OFFSET 251 #undef STACK_DYNAMIC_OFFSET
170 #define STACK_DYNAMIC_OFFSET(FUNDECL) \ 252 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
171 (RS6000_ALIGN (crtl->outgoing_args_size.to_constant (), 16) \ 253 RS6000_ALIGN (crtl->outgoing_args_size.to_constant() \
172 + (STACK_POINTER_OFFSET)) 254 + STACK_POINTER_OFFSET, 16)
173 255
174 /* Darwin uses a function call if everything needs to be saved/restored. */ 256 /* Darwin uses a function call if everything needs to be saved/restored. */
175 257
176 #undef WORLD_SAVE_P 258 #undef WORLD_SAVE_P
177 #define WORLD_SAVE_P(INFO) ((INFO)->world_save_p) 259 #define WORLD_SAVE_P(INFO) ((INFO)->world_save_p)
185 /* The assembler wants the alternate register names, but without 267 /* The assembler wants the alternate register names, but without
186 leading percent sign. */ 268 leading percent sign. */
187 #undef REGISTER_NAMES 269 #undef REGISTER_NAMES
188 #define REGISTER_NAMES \ 270 #define REGISTER_NAMES \
189 { \ 271 { \
272 /* GPRs */ \
190 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ 273 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
191 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ 274 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
192 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ 275 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
193 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ 276 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
277 /* FPRs */ \
194 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ 278 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
195 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ 279 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
196 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ 280 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
197 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ 281 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
198 "mq", "lr", "ctr", "ap", \ 282 /* VRs */ \
283 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", \
284 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", \
285 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \
286 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", \
287 /* lr ctr ca ap */ \
288 "lr", "ctr", "xer", "ap", \
289 /* cr0..cr7 */ \
199 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ 290 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
200 "xer", \ 291 /* vrsave vscr sfp */ \
201 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", \ 292 "vrsave", "vscr", "sfp" \
202 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", \
203 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \
204 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", \
205 "vrsave", "vscr", \
206 "sfp", \
207 "tfhar", "tfiar", "texasr" \
208 } 293 }
209 294
210 /* This outputs NAME to FILE. */ 295 /* This outputs NAME to FILE. */
211 296
212 #undef RS6000_OUTPUT_BASENAME 297 #undef RS6000_OUTPUT_BASENAME
248 333
249 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 334 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
250 /* This is supported in cctools 465 and later. The macro test 335 /* This is supported in cctools 465 and later. The macro test
251 above prevents using it in earlier build environments. */ 336 above prevents using it in earlier build environments. */
252 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ 337 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
253 if ((LOG) != 0) \ 338 if ((LOG) > 0) \
254 { \ 339 { \
255 if ((MAX_SKIP) == 0) \ 340 if ((MAX_SKIP) <= 0) \
256 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 341 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
257 else \ 342 else \
258 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 343 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
259 } 344 }
260 #endif 345 #endif
312 #undef PREFERRED_RELOAD_CLASS 397 #undef PREFERRED_RELOAD_CLASS
313 #define PREFERRED_RELOAD_CLASS(X,CLASS) \ 398 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
314 ((CONSTANT_P (X) \ 399 ((CONSTANT_P (X) \
315 && reg_classes_intersect_p ((CLASS), FLOAT_REGS)) \ 400 && reg_classes_intersect_p ((CLASS), FLOAT_REGS)) \
316 ? NO_REGS \ 401 ? NO_REGS \
317 : ((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == HIGH) \ 402 : ((SYMBOL_REF_P (X) || GET_CODE (X) == HIGH) \
318 && reg_class_subset_p (BASE_REGS, (CLASS))) \ 403 && reg_class_subset_p (BASE_REGS, (CLASS))) \
319 ? BASE_REGS \ 404 ? BASE_REGS \
320 : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \ 405 : (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \
321 && (CLASS) == NON_SPECIAL_REGS) \ 406 && (CLASS) == GEN_OR_FLOAT_REGS) \
322 ? GENERAL_REGS \ 407 ? GENERAL_REGS \
323 : (CLASS)) 408 : (CLASS))
324 409
325 /* Compute field alignment. 410 /* Compute field alignment.
326 This implements the 'power' alignment rule by pegging the alignment of 411 This implements the 'power' alignment rule by pegging the alignment of
365 #undef REGISTER_TARGET_PRAGMAS 450 #undef REGISTER_TARGET_PRAGMAS
366 #define REGISTER_TARGET_PRAGMAS() \ 451 #define REGISTER_TARGET_PRAGMAS() \
367 do \ 452 do \
368 { \ 453 { \
369 DARWIN_REGISTER_TARGET_PRAGMAS(); \ 454 DARWIN_REGISTER_TARGET_PRAGMAS(); \
455 targetm.target_option.pragma_parse = rs6000_pragma_target_parse; \
370 targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \ 456 targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
371 } \ 457 } \
372 while (0) 458 while (0)
373 459
374 #ifdef IN_LIBGCC2 460 #ifdef IN_LIBGCC2
424 510
425 /* So far, there is no rs6000_fold_builtin, if one is introduced, then 511 /* So far, there is no rs6000_fold_builtin, if one is introduced, then
426 this will need to be modified similar to the x86 case. */ 512 this will need to be modified similar to the x86 case. */
427 #define TARGET_FOLD_BUILTIN SUBTARGET_FOLD_BUILTIN 513 #define TARGET_FOLD_BUILTIN SUBTARGET_FOLD_BUILTIN
428 514
515 /* First available SYMBOL flag bit for use by subtargets. */
516 #define SYMBOL_FLAG_SUBT_DEP (SYMBOL_FLAG_MACH_DEP)
517
429 /* Use standard DWARF numbering for DWARF debugging information. */ 518 /* Use standard DWARF numbering for DWARF debugging information. */
430 #define RS6000_USE_DWARF_NUMBERING 519 #define RS6000_USE_DWARF_NUMBERING
431 520