This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[sh-elf-4_1] linux specific patch (1/2) (applied)


Hi,

I've checked the attached patch for sh64-linux in on sh-elf-4_1
branch.  It adds an SHmedia version of FUNCTION_PROFILER.  Tested
on sh64-unknown-linux-gnu and sh4-unknown-linux-gnu.

Regards,
	kaz
--
2005-05-08  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/linux.h (FUNCTION_PROFILER): Provide SHMEDIA version.

diff -uprN ORIG/gcc-4.1-sh/gcc/config/sh/linux.h LOCAL/gcc-4.1-sh/gcc/config/sh/linux.h
--- ORIG/gcc-4.1-sh/gcc/config/sh/linux.h	2005-05-06 07:14:20.000000000 +0900
+++ LOCAL/gcc-4.1-sh/gcc/config/sh/linux.h	2005-05-06 07:22:27.596837063 +0900
@@ -68,29 +68,56 @@ Boston, MA 02111-1307, USA.  */
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(STREAM,LABELNO)				\
   do {									\
-    if (flag_pic)							\
+    if (TARGET_SHMEDIA)							\
       {									\
-	fprintf (STREAM, "\tmov.l\t3f,r1\n");				\
-	fprintf (STREAM, "\tmova\t3f,r0\n");				\
-	fprintf (STREAM, "\tadd\tr1,r0\n");				\
-	fprintf (STREAM, "\tmov.l\t1f,r1\n");				\
-	fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");			\
+	fprintf (STREAM, "\tpt\t1f,tr1\n");				\
+	fprintf (STREAM, "\taddi.l\tr15,-8,r15\n");			\
+	fprintf (STREAM, "\tst.l\tr15,0,r18\n");			\
+	if (flag_pic)							\
+	  {								\
+	    char *gofs = "(datalabel _GLOBAL_OFFSET_TABLE_-(0f-.))";	\
+	    fprintf (STREAM, "\tmovi\t((%s>>16)&0xffff),r21\n", gofs);	\
+	    fprintf (STREAM, "\tshori\t(%s & 0xffff),r21\n", gofs);	\
+	    fprintf (STREAM, "0:\tptrel/u\tr21,tr0\n");			\
+	    fprintf (STREAM, "\tmovi\t((mcount@GOTPLT)&0xffff),r22\n");	\
+	    fprintf (STREAM, "\tgettr\ttr0,r21\n");			\
+	    fprintf (STREAM, "\tadd.l\tr21,r22,r21\n");			\
+	    fprintf (STREAM, "\tld.l\tr21,0,r21\n");			\
+	    fprintf (STREAM, "\tptabs\tr21,tr0\n");			\
+	  }								\
+	else								\
+	  fprintf (STREAM, "\tpt\tmcount,tr0\n");			\
+	fprintf (STREAM, "\tgettr\ttr1,r18\n");				\
+	fprintf (STREAM, "\tblink\ttr0,r63\n");				\
+	fprintf (STREAM, "1:\tld.l\tr15,0,r18\n");			\
+	fprintf (STREAM, "\taddi.l\tr15,8,r15\n");			\
       }									\
     else								\
-      fprintf (STREAM, "\tmov.l\t1f,r1\n");				\
-    fprintf (STREAM, "\tsts.l\tpr,@-r15\n");				\
-    fprintf (STREAM, "\tmova\t2f,r0\n");				\
-    fprintf (STREAM, "\tjmp\t@r1\n");					\
-    fprintf (STREAM, "\tlds\tr0,pr\n");					\
-    fprintf (STREAM, "\t.align\t2\n");					\
-    if (flag_pic)							\
       {									\
-	fprintf (STREAM, "1:\t.long\tmcount@GOT\n");			\
-	fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");		\
+	if (flag_pic)							\
+	  {								\
+	    fprintf (STREAM, "\tmov.l\t3f,r1\n");			\
+	    fprintf (STREAM, "\tmova\t3f,r0\n");			\
+	    fprintf (STREAM, "\tadd\tr1,r0\n");				\
+	    fprintf (STREAM, "\tmov.l\t1f,r1\n");			\
+	    fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");			\
+	  }								\
+	else								\
+	  fprintf (STREAM, "\tmov.l\t1f,r1\n");				\
+	fprintf (STREAM, "\tsts.l\tpr,@-r15\n");			\
+	fprintf (STREAM, "\tmova\t2f,r0\n");				\
+	fprintf (STREAM, "\tjmp\t@r1\n");				\
+	fprintf (STREAM, "\tlds\tr0,pr\n");				\
+	fprintf (STREAM, "\t.align\t2\n");				\
+	if (flag_pic)							\
+	  {								\
+	    fprintf (STREAM, "1:\t.long\tmcount@GOT\n");		\
+	    fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");	\
+	  }								\
+	else								\
+	  fprintf (STREAM, "1:\t.long\tmcount\n");			\
+	fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");			\
       }									\
-    else								\
-      fprintf (STREAM, "1:\t.long\tmcount\n");				\
-    fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");				\
   } while (0)
 
 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]