2bfcf29777
2001-07-31 Daniel Berlin <dan@cgsoftware.com> PowerPC reorg and support for powerpc64-*-linux*. Also fixes emitting of constants on 32 bit and 64 bit platforms. * config.gcc: powerpc64-*-linux* is a new target. Things that needed aix.h now also include xcoff.h * config/rs6000/rs6000.h: Split XCOFF specific stuff into xcoff.h. Move AIX specific stuff into aix.h. (ASM_LONG): Use DOUBLE_INT_ASM_OP if we are on a 64 bit target. (ASM_OUTPUT_DOUBLE_INT): Ditto. (TARGET_AIX): Renamed to TARGET_XCOFF, since the AIX ABI is used with more than just XCOFF now. (SET_ASM_OP): Remove, now defined where needed. (FUNCTION_PROLOGUE): New macro definition. (FUNCTION_EPILOGUE): New macro definition. (CONST_OK_FOR_LETTER_P): Change N to require that value is positive, too. (ASM_OPEN_PAREN, ASM_CLOSE_PAREN): New macro definition. (PREDICATE_CODES): Added exact_log2_cint_operand, reg_or_add_cint64_operand, reg_or_sub_cint64_operand. * config/rs6000/rs6000.c: #ifdef XCOFF debugging info stuff on XCOFF_DEBUGGING_INFO. Use DOUBLE_INT_ASM_OP where approriate. (rs6000_emit_set_long_const): New function. (rs6000_emit_set_const): New function. (reg_or_sub_cint64_operand): New function. (reg_or_add_cint64_operand): New function. (exact_log2_cint_operand): New function. * config/rs6000/rs6000.md: Fix emitting of constants. Fix patterns that were AIX ABI specific, but depended on !TARGET_ELF (instead of DEFAULT_ABI == ABI_AIX). * config/rs6000/xcoff.h: New file. * config/rs6000/linux64.h: New file. * config/rs6000/darwin.h: Copy needed AIX alignment definitions. From-SVN: r44516
249 lines
8.5 KiB
C
249 lines
8.5 KiB
C
/* Definitions of target machine for GNU compiler,
|
|
for IBM RS/6000 POWER running AIX.
|
|
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU CC.
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
any later version.
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
/* Yes! We are AIX! */
|
|
#define DEFAULT_ABI ABI_AIX
|
|
#undef TARGET_AIX
|
|
#define TARGET_AIX 1
|
|
/* The AIX linker will discard static constructors in object files before
|
|
collect has a chance to see them, so scan the object files directly. */
|
|
#define COLLECT_EXPORT_LIST
|
|
|
|
/* This is the only version of nm that collect2 can work with. */
|
|
#define REAL_NM_FILE_NAME "/usr/ucb/nm"
|
|
|
|
/* AIX does not have any init/fini or ctor/dtor sections, so create
|
|
static constructors and destructors as normal functions. */
|
|
/* #define ASM_OUTPUT_CONSTRUCTOR(file, name) */
|
|
/* #define ASM_OUTPUT_DESTRUCTOR(file, name) */
|
|
#define USER_LABEL_PREFIX ""
|
|
/* Don't turn -B into -L if the argument specifies a relative file name. */
|
|
#define RELATIVE_PREFIX_NOT_LINKDIR
|
|
|
|
/* Because of the above, we must have gcc search itself to find libgcc.a. */
|
|
#define LINK_LIBGCC_SPECIAL_1
|
|
|
|
/* Names to predefine in the preprocessor for this target machine. */
|
|
#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_LONG_LONG \
|
|
-Asystem=unix -Asystem=aix -Acpu=rs6000 -Amachine=rs6000"
|
|
|
|
/* Define appropriate architecture macros for preprocessor depending on
|
|
target switches. */
|
|
|
|
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
|
|
%{ansi: -D_ANSI_C_SOURCE}\
|
|
%(cpp_cpu)"
|
|
|
|
/* Common CPP definitions used by CPP_SPEC among the various targets
|
|
for handling -mcpu=xxx switches. */
|
|
#define CPP_CPU_SPEC \
|
|
"%{!mcpu*: \
|
|
%{mpower: %{!mpower2: -D_ARCH_PWR}} \
|
|
%{mpower2: -D_ARCH_PWR2} \
|
|
%{mpowerpc*: -D_ARCH_PPC} \
|
|
%{mno-power: %{!mpowerpc*: -D_ARCH_COM}} \
|
|
%{!mno-power: %{!mpower2: %(cpp_default)}}} \
|
|
%{mcpu=common: -D_ARCH_COM} \
|
|
%{mcpu=power: -D_ARCH_PWR} \
|
|
%{mcpu=power2: -D_ARCH_PWR2} \
|
|
%{mcpu=powerpc: -D_ARCH_PPC} \
|
|
%{mcpu=rios: -D_ARCH_PWR} \
|
|
%{mcpu=rios1: -D_ARCH_PWR} \
|
|
%{mcpu=rios2: -D_ARCH_PWR2} \
|
|
%{mcpu=rsc: -D_ARCH_PWR} \
|
|
%{mcpu=rsc1: -D_ARCH_PWR} \
|
|
%{mcpu=401: -D_ARCH_PPC} \
|
|
%{mcpu=403: -D_ARCH_PPC} \
|
|
%{mcpu=505: -D_ARCH_PPC} \
|
|
%{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
|
|
%{mcpu=602: -D_ARCH_PPC} \
|
|
%{mcpu=603: -D_ARCH_PPC} \
|
|
%{mcpu=603e: -D_ARCH_PPC} \
|
|
%{mcpu=ec603e: -D_ARCH_PPC} \
|
|
%{mcpu=604: -D_ARCH_PPC} \
|
|
%{mcpu=604e: -D_ARCH_PPC} \
|
|
%{mcpu=620: -D_ARCH_PPC} \
|
|
%{mcpu=740: -D_ARCH_PPC} \
|
|
%{mcpu=750: -D_ARCH_PPC} \
|
|
%{mcpu=801: -D_ARCH_PPC} \
|
|
%{mcpu=821: -D_ARCH_PPC} \
|
|
%{mcpu=823: -D_ARCH_PPC} \
|
|
%{mcpu=860: -D_ARCH_PPC}"
|
|
|
|
#define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
|
|
|
|
/* Common ASM definitions used by ASM_SPEC among the various targets
|
|
for handling -mcpu=xxx switches. */
|
|
#define ASM_CPU_SPEC \
|
|
"%{!mcpu*: \
|
|
%{mpower: %{!mpower2: -mpwr}} \
|
|
%{mpower2: -mpwrx} \
|
|
%{mpowerpc*: -mppc} \
|
|
%{mno-power: %{!mpowerpc*: -mcom}} \
|
|
%{!mno-power: %{!mpower2: %(asm_default)}}} \
|
|
%{mcpu=common: -mcom} \
|
|
%{mcpu=power: -mpwr} \
|
|
%{mcpu=power2: -mpwrx} \
|
|
%{mcpu=powerpc: -mppc} \
|
|
%{mcpu=rios: -mpwr} \
|
|
%{mcpu=rios1: -mpwr} \
|
|
%{mcpu=rios2: -mpwrx} \
|
|
%{mcpu=rsc: -mpwr} \
|
|
%{mcpu=rsc1: -mpwr} \
|
|
%{mcpu=401: -mppc} \
|
|
%{mcpu=403: -mppc} \
|
|
%{mcpu=505: -mppc} \
|
|
%{mcpu=601: -m601} \
|
|
%{mcpu=602: -mppc} \
|
|
%{mcpu=603: -mppc} \
|
|
%{mcpu=603e: -mppc} \
|
|
%{mcpu=ec603e: -mppc} \
|
|
%{mcpu=604: -mppc} \
|
|
%{mcpu=604e: -mppc} \
|
|
%{mcpu=620: -mppc} \
|
|
%{mcpu=740: -mppc} \
|
|
%{mcpu=750: -mppc} \
|
|
%{mcpu=801: -mppc} \
|
|
%{mcpu=821: -mppc} \
|
|
%{mcpu=823: -mppc} \
|
|
%{mcpu=860: -mppc}"
|
|
|
|
#define ASM_DEFAULT_SPEC ""
|
|
|
|
/* Tell the assembler to assume that all undefined names are external.
|
|
|
|
Don't do this until the fixed IBM assembler is more generally available.
|
|
When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
|
|
ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
|
|
longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
|
|
will no longer be needed. */
|
|
|
|
/* #define ASM_SPEC "-u %(asm_cpu)" */
|
|
|
|
/* Default location of syscalls.exp under AIX */
|
|
#ifndef CROSS_COMPILE
|
|
#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
|
|
#else
|
|
#define LINK_SYSCALLS_SPEC ""
|
|
#endif
|
|
|
|
/* Default location of libg.exp under AIX */
|
|
#ifndef CROSS_COMPILE
|
|
#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
|
|
#else
|
|
#define LINK_LIBG_SPEC ""
|
|
#endif
|
|
|
|
/* Define the options for the binder: Start text at 512, align all segments
|
|
to 512 bytes, and warn if there is text relocation.
|
|
|
|
The -bhalt:4 option supposedly changes the level at which ld will abort,
|
|
but it also suppresses warnings about multiply defined symbols and is
|
|
used by the AIX cc command. So we use it here.
|
|
|
|
-bnodelcsect undoes a poor choice of default relating to multiply-defined
|
|
csects. See AIX documentation for more information about this.
|
|
|
|
-bM:SRE tells the linker that the output file is Shared REusable. Note
|
|
that to actually build a shared library you will also need to specify an
|
|
export list with the -Wl,-bE option. */
|
|
|
|
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
|
%{static:-bnso %(link_syscalls) } \
|
|
%{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
|
|
|
|
/* Profiled library versions are used by linking with special directories. */
|
|
#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
|
|
%{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
|
|
|
|
/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
|
|
#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
|
|
(TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
|
|
? get_inner_array_type (FIELD) \
|
|
: TREE_TYPE (FIELD)) == DFmode \
|
|
? MIN ((COMPUTED), 32) : (COMPUTED))
|
|
|
|
/* AIX increases natural record alignment to doubleword if the first
|
|
field is an FP double while the FP fields remain word aligned. */
|
|
#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
|
|
((TREE_CODE (STRUCT) == RECORD_TYPE \
|
|
|| TREE_CODE (STRUCT) == UNION_TYPE \
|
|
|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
|
|
&& TYPE_FIELDS (STRUCT) != 0 \
|
|
&& DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
|
|
? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
|
|
: MAX ((COMPUTED), (SPECIFIED)))
|
|
|
|
|
|
|
|
/* Indicate that jump tables go in the text section. */
|
|
|
|
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
|
|
|
/* Enable AIX XL compiler calling convention breakage compatibility. */
|
|
#undef TARGET_XL_CALL
|
|
#define MASK_XL_CALL 0x40000000
|
|
#define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
|
|
#undef SUBTARGET_SWITCHES
|
|
#define SUBTARGET_SWITCHES \
|
|
{"xl-call", MASK_XL_CALL, \
|
|
N_("Always pass floating-point arguments in memory") }, \
|
|
{"no-xl-call", - MASK_XL_CALL, \
|
|
N_("Don't always pass floating-point arguments in memory") }, \
|
|
SUBSUBTARGET_SWITCHES
|
|
#define SUBSUBTARGET_SWITCHES
|
|
|
|
/* Define any extra SPECS that the compiler needs to generate. */
|
|
#undef SUBTARGET_EXTRA_SPECS
|
|
#define SUBTARGET_EXTRA_SPECS \
|
|
{ "link_syscalls", LINK_SYSCALLS_SPEC }, \
|
|
{ "link_libg", LINK_LIBG_SPEC }
|
|
|
|
/* Define cutoff for using external functions to save floating point. */
|
|
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
|
|
|
|
/* Optabs entries for the int->float routines, using the standard
|
|
AIX names. */
|
|
#define INIT_TARGET_OPTABS \
|
|
do { \
|
|
if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \
|
|
{ \
|
|
fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \
|
|
fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \
|
|
} \
|
|
} while (0)
|
|
|
|
/* AIX always has a TOC. */
|
|
#define TARGET_NO_TOC 0
|
|
#define TARGET_TOC 1
|
|
|
|
/* AIX allows r13 to be used. */
|
|
#define FIXED_R13 0
|
|
|
|
/* __throw will restore its own return address to be the same as the
|
|
return address of the function that the throw is being made to.
|
|
This is unfortunate, because we want to check the original
|
|
return address to see if we need to restore the TOC.
|
|
So we have to squirrel it away with this. */
|
|
#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
|
|
|
|
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
|