diff options
author | Doug Evans <dje@gnu.org> | 1996-03-29 20:45:31 +0000 |
---|---|---|
committer | Doug Evans <dje@gnu.org> | 1996-03-29 20:45:31 +0000 |
commit | 6f334f4405d90f7d34f6354ca59bcd3f2579aae9 (patch) | |
tree | 39cbff4c515175579f623f86fd339d62e9400f91 | |
parent | 0a78e86253db82240953e120ea10084870697d61 (diff) | |
download | gcc-6f334f4405d90f7d34f6354ca59bcd3f2579aae9.zip gcc-6f334f4405d90f7d34f6354ca59bcd3f2579aae9.tar.gz gcc-6f334f4405d90f7d34f6354ca59bcd3f2579aae9.tar.bz2 |
sparc.h (FUNCTION_PROFILER): Save/restore %g2 around call to mcount.
* sparc/sparc.h (FUNCTION_PROFILER): Save/restore %g2 around call
to mcount.
From-SVN: r11644
-rw-r--r-- | gcc/config/sparc/sparc.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index e811359..c2b136b 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -1657,10 +1657,17 @@ extern int leaf_function; : output_function_prologue (FILE, SIZE, leaf_function)) /* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ + for profiling a function entry. + + 32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered + during profiling so we need to save/restore it around the call to mcount. + We're guaranteed that a save has just been done, and we use the space + allocated for intreg/fpreg value passing. */ #define FUNCTION_PROFILER(FILE, LABELNO) \ do { \ + if (! TARGET_ARCH64) \ + fputs ("\tst %g2,[%fp-4]\n", FILE); \ fputs ("\tsethi %hi(", (FILE)); \ ASM_OUTPUT_INTERNAL_LABELREF (FILE, "LP", LABELNO); \ fputs ("),%o0\n", (FILE)); \ @@ -1670,9 +1677,10 @@ extern int leaf_function; fputs ("\tcall mcount\n\tadd %lo(", (FILE)); \ ASM_OUTPUT_INTERNAL_LABELREF (FILE, "LP", LABELNO); \ fputs ("),%o0,%o0\n", (FILE)); \ + if (! TARGET_ARCH64) \ + fputs ("\tld [%fp-4],%g2\n", FILE); \ } while (0) - /* There are three profiling modes for basic blocks available. The modes are selected at compile time by using the options -a or -ax of the gnu compiler. |