aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2008-09-22 19:48:09 +0000
committerDavid Daney <daney@gcc.gnu.org>2008-09-22 19:48:09 +0000
commit61debb780ec6a9d5e2d4bfecc5dccaddcfe1bd5d (patch)
tree352e23c3afaac48cc1b3d232b40cd43789597408
parentecb4e37b73d7649a447fe63f33dc20826fce0bb6 (diff)
downloadgcc-61debb780ec6a9d5e2d4bfecc5dccaddcfe1bd5d.zip
gcc-61debb780ec6a9d5e2d4bfecc5dccaddcfe1bd5d.tar.gz
gcc-61debb780ec6a9d5e2d4bfecc5dccaddcfe1bd5d.tar.bz2
re PR target/37593 (-mlong-calls doesn't affect calls to _mcount generated with -pg)
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 David Daney <ddaney@avtrex.com> PR target/37593 * gcc.target/mips/long-calls-pg.c: New test. From-SVN: r140563
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.h13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/mips/long-calls-pg.c7
4 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8e8d9e1..f558558 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 02a8787..55e240e 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -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) \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bbc5e33..7522131 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..7d2d5f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/long-calls-pg.c
@@ -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)
+{
+}