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

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 18:32:01 PST 2017


MatzeB added a comment.

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

> I had a possible idea for making this work. I thought about creating a virtual register that will ultimately be assigned to the frame register, which is calculated at the time of freezeReservedRegs. I prototyped something, but this virtual register breaks a lot of rules because it has no instructions that define it.
>
> @MatzeB, does this seem like a good idea? It has the advantage that we'll go through instruction selection with a normal register, and then we'll rewrite it in the normal course of register allocation.


I'm not sure I completely understand your plan. But some assumption that come to my mind:

- We should only assign/decide on reserved registers once. (I know 1 or 2 targets currently violate this rule, but that should be fixed sooner or later).
- The register allocators will generally not assign a reserved register to a virtual register.
- The copy coalescer has some cases where copies from reserved regs to vregs get eliminated.
- I'm not sure why you would want to use a vreg when you expect it to end up containing the frame pointer anyway. Instead just assign the reserved registers right away.


https://reviews.llvm.org/D40622





More information about the llvm-commits mailing list