[PATCH] D66459: Make ShrinkWrap more consistent.

zuojian lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 18:11:13 PDT 2019


linzj marked 2 inline comments as done.
linzj added inline comments.


================
Comment at: llvm/lib/CodeGen/ShrinkWrap.cpp:275
   }
+  if (MI.isTerminator())
+    return false;
----------------
chill wrote:
> I don't believe this is correct. A terminator instruction can well use and/or def a CSR, e.g. an indirect branch, a table jump, a hw loop instruction, ...
> 
> 
Oh, that's a mistake. How about MI.isReturn()? I just want to handle sibling calls.
They are essentially the same as returns. 


================
Comment at: llvm/lib/CodeGen/ShrinkWrap.cpp:293
+      UseOrDefCSR =
+          (!MI.isCall() && PhysReg == SP) || getCurrentCSRs(RS).count(PhysReg);
     } else if (MO.isRegMask()) {
----------------
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.


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