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


On 07/13/2010 05:47 AM, Kai Tietz wrote:
> 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.

Huh?  This is exactly the opposite of what we discussed yesterday on IRC.

For hotfix we have

	.rept 16
	.byte 0xcc
	.endr
function:
	mov.s	edi, edi
	push	ebp
	mov.s	esp, ebp

If *any* of the above is not exactly so, then the runtime pattern match
fails and the hotfix fails.  If we were to write the profiler first,
then we might as well not bother with the hotfix pieces, because they
will never match.

... of course it doesn't help that we emit the last two insns above
within the prologue, so if we simply place the profile before the 
prologue, we'll *still* be splitting the hotfix sequence for 32-bit.

I think the best thing to do is to diagnose hotfix+profile and generate
an error.  I don't think there's anything reasonable we can do.

In the end I don't think there's anything your AT_TOP macro does that 
PROFILE_BEFORE_PROLOGUE doesn't do just as well.


r~


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