This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch i386]: Add for win32 targets pre-prologue profiling feature


Hello,

This patch adds for i386/x86_64 win32 targets the feature of
pre-prologue profiling call. It additional takes care that for enabled
top-profiler call, the frame-pointer gets omitted, if possible.
One side-note here about "hotfix" and profiling. The top-profiler call
gets emitted in the ix86_asm_output_function_label. This is caused by
the fact, that for ix86 the call needs to be placed before the
code-pattern, and for x86_64 it can be placed after. Otherwise the x86
pattern for patchable region would be corrupted, as this pattern
contains frame-register setup. So I think that the use of the macro
PROFILE_BEFORE_PROLOGUE isn't usable here.

2010-07-13  Kai Tietz

	* config/i386/cygming.h (PROFILE_CALL_AT_TOP): New macro.
	(MCOUNT_NAME): Define specific sub-target macro.
	* config/i386/cygming.opt: New option -fprofile-top.
	* config/i386/i386.c (ix86_function_regparm): Special
	handling for active profiling.
	(ix86_function_sseregparm): Likewise.
	(ix86_frame_pointer_required): Likewise.
	(ix86_select_alt_pic_regnum): Likewise.
	(ix86_save_reg): Likewise.
	(ix86_expand_prologue): Likewise.
	(x86_function_profiler_intern): New internal function.
	(ix86_asm_output_function_label): Output preprologue
	profiler call.
	(x86_function_profiler): Emit profiling after prologue
	when no top-profiling is enabled.
	* config/i386/i386.h (PROFILE_CALL_AT_TOP): Define
	macro by default of zero.
	* doc/invoke.texi (-fprofile-top): Add documentation.

Tested for i686-pc-linux-gnu, x86_64-pc-mingw32, and i686-pc-mingw32.
Ok for apply?

Regards,
Kai

PS: If there is a general interest for this feature for all i386
targets, the patch can be easily adjusted to this.
-- 
|? (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Attachment: profile_top.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]