[PATCH] D26867: [AArch64, TargetRegisterInfo, TargetInstrInfo] Add hook to check if physreg spillable

Geoff Berry via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 12:45:28 PST 2016


gberry created this revision.
gberry added reviewers: qcolombet, MatzeB.
gberry added subscribers: mcrosier, t.p.northover, llvm-commits.
Herald added subscribers: rengolin, aemerson.

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.


https://reviews.llvm.org/D26867

Files:
  include/llvm/Target/TargetRegisterInfo.h
  lib/CodeGen/TargetInstrInfo.cpp
  lib/Target/AArch64/AArch64RegisterInfo.cpp
  lib/Target/AArch64/AArch64RegisterInfo.h
  test/CodeGen/AArch64/zero-reg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26867.78570.patch
Type: text/x-patch
Size: 6268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161118/30d02113/attachment.bin>


More information about the llvm-commits mailing list