This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH/RFC] SH64 EH with pic (4/4)
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org
- Cc: joern dot rennecke at superh dot com, aoliva at redhat dot com
- Date: Sat, 04 Sep 2004 20:32:02 +0900 (JST)
- Subject: [PATCH/RFC] SH64 EH with pic (4/4)
Hi,
This is the last part of the patch to get rid of some problems on sh64
which prevent EH with pic working on this target.
I've found this when I took a look into the failure on unwindtest
which is a testcase in libffi. It is a problem in 32-bit addressing
mode.
The target registers of SHmedia are saved and restored via general
registers. In 32-bit addressing mode, the size of the stack slot
to save/restore target registers is optimized to 4. For example,
TR5 is saved via R0 to 4-byte memory on stack in 32-bit mode.
OTOH, uw_install_context_1 always copies R0 in DImode. Thus the copy
for R0 in uw_install_context_1 may clobber the other slot.
The patch below together with a fixup of sh64 specific part of libffi
which is independent with this problem get rid of the unwindtest failure
and there are no new failures on sh64-unknown-linux-gnu, though I'm
unsure that it's a right thing to do.
Regards,
kaz
--
* config/sh/sh.h (REGISTER_NATURAL_MODE): Return DImode for
SHmedia target registers.
diff -u3p ORIG/gcc/gcc/config/sh/sh.h LOCAL/gcc/gcc/config/sh/sh.h
--- ORIG/gcc/gcc/config/sh/sh.h Thu Aug 19 12:21:08 2004
+++ LOCAL/gcc/gcc/config/sh/sh.h Wed Sep 1 13:08:06 2004
@@ -1143,7 +1143,9 @@ extern char sh_additional_register_names
#define REGISTER_NATURAL_MODE(REGNO) \
(FP_REGISTER_P (REGNO) ? SFmode \
: XD_REGISTER_P (REGNO) ? DFmode \
- : TARGET_SHMEDIA && ! HARD_REGNO_CALL_PART_CLOBBERED ((REGNO), DImode) \
+ : TARGET_SHMEDIA \
+ && (! HARD_REGNO_CALL_PART_CLOBBERED ((REGNO), DImode) \
+ || TARGET_REGISTER_P ((REGNO))) \
? DImode \
: SImode)