This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[sh-elf-4_1] static chain and -p
- 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 st dot com, aoliva at redhat dot com
- Date: Thu, 05 May 2005 09:34:28 +0900 (JST)
- Subject: [sh-elf-4_1] static chain and -p
Hi,
I've found that the profiling option for the function having
the static chain generates SHcompact instructions even for
SHmedia. The appended patch fixes it.
Ok for the sh-elf-4_1 branch?
Regards,
kaz
--
2005-05-05 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.h (ASM_OUTPUT_REG_PUSH): Provide SHMEDIA version.
(ASM_OUTPUT_REG_POP): Likewise.
diff -uprN ORIG/gcc-4.1-sh/gcc/config/sh/sh.h LOCAL/gcc-4.1-sh/gcc/config/sh/sh.h
--- ORIG/gcc-4.1-sh/gcc/config/sh/sh.h Tue Apr 12 05:56:05 2005
+++ LOCAL/gcc-4.1-sh/gcc/config/sh/sh.h Wed Apr 20 07:28:18 2005
@@ -3247,10 +3269,26 @@ struct sh_args {
}
#define ASM_OUTPUT_REG_PUSH(file, v) \
- fprintf ((file), "\tmov.l\tr%d,@-r15\n", (v));
+{ \
+ if (TARGET_SHMEDIA) \
+ { \
+ fprintf ((file), "\taddi.l\tr15,-8,r15\n"); \
+ fprintf ((file), "\tst.q\tr15,0,r%d\n", (v)); \
+ } \
+ else \
+ fprintf ((file), "\tmov.l\tr%d,@-r15\n", (v)); \
+}
#define ASM_OUTPUT_REG_POP(file, v) \
- fprintf ((file), "\tmov.l\t@r15+,r%d\n", (v));
+{ \
+ if (TARGET_SHMEDIA) \
+ { \
+ fprintf ((file), "\tld.q\tr15,0,r%d\n", (v)); \
+ fprintf ((file), "\taddi.l\tr15,8,r15\n"); \
+ } \
+ else \
+ fprintf ((file), "\tmov.l\t@r15+,r%d\n", (v)); \
+}
/* DBX register number for a given compiler register number. */
/* GDB has FPUL at 23 and FP0 at 25, so we must add one to all FP registers