[PATCH] D66459: Make ShrinkWrap more consistent.

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 00:30:48 PDT 2019


chill added reviewers: qcolombet, thegameg.
chill added inline comments.


================
Comment at: llvm/lib/CodeGen/ShrinkWrap.cpp:293
+      UseOrDefCSR =
+          (!MI.isCall() && PhysReg == SP) || getCurrentCSRs(RS).count(PhysReg);
     } else if (MO.isRegMask()) {
----------------
linzj wrote:
> chill wrote:
> > Why is that needed? The set of //actual//  CSRs ought to be always a subset of the set of //possible// CSRs.
> > 
> I am actually making LLVM a code generator for V8 turbofan. V8 needs to save a specific set of registers at the entry of a function depending on the type of this function. For example, a JS function needs to save r0, r1,r7 along with fp, lr. And a wasm function needs to spill r3 at sp - 16.
> 
> At this context, I need to add additional CSRs at frame lowering's assignCalleeSavedSpillSlots. So getCurrentCSRs maybe a super set of the set of possible CSRs.
Have you considered adding a custom calling convention in the backend, instead ? 
https://llvm.org/docs/WritingAnLLVMBackend.html#calling-conventions

That may also remove the need for specially handing sibling calls in your case.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66459/new/

https://reviews.llvm.org/D66459





More information about the llvm-commits mailing list