OSDN Git Service

2008-09-22 David Daney <ddaney@avtrex.com>
authordaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Sep 2008 19:48:09 +0000 (19:48 +0000)
committerdaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Sep 2008 19:48:09 +0000 (19:48 +0000)
PR target/37593
* config/mips/mips.h (FUNCTION_PROFILER): Call _mcount via a
register if TARGET_LONG_CALLS.

2008-09-22  David Daney  <ddaney@avtrex.com>

PR target/37593
* gcc.target/mips/long-calls-pg.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140563 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/mips.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/long-calls-pg.c [new file with mode: 0644]

index 8e8d9e1..f558558 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-22  David Daney  <ddaney@avtrex.com>
+
+       PR target/37593
+       * config/mips/mips.h (FUNCTION_PROFILER): Call _mcount via a
+       register if TARGET_LONG_CALLS.
+
 2008-09-22  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/37145
index 02a8787..55e240e 100644 (file)
@@ -2263,6 +2263,14 @@ typedef struct mips_args {
 {                                                                      \
   if (TARGET_MIPS16)                                                   \
     sorry ("mips16 function profiling");                               \
+  if (TARGET_LONG_CALLS)                                               \
+    {                                                                  \
+      /*  For TARGET_LONG_CALLS use $3 for the address of _mcount.  */ \
+      if (Pmode == DImode)                                             \
+       fprintf (FILE, "\tdla\t%s,_mcount\n", reg_names[GP_REG_FIRST + 3]); \
+      else                                                             \
+       fprintf (FILE, "\tla\t%s,_mcount\n", reg_names[GP_REG_FIRST + 3]); \
+    }                                                                  \
   fprintf (FILE, "\t.set\tnoat\n");                                    \
   fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n",   \
           reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]);  \
@@ -2279,7 +2287,10 @@ typedef struct mips_args {
               reg_names[STACK_POINTER_REGNUM],                         \
               Pmode == DImode ? 16 : 8);                               \
     }                                                                  \
-  fprintf (FILE, "\tjal\t_mcount\n");                                   \
+  if (TARGET_LONG_CALLS)                                               \
+    fprintf (FILE, "\tjalr\t%s\n", reg_names[GP_REG_FIRST + 3]);       \
+  else                                                                 \
+    fprintf (FILE, "\tjal\t_mcount\n");                                        \
   fprintf (FILE, "\t.set\tat\n");                                      \
   /* _mcount treats $2 as the static chain register.  */               \
   if (cfun->static_chain_decl != NULL)                                 \
index bbc5e33..7522131 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-22  David Daney  <ddaney@avtrex.com>
+
+       PR target/37593
+       * gcc.target/mips/long-calls-pg.c: New test.
+
 2008-09-22  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/37145
diff --git a/gcc/testsuite/gcc.target/mips/long-calls-pg.c b/gcc/testsuite/gcc.target/mips/long-calls-pg.c
new file mode 100644 (file)
index 0000000..7d2d5f1
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -mabi=32 -march=mips32 -fno-pic -pg -mno-abicalls -mlong-calls" } */
+/* { dg-final { scan-assembler-not "\tjal\t_mcount" } } */
+void
+foo (void)
+{
+}