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]

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


2010/7/18 Kai Tietz <ktietz70@googlemail.com>:
> Hello,
>
> I found one missing nit for cygwin/mingw, which is corrected by this
> patch. For win32 target an initial call to _monstartup has to be done
> in main before mcount get called. For this I added to cygming.h the
> new macro PROFILE_HOOK_BEFORE_PROFILE to handle it.
>
> So new patch with updated ChangeLog
>
> ? ? ? ?* config/i386/cygming.h (MCOUNT_NAME): New.
> ? ? ? ?(MCOUNT_NAME_BEFORE_PROLOGUE): New.
> ? ? ? ?(PROFILE_HOOK_BEFORE_PROFILE): New.
> ? ? ? ?(PROFILE_HOOK): Check if not fentry is active.
> ? ? ? ?* 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 and
> ? ? ? ?call PROFILE_HOOK_BEFORE_PROFILE.
> ? ? ? ?(TARGET_PROFILE_BEFORE_PROLOGUE): Define hook.
> ? ? ? ?* config/i386/i386.opt (mfentry): New.
> ? ? ? ?* doc/invoke.texi (mfentry): Add documentation.
> ? ? ? ?* doc/tm.texi: Regenerated..
> ? ? ? ?* doc/tm.texi.in (TARGET_PROFILE_BEFORE_PROLOGUE): New.
> ? ? ? ?* final.c (final_start_function): Replace macro
> ? ? ? ?PROFILE_BEFORE_PROLOGUE by target hook.
> ? ? ? ?* 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.
>
>
> Tested for i686-pc-mingw32, i686-pc-cygwin, and x86_64-pc-mingw32. Ok for apply?
>
> Regards,
> Kai
>

Hmm, it doesn't hurt, but it seems to me that for old behavior the
monstartup hook got called after the mcount function. So I am not sure
here if the last patch is necessary at all, so withdraw recent patch
and fallback to the patch before.

Sorry for the noise.
Kai

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


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