[PATCH] D73170: Handle subregs and superregs in callee-saved register mask
James Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 02:39:27 PST 2020
jrtc27 marked an inline comment as done.
jrtc27 added a comment.
In D73170#1833793 <https://reviews.llvm.org/D73170#1833793>, @jhibbits wrote:
> Thanks for doing this! It's been on my TODO list for a little while already for SPE, but I never got around to it.
>
> Is there any provision for spilling only the subreg, not the superreg? It seems to me that whenever the subreg needs spilled, it always also spills the superreg, even if the full superreg is not used.
No, because restoring a subreg often has the side-effect of clearing the rest of the superreg, thereby violating the callee-preserved nature of them. I don't know whether that applies to SPE or not (and therefore whether the previously generated code was technically wrong), but it certainly applies to CHERI RISC-V.
================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:404
+ bool SavedSuper = false;
+ for (MCSuperRegIterator AI(Reg, RegInfo, false); AI.isValid(); ++AI)
+ // Some backends set all aliases for some registers as saved, such as
----------------
arsenm wrote:
> fhahn wrote:
> > nit: I think you could use MCRegisterInfo::subregs() which is slightly less code.
> These masks should eventually be in terms of regunits
Ah yes, I remember seeing `MCRegisterInfo::subregs()` go in but originally wrote this patch (not for SPE) over a year ago. I will update to the nicer API.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73170/new/
https://reviews.llvm.org/D73170
More information about the llvm-commits
mailing list