Qing Zhao <qing.z...@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);

Note that you shouldn't need to mark the block containing the
return instruction as dirty: the emit machinery should do that
for you.  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.

Thanks,
Richard

Reply via email to