8sa1-gcc/gcc/config/rs6000/linux.h
Daniel Berlin 2bfcf29777 PowerPC reorg and support for powerpc64-*-linux*.
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
2001-07-31 17:20:20 +00:00

131 lines
4.2 KiB
C

/* Definitions of target machine for GNU compiler,
for powerpc machines running Linux.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation,
Inc.
Contributed by Michael Meissner (meissner@cygnus.com).
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. */
/* Don't assume anything about the header files. */
#define NO_IMPLICIT_EXTERN_C
#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX
#undef CPP_PREDEFINES
#define CPP_PREDEFINES \
"-DPPC -D__ELF__ -Dpowerpc -Acpu=powerpc -Amachine=powerpc"
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
/* The GNU C++ standard library currently requires _GNU_SOURCE being
defined on glibc-based systems. This temporary hack accomplishes this,
it should go away as soon as libstdc++-v3 has a real fix. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "%(lib_linux)"
#undef STARTFILE_DEFAULT_SPEC
#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
#undef ENDFILE_DEFAULT_SPEC
#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
#undef LINK_START_DEFAULT_SPEC
#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
/* Override rs6000.h definition. */
#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"
/* Override rs6000.h definition. */
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
#undef DEFAULT_VTABLE_THUNKS
#ifndef USE_GNULIBC_1
#define DEFAULT_VTABLE_THUNKS 1
#endif
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs. */
#ifdef IN_LIBGCC2
#include <signal.h>
#include <sys/ucontext.h>
enum { SIGNAL_FRAMESIZE = 64 };
#endif
#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
do { \
unsigned char *pc_ = (CONTEXT)->ra; \
struct sigcontext *sc_; \
long new_cfa_; \
int i_; \
\
/* li r0, 0x7777; sc (rt_sigreturn) */ \
/* li r0, 0x6666; sc (sigreturn) */ \
if (((*(unsigned int *) (pc_+0) == 0x38007777) \
|| (*(unsigned int *) (pc_+0) == 0x38006666)) \
&& (*(unsigned int *) (pc_+4) == 0x44000002)) \
sc_ = (CONTEXT)->cfa + SIGNAL_FRAMESIZE; \
else \
break; \
\
new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \
(FS)->cfa_how = CFA_REG_OFFSET; \
(FS)->cfa_reg = STACK_POINTER_REGNUM; \
(FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \
\
for (i_ = 0; i_ < 32; i_++) \
if (i_ != STACK_POINTER_REGNUM) \
{ \
(FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
(FS)->regs.reg[i_].loc.offset \
= (long)&(sc_->regs->gpr[i_]) - new_cfa_; \
} \
\
(FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \
(FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \
= (long)&(sc_->regs->link) - new_cfa_; \
\
/* The unwinder expects the IP to point to the following insn, \
whereas the kernel returns the address of the actual \
faulting insn. */ \
sc_->regs->nip += 4; \
(FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \
(FS)->regs.reg[CR0_REGNO].loc.offset \
= (long)&(sc_->regs->nip) - new_cfa_; \
(FS)->retaddr_column = CR0_REGNO; \
goto SUCCESS; \
} while (0)