Commit ffcfcb5f by Alan Modra Committed by Alan Modra

linux64.h (MASK_PROFILE_KERNEL): Define.

	* config/rs6000/linux64.h (MASK_PROFILE_KERNEL): Define.
	(TARGET_PROFILE_KERNEL): Define.
	(SUBTARGET_SWITCHES): Handle -mprofile-kernel.
	(PROFILE_BEFORE_PROLOGUE): Don't define.
	(PROFILE_KERNEL): Remove hacks.
	* config/rs6000/rs6000.c (TARGET_PROFILE_KERNEL): Define default.
	(rs6000_stack_info): No need to save lr if just for profiling when
	TARGET_KERNEL_PROFILE.
	(output_profile_hook): Output nothing when TARGET_KERNEL_PROFILE.
	(output_function_profiler): Localize label generation.  Emit code
	for kernel profiling.

From-SVN: r64519
parent 9b98dc74
2003-03-18 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/linux64.h (MASK_PROFILE_KERNEL): Define.
(TARGET_PROFILE_KERNEL): Define.
(SUBTARGET_SWITCHES): Handle -mprofile-kernel.
(PROFILE_BEFORE_PROLOGUE): Don't define.
(PROFILE_KERNEL): Remove hacks.
* config/rs6000/rs6000.c (TARGET_PROFILE_KERNEL): Define default.
(rs6000_stack_info): No need to save lr if just for profiling when
TARGET_KERNEL_PROFILE.
(output_profile_hook): Output nothing when TARGET_KERNEL_PROFILE.
(output_function_profiler): Localize label generation. Emit code
for kernel profiling.
2003-03-17 Kazu Hirata <kazu@cs.umass.edu> 2003-03-17 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300-protos.h: Add a prototype for * config/h8300/h8300-protos.h: Add a prototype for
......
...@@ -63,6 +63,15 @@ Boston, MA 02111-1307, USA. */ ...@@ -63,6 +63,15 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_PROTOTYPE #undef TARGET_PROTOTYPE
#define TARGET_PROTOTYPE 0 #define TARGET_PROTOTYPE 0
/* Reuse sysv4 mask bits we made available above. */
#define MASK_PROFILE_KERNEL 0x08000000
/* Non-standard profiling for kernels, which just saves LR then calls
_mcount without worrying about arg saves. The idea is to change
the function prologue as little as possible as it isn't easy to
account for arg save/restore code added just for _mcount. */
#define TARGET_PROFILE_KERNEL (target_flags & MASK_PROFILE_KERNEL)
/* Override sysv4.h. */ /* Override sysv4.h. */
#undef SUBTARGET_SWITCHES #undef SUBTARGET_SWITCHES
#define SUBTARGET_SWITCHES \ #define SUBTARGET_SWITCHES \
...@@ -89,7 +98,11 @@ Boston, MA 02111-1307, USA. */ ...@@ -89,7 +98,11 @@ Boston, MA 02111-1307, USA. */
{"regnames", MASK_REGNAMES, \ {"regnames", MASK_REGNAMES, \
N_("Use alternate register names") }, \ N_("Use alternate register names") }, \
{"no-regnames", -MASK_REGNAMES, \ {"no-regnames", -MASK_REGNAMES, \
N_("Don't use alternate register names") }, N_("Don't use alternate register names") }, \
{"profile-kernel", MASK_PROFILE_KERNEL, \
N_("Call mcount for profiling before a function prologue") }, \
{"no-profile-kernel", -MASK_PROFILE_KERNEL, \
N_("Call mcount for profiling after a function prologue") },
#undef SUBTARGET_OPTIONS #undef SUBTARGET_OPTIONS
#define SUBTARGET_OPTIONS #define SUBTARGET_OPTIONS
...@@ -99,19 +112,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -99,19 +112,7 @@ Boston, MA 02111-1307, USA. */
/* We use glibc _mcount for profiling. */ /* We use glibc _mcount for profiling. */
#define NO_PROFILE_COUNTERS 1 #define NO_PROFILE_COUNTERS 1
#undef PROFILE_BEFORE_PROLOGUE
/* Define this for kernel profiling, which just saves LR then calls
_mcount without worrying about arg saves. The idea is to change
the function prologue as little as possible as it isn't easy to
account for arg save/restore code added just for _mcount. */
/* #define PROFILE_KERNEL 1 */
#if PROFILE_KERNEL
#define PROFILE_BEFORE_PROLOGUE 1
#undef PROFILE_HOOK
#else
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
#endif
/* We don't need to generate entries in .fixup. */ /* We don't need to generate entries in .fixup. */
#undef RELOCATABLE_NEEDS_FIXUP #undef RELOCATABLE_NEEDS_FIXUP
......
...@@ -335,6 +335,9 @@ static const char alt_reg_names[][8] = ...@@ -335,6 +335,9 @@ static const char alt_reg_names[][8] =
#ifndef MASK_STRICT_ALIGN #ifndef MASK_STRICT_ALIGN
#define MASK_STRICT_ALIGN 0 #define MASK_STRICT_ALIGN 0
#endif #endif
#ifndef TARGET_PROFILE_KERNEL
#define TARGET_PROFILE_KERNEL 0
#endif
/* The VRSAVE bitmask puts bit %v0 as the most significant bit. */ /* The VRSAVE bitmask puts bit %v0 as the most significant bit. */
#define ALTIVEC_REG_BIT(REGNO) (0x80000000 >> ((REGNO) - FIRST_ALTIVEC_REGNO)) #define ALTIVEC_REG_BIT(REGNO) (0x80000000 >> ((REGNO) - FIRST_ALTIVEC_REGNO))
...@@ -9225,7 +9228,9 @@ rs6000_stack_info () ...@@ -9225,7 +9228,9 @@ rs6000_stack_info ()
/* Determine if we need to save the link register. */ /* Determine if we need to save the link register. */
if (rs6000_ra_ever_killed () if (rs6000_ra_ever_killed ()
|| (DEFAULT_ABI == ABI_AIX && current_function_profile) || (DEFAULT_ABI == ABI_AIX
&& current_function_profile
&& !TARGET_PROFILE_KERNEL)
#ifdef TARGET_RELOCATABLE #ifdef TARGET_RELOCATABLE
|| (TARGET_RELOCATABLE && (get_pool_size () != 0)) || (TARGET_RELOCATABLE && (get_pool_size () != 0))
#endif #endif
...@@ -12234,6 +12239,9 @@ void ...@@ -12234,6 +12239,9 @@ void
output_profile_hook (labelno) output_profile_hook (labelno)
int labelno ATTRIBUTE_UNUSED; int labelno ATTRIBUTE_UNUSED;
{ {
if (TARGET_PROFILE_KERNEL)
return;
if (DEFAULT_ABI == ABI_AIX) if (DEFAULT_ABI == ABI_AIX)
{ {
#ifdef NO_PROFILE_COUNTERS #ifdef NO_PROFILE_COUNTERS
...@@ -12285,7 +12293,6 @@ output_function_profiler (file, labelno) ...@@ -12285,7 +12293,6 @@ output_function_profiler (file, labelno)
char buf[100]; char buf[100];
int save_lr = 8; int save_lr = 8;
ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
switch (DEFAULT_ABI) switch (DEFAULT_ABI)
{ {
default: default:
...@@ -12301,6 +12308,7 @@ output_function_profiler (file, labelno) ...@@ -12301,6 +12308,7 @@ output_function_profiler (file, labelno)
warning ("no profiling of 64-bit code for this ABI"); warning ("no profiling of 64-bit code for this ABI");
return; return;
} }
ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
fprintf (file, "\tmflr %s\n", reg_names[0]); fprintf (file, "\tmflr %s\n", reg_names[0]);
if (flag_pic == 1) if (flag_pic == 1)
{ {
...@@ -12355,7 +12363,29 @@ output_function_profiler (file, labelno) ...@@ -12355,7 +12363,29 @@ output_function_profiler (file, labelno)
case ABI_AIX: case ABI_AIX:
case ABI_DARWIN: case ABI_DARWIN:
if (!TARGET_PROFILE_KERNEL)
{
/* Don't do anything, done in output_profile_hook (). */ /* Don't do anything, done in output_profile_hook (). */
}
else
{
if (TARGET_32BIT)
abort ();
asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);
if (current_function_needs_context)
{
asm_fprintf (file, "\tstd %s,24(%s)\n",
reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
asm_fprintf (file, "\tld %s,24(%s)\n",
reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
}
else
fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
}
break; break;
} }
} }
......
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