* config/xtensa/xtensa.c (call_insn_operand): Check
[official-gcc.git] / gcc / config / rs6000 / aix.h
blobc530f988e2511fc58e5dd7bd4d8ad3f7adfb3898
1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 POWER running AIX.
3 Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 2, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
20 MA 02111-1307, USA. */
22 /* Yes! We are AIX! */
23 #define DEFAULT_ABI ABI_AIX
24 #undef TARGET_AIX
25 #define TARGET_AIX 1
27 /* AIX always has a TOC. */
28 #define TARGET_NO_TOC 0
29 #define TARGET_TOC 1
30 #define FIXED_R2 1
32 /* AIX allows r13 to be used in 32-bit mode. */
33 #define FIXED_R13 0
35 /* AIX does not support Altivec. */
36 #undef TARGET_ALTIVEC
37 #define TARGET_ALTIVEC 0
38 #undef TARGET_ALTIVEC_ABI
39 #define TARGET_ALTIVEC_ABI 0
40 #undef TARGET_ALTIVEC_VRSAVE
41 #define TARGET_ALTIVEC_VRSAVE 0
43 /* The AIX linker will discard static constructors in object files before
44 collect has a chance to see them, so scan the object files directly. */
45 #define COLLECT_EXPORT_LIST
47 /* Handle #pragma weak and #pragma pack. */
48 #define HANDLE_SYSV_PRAGMA 1
50 /* This is the only version of nm that collect2 can work with. */
51 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
53 #define USER_LABEL_PREFIX ""
54 /* Don't turn -B into -L if the argument specifies a relative file name. */
55 #define RELATIVE_PREFIX_NOT_LINKDIR
57 /* Because of the above, we must have gcc search itself to find libgcc.a. */
58 #define LINK_LIBGCC_SPECIAL_1
60 /* Names to predefine in the preprocessor for this target machine. */
61 #define TARGET_OS_AIX_CPP_BUILTINS() \
62 do \
63 { \
64 builtin_define ("_IBMR2"); \
65 builtin_define ("_POWER"); \
66 builtin_define ("_AIX"); \
67 builtin_define ("_AIX32"); \
68 builtin_define ("_AIX41"); \
69 builtin_define ("_LONG_LONG"); \
70 if (TARGET_LONG_DOUBLE_128) \
71 builtin_define ("__LONGDOUBLE128"); \
72 builtin_assert ("system=unix"); \
73 builtin_assert ("system=aix"); \
74 } \
75 while (0)
77 /* Define appropriate architecture macros for preprocessor depending on
78 target switches. */
80 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
81 %{ansi: -D_ANSI_C_SOURCE}"
83 #undef ASM_DEFAULT_SPEC
84 #define ASM_DEFAULT_SPEC ""
86 /* Tell the assembler to assume that all undefined names are external.
88 Don't do this until the fixed IBM assembler is more generally available.
89 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
90 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
91 longer be needed. Also, the extern declaration of mcount in
92 rs6000_xcoff_file_start will no longer be needed. */
94 /* #define ASM_SPEC "-u %(asm_cpu)" */
96 /* Default location of syscalls.exp under AIX */
97 #ifndef CROSS_COMPILE
98 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
99 #else
100 #define LINK_SYSCALLS_SPEC ""
101 #endif
103 /* Default location of libg.exp under AIX */
104 #ifndef CROSS_COMPILE
105 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
106 #else
107 #define LINK_LIBG_SPEC ""
108 #endif
110 /* Define the options for the binder: Start text at 512, align all segments
111 to 512 bytes, and warn if there is text relocation.
113 The -bhalt:4 option supposedly changes the level at which ld will abort,
114 but it also suppresses warnings about multiply defined symbols and is
115 used by the AIX cc command. So we use it here.
117 -bnodelcsect undoes a poor choice of default relating to multiply-defined
118 csects. See AIX documentation for more information about this.
120 -bM:SRE tells the linker that the output file is Shared REusable. Note
121 that to actually build a shared library you will also need to specify an
122 export list with the -Wl,-bE option. */
124 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
125 %{static:-bnso %(link_syscalls) } \
126 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
128 /* Profiled library versions are used by linking with special directories. */
129 #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
130 %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
132 /* This now supports a natural alignment mode. */
133 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
134 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
135 (TARGET_ALIGN_NATURAL ? (COMPUTED) : \
136 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
137 ? get_inner_array_type (FIELD) \
138 : TREE_TYPE (FIELD)) == DFmode \
139 ? MIN ((COMPUTED), 32) : (COMPUTED)))
141 /* AIX increases natural record alignment to doubleword if the first
142 field is an FP double while the FP fields remain word aligned. */
143 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
144 ((TREE_CODE (STRUCT) == RECORD_TYPE \
145 || TREE_CODE (STRUCT) == UNION_TYPE \
146 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
147 && TARGET_ALIGN_NATURAL == 0 \
148 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
149 : MAX ((COMPUTED), (SPECIFIED)))
151 /* The AIX ABI isn't explicit on whether aggregates smaller than a
152 word/doubleword should be padded upward or downward. One could
153 reasonably assume that they follow the normal rules for structure
154 layout treating the parameter area as any other block of memory,
155 then map the reg param area to registers, i.e., pad upward, which
156 is the way IBM Compilers for AIX behave.
157 Setting both of the following defines results in this behavior. */
158 #define AGGREGATE_PADDING_FIXED 1
159 #define AGGREGATES_PAD_UPWARD_ALWAYS 1
161 /* We don't want anything in the reg parm area being passed on the
162 stack. */
163 #define MUST_PASS_IN_STACK(MODE, TYPE) \
164 ((TYPE) != 0 \
165 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
166 || TREE_ADDRESSABLE (TYPE)))
168 /* Specify padding for the last element of a block move between
169 registers and memory. FIRST is nonzero if this is the only
170 element. */
171 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
172 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
174 /* Indicate that jump tables go in the text section. */
176 #define JUMP_TABLES_IN_TEXT_SECTION 1
178 /* Enable AIX XL compiler calling convention breakage compatibility. */
179 #undef TARGET_XL_CALL
180 #define MASK_XL_CALL 0x40000000
181 #define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
182 #undef SUBTARGET_SWITCHES
183 #define SUBTARGET_SWITCHES \
184 {"xl-call", MASK_XL_CALL, \
185 N_("Always pass floating-point arguments in memory") }, \
186 {"no-xl-call", - MASK_XL_CALL, \
187 N_("Don't always pass floating-point arguments in memory") }, \
188 SUBSUBTARGET_SWITCHES
189 #define SUBSUBTARGET_SWITCHES
191 /* Define any extra SPECS that the compiler needs to generate. */
192 #undef SUBTARGET_EXTRA_SPECS
193 #define SUBTARGET_EXTRA_SPECS \
194 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
195 { "link_libg", LINK_LIBG_SPEC }
197 /* Define cutoff for using external functions to save floating point. */
198 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
200 /* __throw will restore its own return address to be the same as the
201 return address of the function that the throw is being made to.
202 This is unfortunate, because we want to check the original
203 return address to see if we need to restore the TOC.
204 So we have to squirrel it away with this. */
205 #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
207 /* If the current unwind info (FS) does not contain explicit info
208 saving R2, then we have to do a minor amount of code reading to
209 figure out if it was saved. The big problem here is that the
210 code that does the save/restore is generated by the linker, so
211 we have no good way to determine at compile time what to do. */
213 #ifdef __powerpc64__
214 #define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
215 do { \
216 if ((FS)->regs.reg[2].how == REG_UNSAVED) \
218 unsigned int *insn \
219 = (unsigned int *) \
220 _Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \
221 if (*insn == 0xE8410028) \
222 _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \
224 } while (0)
225 #else
226 #define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
227 do { \
228 if ((FS)->regs.reg[2].how == REG_UNSAVED) \
230 unsigned int *insn \
231 = (unsigned int *) \
232 _Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \
233 if (*insn == 0x80410014) \
234 _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 20); \
236 } while (0)
237 #endif
239 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
241 /* Print subsidiary information on the compiler version in use. */
242 #define TARGET_VERSION ;
244 /* No version of AIX fully supports AltiVec or 64-bit instructions in
245 32-bit mode. */
246 #define OS_MISSING_POWERPC64 1
247 #define OS_MISSING_ALTIVEC 1