On 11/18/22 08:18, Richard Sandiford wrote:

Yeah, good point.  How does the version below look?  Tested as before.

I guess it's a philosophical question what distinguishes "late compilation"
from everything else, but I think it makes sense for it to mean "no code
motion" (among other things).  And it's useful if targets have a well-
defined point at which they can insert their own passes while guaranteeing
that:

- the CFG still exists and hasn't lost information
- no code motion occurs later
- alignments aren't nailed down yet
- variable tracking occurs later (and so will account for whatever the
   target does in its pass)

Seems like a reasonable set of properties.  Do we want to document this somewhere so that it get captured?  That can be independent of this particular patch.



I don't think it's controversial to say that delay-branch reorg should
happen as part of normal scheduling, with the later passes coping with
the SEQUENCEs generated from it, but there's no realistic chance of
that happening.  So unfortunately it's always likely to be a special
case...

I've been wanting the guts of dbr moved into sched2 for a long time.  I've speculated that we could use the dependence analysis from sched2 to provide the candidates for delay slot filling and that doing so would probably pick up the vast majority of opportunities, but without the ad-hoc dependency bits in reorg.c. But yea, realistically nobody's going to invest the time to revamp reorg.



Bernd did some nice work on avoiding dbr for bfin (IIRC), but without
the handling of SEQUENCEs in rtl passes, even that version had to
happen during md_reorg.

Never really looked at it.




Thanks,
Richard


gcc/
        * target.def (use_late_prologue_epilogue): New hook.
        * doc/tm.texi.in: Add TARGET_USE_LATE_PROLOGUE_EPILOGUE.
        * doc/tm.texi: Regenerate.
        * passes.def (pass_late_thread_prologue_and_epilogue): New pass.
        * tree-pass.h (make_pass_late_thread_prologue_and_epilogue): Declare.
        * function.cc (pass_thread_prologue_and_epilogue::gate): New function.
        (pass_data_late_thread_prologue_and_epilogue): New pass variable.
        (pass_late_thread_prologue_and_epilogue): New pass class.
        (make_pass_late_thread_prologue_and_epilogue): New function.

OK

jeff


Reply via email to