[PATCH] D73709: [PowerPC] Create a FixedStack object for CR save in linkage area.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 07:27:22 PST 2020


sfertile created this revision.
sfertile added reviewers: hfinkel, nemanjai, jsji.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: LLVM.

`hasReservedSpillSlot` returns a dummy frame index of '0' on PPC64 for the non-volatile condition registers, which leads to the CalleSavedInfo either referencing an unrelated stack object, or an invalid object if there are no stack objects. The latter case causes the mir-printer to crash due to assertions that check if the frame index referenced by a CalleeSavedInfo is valid. To fix the problem I simply create an immutable FixedStack object at the correct offset in the previous stack frame (ie SP + positive offset).

Initially I tried to fix this by handling the CR save similar to the link register. My reasoning was that since both have custom saving and restoring to the linkage area inserted as part of the prologue/epilogue we should reset CR2/CR3/CR4 in the callee saved register mask and not create CalleeSavedInfos. This has the draw back that they don't get added as live-ins  in `updateLiveness` so I abandoned the approach.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73709

Files:
  llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
  llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
  llvm/test/CodeGen/PowerPC/ppc64-crsave.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73709.241446.patch
Type: text/x-patch
Size: 6525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/b7a49cd0/attachment-0001.bin>


More information about the llvm-commits mailing list