[patch] SPU gprof support
Trevor_Smigiel@playstation.sony.com
Trevor_Smigiel@playstation.sony.com
Wed Dec 2 23:53:00 GMT 2009
Hi Ken,
Yes, this patch is OK.
Trevor
* Ken Werner <ken@linux.vnet.ibm.com> [2009-11-25 16:50]:
> Hi,
>
> This patch adds support for the GNU profiler on the SPU. The corresponding
> newlib patches can be found at
> http://sourceware.org/ml/newlib/2008/msg00652.html and
> http://sourceware.org/ml/newlib/2009/msg00411.html.
>
> Ken
> gcc/ChangeLog:
>
> 2009-11-25 Ken Werner <ken.werner@de.ibm.com>
>
> * config/spu/spu-elf.h (STARTFILE_SPEC): Add support for gprof
> startup files.
> * config/spu/spu-protos.h (spu_function_profiler): Add prototype.
> * config/spu/spu.c (spu_function_profiler): New function.
> * config/spu/spu.h (FUNCTION_PROFILER): Invoke
> spu_function_profiler.
> (NO_PROFILE_COUNTERS): Define.
> (PROFILE_BEFORE_PROLOGUE): Likewise.
>
>
> Index: gcc/config/spu/spu-protos.h
> ===================================================================
> --- gcc/config/spu/spu-protos.h (revision 154486)
> +++ gcc/config/spu/spu-protos.h (working copy)
> @@ -85,6 +85,7 @@
> extern void spu_expand_vector_init (rtx target, rtx vals);
> extern void spu_init_expanders (void);
> extern void spu_split_convert (rtx *);
> +extern void spu_function_profiler (FILE *, int);
>
> /* spu-c.c */
> extern tree spu_resolve_overloaded_builtin (location_t, tree fndecl,
> Index: gcc/config/spu/spu.c
> ===================================================================
> --- gcc/config/spu/spu.c (revision 154486)
> +++ gcc/config/spu/spu.c (working copy)
> @@ -7074,4 +7074,11 @@
> }
> }
>
> +void
> +spu_function_profiler (FILE * file, int labelno)
> +{
> + fprintf (file, "# profile\n");
> + fprintf (file, "brsl $75, _mcount\n");
> +}
> +
> #include "gt-spu.h"
> Index: gcc/config/spu/spu.h
> ===================================================================
> --- gcc/config/spu/spu.h (revision 154486)
> +++ gcc/config/spu/spu.h (working copy)
> @@ -393,10 +393,13 @@
>
> /* Profiling */
>
> -/* Nothing, for now. */
> #define FUNCTION_PROFILER(FILE, LABELNO) \
> - fprintf (FILE, "\t\n")
> + spu_function_profiler ((FILE), (LABELNO));
>
> +#define NO_PROFILE_COUNTERS 1
> +
> +#define PROFILE_BEFORE_PROLOGUE 1
> +
>
> /* Trampolines */
>
> Index: gcc/config/spu/spu-elf.h
> ===================================================================
> --- gcc/config/spu/spu-elf.h (revision 154486)
> +++ gcc/config/spu/spu-elf.h (working copy)
> @@ -48,8 +48,9 @@
> object constructed before entering `main'. */
>
> #undef STARTFILE_SPEC
> -#define STARTFILE_SPEC "%{mstdmain: crt2.o%s} %{!mstdmain: crt1.o%s} \
> - crti.o%s crtbegin.o%s"
> +#define STARTFILE_SPEC "%{mstdmain: %{pg|p:gcrt2.o%s;:crt2.o%s}}\
> + %{!mstdmain: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
> + crti.o%s crtbegin.o%s"
>
> #undef ENDFILE_SPEC
> #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
More information about the Gcc-patches
mailing list