This is the mail archive of the 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]

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

Hello Richard,

thanks for the review.

2010/7/16 Richard Henderson <>:
> On 07/15/2010 11:08 AM, Kai Tietz wrote:
>> ? ? ? (override_options): Add special handling for -mfentry.
>> ? ? ? (ix86_function_regparm): Likewise.
>> ? ? ? (ix86_function_sseregparm): Likewise.
> Why are you adding the special-casing to the two regparm functions?
> You do realize that suddenly your mcount_top function may have zero
> free registers with which to do its job. ?I think that's a bad idea.

Well, as the mcount before prologue call has to be transparent (saving
and restoring all modified registers) I don't see here, that no
registers are a problem.

>> ? ? ? (ix86_save_reg):
>> ? ? ? (ix86_expand_prologue):
>> ? ? ? (x86_function_profiler):
> No changes? ?;-)
Well, missed the Likewise :}

> x86_function_profiler is broken for -m32 -fentry -fpic. ?It uses
> %ebx which has not been set up. ?I think perhaps this combination
> cannot really be supported, and this should be diagnosed back in
> override_options.

Yeah, add it to my update patch.

>> +It returns true if target wants profile code emitted before
>> +prologue.
>> +
>> +The default version of this hook use the target macro
>> +@end deftypefn
> The text should go in target.def, in the ""; only the @hook line goes here.

Ok, moved into target.def (btw I think it is one of the first hooks
using this feature).

So by discussion on IRC some changes to checks about fpic are
superflous, as they can't be reached in fact. So I removed the
additional checks here about flag_fentry.
The option -fpic for x86 is indeed not possible for profiling and
-mfentry. So I added a sorry and default back to profiling after
prologue, which setups ebx correctly.


	* config/i386/cygming.h (MCOUNT_NAME): New.
	* config/i386/i386.c (ix86_profile_before_prologue): New.
	(override_options): Add special handling for -mfentry.
	(ix86_function_regparm): Likewise.
	(ix86_function_sseregparm): Likewise.
	(ix86_frame_pointer_required): Likewise.
	(ix86_expand_prologue): Check for ms_hook_prologue.
	(x86_function_profiler): Adjust mcount output.
	* config/i386/i386.opt (mfentry): New.
	* doc/invoke.texi (mfentry): Add documentation.
	* doc/tm.texi: Regenerated..
	* final.c (final_start_function): Replace macro
	* function.c (thread_prologue_and_epilogue_insns): Likewise.
	* target.def (profile_before_prologue): New hook.
	* targhooks.c (default_profile_before_prologue): New.
	* targhooks.h (default_profile_before_prologue): New.

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


|? (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Attachment: profileb.diff
Description: Binary data

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