[PATCH] D18046: [X86] Providing correct unwind info in function epilogue

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 15:35:59 PDT 2017


iteratee added a comment.

The more I think about this, the more I think this is the wrong approach.

As I understand it, the problem is that CFI line tables are linear based on the assembly output, but that the actual CFI adjustments can be anywhere, and we need some way to "reset" the values for the linear layout.

This isn't just an epilogue problem, we are limited in changing stores to pushes because of this. If we have a diamond with a spill in the top of the diamond and a restore in the join, we will get this wrong if we don't lay the diamond out linearly. This is just an example, but there are other things that having better cfa tracking would enable.

If we're going to add information to a basic block, why don't we store the incoming and outgoing cfa_offset, and cfa_register? Then we can allow CFI directives to be copied.
This allows several beneficial things:

- We can shrink-wrap things that need to use a smaller prologue (meaning there are actually 2 prologues in the function)
- We can add a verification pass that all outgoing offsets of predecessors match incoming offsets of successors.
- We can do more store-to-push conversions
- This is platform independent. CFI cfa_def directives are platform independent, and only support register,offset or dwarf expressions. We can ignore dwarf expressions for now.

Then the pass that's needed simply inserts a directive between blocks that are linear-mismatches, and we can even handle rbp,rsp mismatches.


Repository:
  rL LLVM

https://reviews.llvm.org/D18046





More information about the llvm-commits mailing list