> On Sep 15, 2020, at 6:09 PM, Segher Boessenkool <seg...@kernel.crashing.org>
> wrote:
>
> On Tue, Sep 15, 2020 at 05:31:48PM -0500, Qing Zhao wrote:
>>> But, scheduling runs *after* that, and then you need to prevent the
>>> inserted (zeroing) insns from moving -- if you don't, the code after
>>> some zeroing can be used as gadget! You want to always have all
>>> zeroing insns after *any* computational insn, or it becomes a gadget.
>>
>> Please see the previous discussion, we have agreed to put the new pass
>> (pass_zero_call_used_regs)
>> in the beginning of the pass_late_compilation as following:
>
> Yes, I know that at some point it was said that seemed like a good place
> for it.
>
>> PUSH_INSERT_PASSES_WITHIN (pass_late_compilation)
>> ++++ NEXT_PASS (pass_zero_call_used_regs);
>> NEXT_PASS (pass_compute_alignments);
>> NEXT_PASS (pass_variable_tracking);
>> NEXT_PASS (pass_free_cfg);
>> NEXT_PASS (pass_machine_reorg);
>> NEXT_PASS (pass_cleanup_barriers);
>> NEXT_PASS (pass_delay_slots);
>>
>> Scheduling has been done already.
>
> But there are many more passes that can reorder things. Like
> machine_reorg (which is a big deal). I don't think other passes here
> are harmful (maybe the shorten stuff)? But. Targets can also insert
> more passes here.
>
> If you want the zeroing insns to stay with the return, you have to
> express that in RTL.
What do you mean by “express that in RTL”?
Could you please explain this in more details?
Do you mean to implement this in “targetm.gen_return” and
“targetm.gen_simple_return”?
Qing
> Anything else is extremely fragile.
>
>
> Segher