Commit a5fa1ecd by Jan Hubicka Committed by Jan Hubicka

i386-protos.h (x86_function_profiler): New function

	* i386-protos.h (x86_function_profiler): New function
	* i386.h (MCOUNT_NAME): New.
	(PROFILE_COUNT_REGISTER): New.
	(OUTPUT_FUNCTION_PROFILER): Move offline to ...
	* i386.c (x86_function_profiler) ... here; fix 64bit support
	* beos-elf.h (FUNCTION_PROFILER): Kill.
	(MCOUNT_NAME): New.
	* freebsd-aout.h (FUNCTION_PROFILER): Kill.
	(MCOUNT_NAME): New.
	(PROFILE_COUNT_REGISTER): New.
	* linux.h (FUNCTION_PROFILER): Kill.
	(MCOUNT_NAME): New.
	* x86-64.h (FUNCTION_PROFILER): Kill.
	(MCOUNT_NAME): New.
	* freebsd.h (FUNCTION_PROFILER): Kill.
	(MCOUNT_NAME): New.

From-SVN: r59132
parent f7109dea
Fri Nov 15 14:54:19 CET 2002 Jan Hubicka <jh@suse.cz>
* i386-protos.h (x86_function_profiler): New function
* i386.h (MCOUNT_NAME): New.
(PROFILE_COUNT_REGISTER): New.
(OUTPUT_FUNCTION_PROFILER): Move offline to ...
* i386.c (x86_function_profiler) ... here; fix 64bit support
* beos-elf.h (FUNCTION_PROFILER): Kill.
(MCOUNT_NAME): New.
* freebsd-aout.h (FUNCTION_PROFILER): Kill.
(MCOUNT_NAME): New.
(PROFILE_COUNT_REGISTER): New.
* linux.h (FUNCTION_PROFILER): Kill.
(MCOUNT_NAME): New.
* x86-64.h (FUNCTION_PROFILER): Kill.
(MCOUNT_NAME): New.
* freebsd.h (FUNCTION_PROFILER): Kill.
(MCOUNT_NAME): New.
2002-11-14 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
* config/arm/arm.h (EXPAND_BUILTIN_VA_ARG,
......
......@@ -40,21 +40,8 @@ Boston, MA 02111-1307, USA. */
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
{ \
fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
LPREFIX, (LABELNO)); \
fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
} \
else \
{ \
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
fprintf (FILE, "\tcall mcount\n"); \
} \
}
#undef MCOUNT_NAME
#define MCOUNT_NAME "mcount"
#undef SIZE_TYPE
#define SIZE_TYPE "long unsigned int"
......
......@@ -94,22 +94,10 @@ Boston, MA 02111-1307, USA. */
/* Profiling routines, partially copied from i386/osfrose.h. */
/* Redefine this to use %eax instead of %edx. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
{ \
fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
LPREFIX, (LABELNO)); \
fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
} \
else \
{ \
fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
fprintf (FILE, "\tcall mcount\n"); \
} \
}
#undef MCOUNT_NAME
#define MCOUNT_NAME "mcount"
#undef PROFILE_COUNT_REGISTER
#define PROFILE_COUNT_REGISTER "eax"
/*
* Some imports from svr4.h in support of shared libraries.
......
......@@ -47,14 +47,8 @@ Boston, MA 02111-1307, USA. */
/* Tell final.c that we don't need a label passed to mcount. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
fprintf ((FILE), "\tcall *.mcount@GOT(%%ebx)\n"); \
else \
fprintf ((FILE), "\tcall .mcount\n"); \
}
#undef MCOUNT_NAME
#define MCOUNT_NAME ".mcount"
/* Make gcc agree with <machine/ansi.h>. */
......
......@@ -184,6 +184,7 @@ extern void ix86_set_move_mem_attrs PARAMS ((rtx, rtx, rtx, rtx, rtx));
extern void emit_i387_cw_initialization PARAMS ((rtx, rtx));
extern bool ix86_fp_jump_nontrivial_p PARAMS ((enum rtx_code));
extern void x86_order_regs_for_local_alloc PARAMS ((void));
extern void x86_function_profiler PARAMS ((FILE *, int));
#ifdef TREE_CODE
......
......@@ -14297,6 +14297,46 @@ x86_field_alignment (field, computed)
return computed;
}
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
void
x86_function_profiler (file, labelno)
FILE *file;
int labelno;
{
if (TARGET_64BIT)
if (flag_pic)
{
#ifndef NO_PROFILE_COUNTERS
fprintf (file, "\tleaq\t%sP%d@(%%rip),%%r11\n", LPREFIX, labelno);
#endif
fprintf (file, "\tcall\t*%s@GOTPCREL(%%rip)\n", MCOUNT_NAME);
}
else
{
#ifndef NO_PROFILE_COUNTERS
fprintf (file, "\tmovq\t$%sP%d,%%r11\n", LPREFIX, labelno);
#endif
fprintf (file, "\tcall\t%s\n", MCOUNT_NAME);
}
else if (flag_pic)
{
#ifndef NO_PROFILE_COUNTERS
fprintf (file, "\tleal\t%sP%d@GOTOFF(%%ebx),%%%s\n",
LPREFIX, labelno, PROFILE_COUNT_REGISTER);
#endif
fprintf (file, "\tcall\t*%s@GOT(%%ebx)\n", MCOUNT_NAME);
}
else
{
#ifndef NO_PROFILE_COUNTERS
fprintf (file, "\tmovl\t$%sP%d,%%$s\n", LPREFIX, labelno,
PROFILE_COUNT_REGISTER);
#endif
fprintf (file, "\tcall\t%s\n", MCOUNT_NAME);
}
}
/* Implement machine specific optimizations.
At the moment we implement single transformation: AMD Athlon works faster
when RET is not destination of conditional jump or directly preceeded
......
......@@ -1758,20 +1758,11 @@ typedef struct ix86_args {
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
#define FUNCTION_PROFILER(FILE, LABELNO) \
do { \
if (flag_pic) \
{ \
fprintf ((FILE), "\tleal\t%sP%d@GOTOFF(%%ebx),%%edx\n", \
LPREFIX, (LABELNO)); \
fprintf ((FILE), "\tcall\t*_mcount@GOT(%%ebx)\n"); \
} \
else \
{ \
fprintf ((FILE), "\tmovl\t$%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
fprintf ((FILE), "\tcall\t_mcount\n"); \
} \
} while (0)
#define FUNCTION_PROFILER(FILE, LABELNO) x86_function_profiler (FILE, LABELNO)
#define MCOUNT_NAME "_mcount"
#define PROFILE_COUNT_REGISTER "edx"
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter. The value is tested only in
......
......@@ -53,14 +53,8 @@ Boston, MA 02111-1307, USA. */
#define NO_PROFILE_COUNTERS
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
fprintf (FILE, "\tcall\t*mcount@GOT(%%ebx)\n"); \
else \
fprintf (FILE, "\tcall\tmcount\n"); \
}
#undef MCOUNT_NAME
#define MCOUNT_NAME "mcount"
/* The GLIBC version of mcount for the x86 assumes that there is a
frame, so we cannot allow profiling without a frame pointer. */
......
......@@ -29,16 +29,8 @@ Boston, MA 02111-1307, USA. */
/* Output assembler code to FILE to call the profiler. */
#define NO_PROFILE_COUNTERS
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (TARGET_64BIT && flag_pic) \
fprintf (FILE, "\tcall\t*mcount@PLT\n"); \
else if (flag_pic) \
fprintf (FILE, "\tcall\t*mcount@GOT(%%ebx)\n"); \
else \
fprintf (FILE, "\tcall\tmcount\n"); \
}
#undef MCOUNT_NAME
#define MCOUNT_NAME mcount
#undef SIZE_TYPE
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment