[PATCH] D40622: XOR the frame pointer with the stack cookie when protecting the stack

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 11:46:17 PST 2017


rnk added a comment.

In https://reviews.llvm.org/D40622#940850, @rnk wrote:

> In https://reviews.llvm.org/D40622#940035, @MatzeB wrote:
>
> > Looking around the code, I think the simplest solution would be to make `useStackGuardXorFP()` return the register that should be used or 0.
>
>
> The problem is that we don't know what register to use until `freezeReservedRegs` happens and `hasFP` stops changing value. I want to use a virtual register as a place-holder for the final frame register so that we can do normal instruction selection and then replace that virtual register with the frame register during virtual register rewriting. It really has no interaction with register allocation, it's just that virtual register rewriting seems like a convenient place to replace this place-holder. Is this a reasonable idea?


Maybe a better way to think about it is it's a physical register that gets replaced with another physical register. Does this seem like something that would be useful? I'm surprised we don't have something like this already.


https://reviews.llvm.org/D40622





More information about the llvm-commits mailing list