]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/aix.h
revert: rs6000.c (logical_operand): CONST_INTs are already sign-extended.
[thirdparty/gcc.git] / gcc / config / rs6000 / aix.h
1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 POWER running AIX.
3 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Yes! We are AIX! */
23 #define DEFAULT_ABI ABI_AIX
24 #undef TARGET_AIX
25 #define TARGET_AIX 1
26 /* The AIX linker will discard static constructors in object files before
27 collect has a chance to see them, so scan the object files directly. */
28 #define COLLECT_EXPORT_LIST
29
30 /* This is the only version of nm that collect2 can work with. */
31 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
32
33 #define USER_LABEL_PREFIX ""
34 /* Don't turn -B into -L if the argument specifies a relative file name. */
35 #define RELATIVE_PREFIX_NOT_LINKDIR
36
37 /* Because of the above, we must have gcc search itself to find libgcc.a. */
38 #define LINK_LIBGCC_SPECIAL_1
39
40 /* Names to predefine in the preprocessor for this target machine. */
41 #define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_LONG_LONG \
42 -Asystem=unix -Asystem=aix -Acpu=rs6000 -Amachine=rs6000"
43
44 /* Define appropriate architecture macros for preprocessor depending on
45 target switches. */
46
47 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
48 %{ansi: -D_ANSI_C_SOURCE}\
49 %(cpp_cpu)"
50
51 #undef CPP_DEFAULT_SPEC
52 #define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
53
54 #undef ASM_DEFAULT_SPEC
55 #define ASM_DEFAULT_SPEC ""
56
57 /* Tell the assembler to assume that all undefined names are external.
58
59 Don't do this until the fixed IBM assembler is more generally available.
60 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
61 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
62 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
63 will no longer be needed. */
64
65 /* #define ASM_SPEC "-u %(asm_cpu)" */
66
67 /* Default location of syscalls.exp under AIX */
68 #ifndef CROSS_COMPILE
69 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
70 #else
71 #define LINK_SYSCALLS_SPEC ""
72 #endif
73
74 /* Default location of libg.exp under AIX */
75 #ifndef CROSS_COMPILE
76 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
77 #else
78 #define LINK_LIBG_SPEC ""
79 #endif
80
81 /* Define the options for the binder: Start text at 512, align all segments
82 to 512 bytes, and warn if there is text relocation.
83
84 The -bhalt:4 option supposedly changes the level at which ld will abort,
85 but it also suppresses warnings about multiply defined symbols and is
86 used by the AIX cc command. So we use it here.
87
88 -bnodelcsect undoes a poor choice of default relating to multiply-defined
89 csects. See AIX documentation for more information about this.
90
91 -bM:SRE tells the linker that the output file is Shared REusable. Note
92 that to actually build a shared library you will also need to specify an
93 export list with the -Wl,-bE option. */
94
95 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
96 %{static:-bnso %(link_syscalls) } \
97 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
98
99 /* Profiled library versions are used by linking with special directories. */
100 #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
101 %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
102
103 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
104 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
105 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
106 ? get_inner_array_type (FIELD) \
107 : TREE_TYPE (FIELD)) == DFmode \
108 ? MIN ((COMPUTED), 32) : (COMPUTED))
109
110 /* AIX increases natural record alignment to doubleword if the first
111 field is an FP double while the FP fields remain word aligned. */
112 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
113 ((TREE_CODE (STRUCT) == RECORD_TYPE \
114 || TREE_CODE (STRUCT) == UNION_TYPE \
115 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
116 && TYPE_FIELDS (STRUCT) != 0 \
117 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
118 ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
119 : MAX ((COMPUTED), (SPECIFIED)))
120
121
122
123 /* Indicate that jump tables go in the text section. */
124
125 #define JUMP_TABLES_IN_TEXT_SECTION 1
126
127 /* Enable AIX XL compiler calling convention breakage compatibility. */
128 #undef TARGET_XL_CALL
129 #define MASK_XL_CALL 0x40000000
130 #define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
131 #undef SUBTARGET_SWITCHES
132 #define SUBTARGET_SWITCHES \
133 {"xl-call", MASK_XL_CALL, \
134 N_("Always pass floating-point arguments in memory") }, \
135 {"no-xl-call", - MASK_XL_CALL, \
136 N_("Don't always pass floating-point arguments in memory") }, \
137 SUBSUBTARGET_SWITCHES
138 #define SUBSUBTARGET_SWITCHES
139
140 /* Define any extra SPECS that the compiler needs to generate. */
141 #undef SUBTARGET_EXTRA_SPECS
142 #define SUBTARGET_EXTRA_SPECS \
143 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
144 { "link_libg", LINK_LIBG_SPEC }
145
146 /* Define cutoff for using external functions to save floating point. */
147 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
148
149 /* Optabs entries for the int->float routines and quad FP operations
150 using the standard AIX names. */
151 #define ADDTF3_LIBCALL "_xlqadd"
152 #define DIVTF3_LIBCALL "_xlqdiv"
153 #define MULTF3_LIBCALL "_xlqmul"
154 #define SUBTF3_LIBCALL "_xlqsub"
155
156 #define INIT_TARGET_OPTABS \
157 do { \
158 if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \
159 { \
160 fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \
161 fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \
162 } \
163 if (TARGET_HARD_FLOAT) \
164 { \
165 add_optab->handlers[(int) TFmode].libfunc \
166 = init_one_libfunc (ADDTF3_LIBCALL); \
167 sub_optab->handlers[(int) TFmode].libfunc \
168 = init_one_libfunc (SUBTF3_LIBCALL); \
169 smul_optab->handlers[(int) TFmode].libfunc \
170 = init_one_libfunc (MULTF3_LIBCALL); \
171 sdiv_optab->handlers[(int) TFmode].libfunc \
172 = init_one_libfunc (DIVTF3_LIBCALL); \
173 } \
174 } while (0)
175
176 /* AIX always has a TOC. */
177 #define TARGET_NO_TOC 0
178 #define TARGET_TOC 1
179
180 #define FIXED_R2 1
181 /* AIX allows r13 to be used. */
182 #define FIXED_R13 0
183
184 /* __throw will restore its own return address to be the same as the
185 return address of the function that the throw is being made to.
186 This is unfortunate, because we want to check the original
187 return address to see if we need to restore the TOC.
188 So we have to squirrel it away with this. */
189 #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
190
191 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)