From d0d816ec5bd9c458f1ff735aa15b9998c369b6c1 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Sat, 9 Aug 2008 18:11:19 +0000 Subject: gcc/ * config/mips/mips.h (STATIC_CHAIN_REGNUM): Remap to $15. (FUNCTION_PROFILER): Save the static chain pointer into $2 beforehand and restore it aftewards. (TRAMPOLINE_TEMPLATE): Adjust accordingly. Load the target address directly into $25 and call the function through $25; do not clobber $3. Pad the DImode version to cover the space left by the deleted $25 <- $3 move. (TRAMPOLINE_SIZE): Adjust the size of the SImode version after the removal of the $25 <- $3 move. (INITIALIZE_TRAMPOLINE): Update offsets accordingly. * config/mips/sdemtk.h (FUNCTION_PROFILER): As for mips.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138909 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/mips/sdemtk.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/config/mips/sdemtk.h') diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h index a73e7d2d7b3..f6b60970727 100644 --- a/gcc/config/mips/sdemtk.h +++ b/gcc/config/mips/sdemtk.h @@ -94,12 +94,20 @@ extern void mips_sync_icache (void *beg, unsigned long len); #define FUNCTION_PROFILER(FILE, LABELNO) \ { \ fprintf (FILE, "\t.set\tnoat\n"); \ + /* _mcount treats $2 as the static chain register. */ \ + if (cfun->static_chain_decl != NULL) \ + fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \ + reg_names[STATIC_CHAIN_REGNUM]); \ /* MIPS16 code passes saved $ra in $v1 instead of $at. */ \ fprintf (FILE, "\tmove\t%s,%s\n", \ reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \ reg_names[GP_REG_FIRST + 31]); \ 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) \ + fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \ + reg_names[2]); \ } /* ...nor does the call sequence preserve $31. */ -- cgit v1.2.1