From ffdabaafdbbe46147f72c7240a87e73dfd8e0825 Mon Sep 17 00:00:00 2001 From: daney Date: Mon, 22 Sep 2008 19:48:09 +0000 Subject: [PATCH] 2008-09-22 David Daney PR target/37593 * config/mips/mips.h (FUNCTION_PROFILER): Call _mcount via a register if TARGET_LONG_CALLS. 2008-09-22 David Daney 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 | 6 ++++++ gcc/config/mips/mips.h | 13 ++++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/mips/long-calls-pg.c | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/mips/long-calls-pg.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e8d9e19efe..f558558fbca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-09-22 David Daney + + PR target/37593 + * config/mips/mips.h (FUNCTION_PROFILER): Call _mcount via a + register if TARGET_LONG_CALLS. + 2008-09-22 Richard Guenther PR tree-optimization/37145 diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 02a8787e060..55e240e5217 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 bbc5e339125..752213180b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-22 David Daney + + PR target/37593 + * gcc.target/mips/long-calls-pg.c: New test. + 2008-09-22 Richard Guenther 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 00000000000..7d2d5f16150 --- /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) +{ +} -- 2.11.0