I have experimented with rescheduling calls in MachineScheduler, and have a
patch I would like to offer for comments and review. As far as I could
understand from the comment above isSchedBoundary(), this is something that
may be wanted generally.
Or is it otherwise a good enough option to use the pre-RA (isel) scheduler
to handle this?
This patch adds:
Handling of regmasks while building the dag, with a new ScheduleDAGInstrs
method 'addRegMaskDeps()'.
A new method 'clearCallsInDefsForReg()' has been added from code factored
out of addPhysRegDeps(), as it is also needed by addRegMaskDeps().
A new method SURegDefIsDead() that checks for a dead-def reg MO, and also
for a regmask, as opposed to calling registerDefIsDead(), which does not check
for the regmask.
A new SubtargetInfo virtual method 'MISchedRescheduleCalls()' and a new
CL option 'RescheduleCalls' to control the behaviour. Default is false, i.e.
no rescheduling of calls.
Don't we still want to call TII->isSchedulingBoundary for calls? The target may treat some calls differently. How about this:
Always honor the command line option if present (it's just for debugging/experimentation anyway):
Otherwise simply defer to the target:
By default, have TargetInstrInfo::isSchedulingBoundary return true for isCall().
Make sure any in-tree targets that override this method return true for isCall().
Post on llvm-dev explaining that the scheduler now works across calls. If you have an out-of-tree target that overrides
TargetInstrInfo::isSchedulingBoundary, you now need to check isCall yourself.