darwin-asm.h: New file, 32/64-bit assembly macros formerly in darwin-tramp.asm.

* config/rs6000/darwin-asm.h: New file, 32/64-bit assembly macros
        formerly in darwin-tramp.asm.
        * config/rs6000/darwin-tramp.asm: Include darwin-asm.h.
        * config/rs6000/darwin-fpsave.asm: Use 32/64-bit macros.
        * config/rs6000/t-darwin: Add dependencies.

From-SVN: r91960
This commit is contained in:
Stan Shebs 2004-12-09 18:25:15 +00:00 committed by Stan Shebs
parent 366e6bd173
commit dc4d6ffa26
5 changed files with 79 additions and 27 deletions

View File

@ -1,3 +1,11 @@
2004-12-09 Stan Shebs <shebs@apple.com>
* config/rs6000/darwin-asm.h: New file, 32/64-bit assembly macros
formerly in darwin-tramp.asm.
* config/rs6000/darwin-tramp.asm: Include darwin-asm.h.
* config/rs6000/darwin-fpsave.asm: Use 32/64-bit macros.
* config/rs6000/t-darwin: Add dependencies.
2004-12-09 Richard Henderson <rth@redhat.com>
PR target/17025

View File

@ -0,0 +1,61 @@
/* Macro definitions to used to support 32/64-bit code in Darwin's
* assembly files.
*
* Copyright (C) 2004 Free Software Foundation, Inc.
*
* This file 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.
*
* In addition to the permissions in the GNU General Public License, the
* Free Software Foundation gives you unlimited permission to link the
* compiled version of this file with other programs, and to distribute
* those programs without any restriction coming from the use of this
* file. (The General Public License restrictions do apply in other
* respects; for example, they cover modification of the file, and
* distribution when not linked into another program.)
*
* This file 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 this program; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* As a special exception, if you link this library with files
* compiled with GCC to produce an executable, this does not cause the
* resulting executable to be covered by the GNU General Public License.
* This exception does not however invalidate any other reasons why the
* executable file might be covered by the GNU General Public License.
*/
/* These are donated from /usr/include/architecture/ppc . */
#if defined(__ppc64__)
#define MODE_CHOICE(x, y) y
#else
#define MODE_CHOICE(x, y) x
#endif
#define cmpg MODE_CHOICE(cmpw, cmpd)
#define lg MODE_CHOICE(lwz, ld)
#define stg MODE_CHOICE(stw, std)
#define lgx MODE_CHOICE(lwzx, ldx)
#define stgx MODE_CHOICE(stwx, stdx)
#define lgu MODE_CHOICE(lwzu, ldu)
#define stgu MODE_CHOICE(stwu, stdu)
#define lgux MODE_CHOICE(lwzux, ldux)
#define stgux MODE_CHOICE(stwux, stdux)
#define lgwa MODE_CHOICE(lwz, lwa)
#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */
#define GPR_BYTES MODE_CHOICE(4,8) /* size of a GPR in bytes */
#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */
#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* position of saved
LR in frame */

View File

@ -40,10 +40,12 @@
MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */
#include "darwin-asm.h"
.text
.align 2
/* saveFP saves R0 -- assumed to be the callers LR -- to 8(R1). */
/* saveFP saves R0 -- assumed to be the callers LR -- to 8/16(R1). */
.private_extern saveFP
saveFP:
@ -65,10 +67,10 @@ saveFP:
stfd f29,-24(r1)
stfd f30,-16(r1)
stfd f31,-8(r1)
stw r0,8(r1)
stg r0,SAVED_LR_OFFSET(r1)
blr
/* restFP restores the caller`s LR from 8(R1). Note that the code for
/* restFP restores the caller`s LR from 8/16(R1). Note that the code for
this starts at the offset of F30 restoration, so calling this
routine in an attempt to restore only F31 WILL NOT WORK (it would
be a stupid thing to do, anyway.) */
@ -92,7 +94,7 @@ restFP:
lfd f28,-32(r1)
lfd f29,-24(r1)
/* <OFFSET OF F30 RESTORE> restore callers LR */
lwz r0,8(r1)
lg r0,SAVED_LR_OFFSET(r1)
lfd f30,-16(r1)
/* and prepare for return to caller */
mtlr r0

View File

@ -33,29 +33,7 @@
* executable file might be covered by the GNU General Public License.
*/
/* Some 32/64 macros, donated from /usr/include/architecture/ppc . */
#if defined(__ppc64__)
#define MODE_CHOICE(x, y) y
#else
#define MODE_CHOICE(x, y) x
#endif
#define cmpg MODE_CHOICE(cmpw, cmpd)
#define lg MODE_CHOICE(lwz, ld)
#define stg MODE_CHOICE(stw, std)
#define lgx MODE_CHOICE(lwzx, ldx)
#define stgx MODE_CHOICE(stwx, stdx)
#define lgu MODE_CHOICE(lwzu, ldu)
#define stgu MODE_CHOICE(stwu, stdu)
#define lgux MODE_CHOICE(lwzux, ldux)
#define stgux MODE_CHOICE(stwux, stdux)
#define lgwa MODE_CHOICE(lwz, lwa)
#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */
#define GPR_BYTES MODE_CHOICE(4,8) /* size of a GPR in bytes */
#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */
#include "darwin-asm.h"
/* Set up trampolines. */

View File

@ -15,3 +15,6 @@ TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusubtype_ALL
SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
darwin-tramp.o: $(srcdir)/config/rs6000/darwin-asm.h