One issue with default implementation of zero_call_used_regs

Qing Zhao QING.ZHAO@ORACLE.COM
Fri Sep 25 18:37:29 GMT 2020



> On Sep 25, 2020, at 12:31 PM, Richard Sandiford <richard.sandiford@arm.com> wrote:
> 
> Qing Zhao <QING.ZHAO@ORACLE.COM> writes:
>> Last question, in the following code portion:
>> 
>>  /* Now we get a hard register set that need to be zeroed, pass it to
>>     target to generate zeroing sequence.  */
>>  HARD_REG_SET zeroed_hardregs;
>>  start_sequence ();
>>  zeroed_hardregs = targetm.calls.zero_call_used_regs (need_zeroed_hardregs);
>>  rtx_insn *seq = get_insns ();
>>  end_sequence ();
>>  if (seq)
>>    {
>>      /* emit the memory blockage and register clobber asm volatile.  */
>>      rtx barrier_rtx = expand_asm_reg_clobber_blockage (zeroed_hardregs);
>> 
>>     /* How to insert the barrier_rtx before "seq"???.  */
>>     ??????
>>     emit_insn_before (barrier_rtx, seq);  ??????
>> 
>>      emit_insn_before (seq, ret);
>> 
>>      /* update the data flow information.  */
>> 
>>      df_set_bb_dirty (BLOCK_FOR_INSN (ret));
>>    }
>> 
>> In the above, how should I insert the barrier_rtx in the beginning of “seq” ? And then insert the seq before ret?
>> Is there special thing I need to take care?
> 
> Easiest way is just to insert both of them before ret:
> 
>      emit_insn_before (barrier_rtx, ret);
>      emit_insn_before (seq, ret);
> 
Thanks. Will do that.

> Note that you shouldn't need to mark the block containing the
> return instruction as dirty: the emit machinery should do that
> for you.

Okay, I see.

>  But it might be necessary to mark the exit block
> (EXIT_BLOCK_PTR_FOR_FN (cfun)) as dirty because of the new
> liveness information -- I'm not sure.

Will study a little more here.

Thanks a lot for your help.

Qing
> 
> Thanks,
> Richard



More information about the Gcc-patches mailing list