This patch was needed to get some tests to pass while working on mischeduling for SystemZ.
On a benchmark suite, this patch also increased "folded stack accesses" from 14528 to 14736.
I am curious to hear what other think about this as I am not myself sure this is necessarily the best
way of achieving these results. To get the regression tests to pass, the heuristic had to be placed
3rd last in the list of the heuristics. However, it may well be that nearly same general results would
could be had if placing it lower down...
- If an instrution has an equivalent instruction that instead of reading a register, reads a memory location, it would be better to spill that register since the reload of it can then be folded.
This patch tries to improve MachineScheduler and CalcSpillWeigths in this direction, by using a new TargetInstrInfo virtual method hasFoldableOperand().
SystemZ has already a map for such instructions (getMemOpcode()), which is used to implement this method.