This is an archive of the discontinued LLVM Phabricator instance.

[AArch64, TargetRegisterInfo, TargetInstrInfo] Add hook to check if physreg spillable
AbandonedPublic

Authored by gberry on Nov 18 2016, 12:45 PM.

Details

Reviewers
qcolombet
MatzeB
Summary

Add TargetRegisterInfo hook canSpillPhysReg() and use it in
TargetTransformInfo::canFoldCopy to catch more cases where the COPY
being spilled is copying from a spill-able physical register, but the
register is not in the COPY destination register's regclass.

For example, when spilling:

%vreg0 = COPY %XZR ; %vreg0:GPR64common

without this change, canFoldCopy would return false since %XZR is not in
GPR64common. So the spill code generated would be:

%vreg0 = COPY %XZR
STR %vreg

instead of

STR %ZXR

Implement canSpillPhysReg() for AArch64, where all phys regs are
spillable other than SP/WSP.

Event Timeline

gberry updated this revision to Diff 78570.Nov 18 2016, 12:45 PM
gberry retitled this revision from to [AArch64, TargetRegisterInfo, TargetInstrInfo] Add hook to check if physreg spillable.
gberry updated this object.
gberry added reviewers: qcolombet, MatzeB.
gberry planned changes to this revision.Nov 18 2016, 2:18 PM

I'm thinking it might be cleaner to just implement this in AArch64InstrInfo::foldMemoryOperandImpl to avoid needing a new hook. I'm going to pursue that for a bit.