>What is wrong in emitting the set_got right before the PROLOGUE_END
>note and that way sharing a single load from both?
Can you please explain the idea? Now set_got emitted right after
PROLOGUE_END, what is the advantage in emitting it right before?
Which load is going to be shared?

>This looks just as a hack.
Isn't it similar to what was before but just adding additional "prints"?


On Fri, Oct 24, 2014 at 6:29 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Fri, Oct 24, 2014 at 06:12:15PM +0400, Evgeny Stupachenko wrote:
>> The following patch align stack for mcount and there should be no
>> problems with unwind as ix86_frame_pointer_required is true when
>> crtl->profile is true and flag_fentry is false (we call mcount after
>> function prolog).
>> When flag_fentry is true it is set to false in 32bit PIC mode:
>>   if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && opts->x_flag_pic)
>>     {
>>       if (opts->x_flag_fentry > 0)
>>         sorry ("-mfentry isn%'t supported for 32-bit in combination "
>>       "with -fpic");
>>       opts->x_flag_fentry = 0;
>>     }
>
> What is wrong in emitting the set_got right before the PROLOGUE_END
> note and that way sharing a single load from both?
> This looks just as a hack.
>
>> 2014-10-24  Evgeny Stupachenko  <evstu...@gmail.com>
>>
>>         PR target/63534
>>         * config/i386/i386.c (x86_function_profiler): Add GOT register init
>>         for mcount call.
>>
>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>> index 6235c4f..2dff29c 100644
>> --- a/gcc/config/i386/i386.c
>> +++ b/gcc/config/i386/i386.c
>> @@ -39124,13 +39124,22 @@ x86_function_profiler (FILE *file, int
>> labelno ATTRIBUTE_UNUSED)
>>        else
>>         x86_print_call_or_nop (file, mcount_name);
>>      }
>> +  /* At this stage we can't detrmine where GOT register is, as RA can 
>> allocate
>> +     it to any hard register.  Therefore we need to set it once again.  */
>>    else if (flag_pic)
>>      {
>> +      pic_labels_used |= 1 << BX_REG;
>> +      fprintf (file,"\tsub\t$16, %%esp\n");
>> +      fprintf (file,"\tmovl\t%%ebx, (%%esp)\n");
>> +      fprintf (file,"\tcall\t__x86.get_pc_thunk.bx\n");
>> +      fprintf (file,"\taddl\t$_GLOBAL_OFFSET_TABLE_, %%ebx\n");
>>  #ifndef NO_PROFILE_COUNTERS
>>        fprintf (file, "\tleal\t%sP%d@GOTOFF(%%ebx),%%"
>> PROFILE_COUNT_REGISTER "\n",
>>                LPREFIX, labelno);
>>  #endif
>>        fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name);
>> +      fprintf (file,"\tmovl\t(%%esp), %%ebx\n");
>> +      fprintf (file,"\tadd\t$16, %%esp\n");
>>      }
>>    else
>>      {
>>
>
>         Jakub

Reply via email to