[PATCH] D109254: [AArch64] Enable CFIInstrInserter

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 09:06:48 PST 2021


chill added a comment.

I would request to not enable `CFIInstrInserter` for AArch64. I have a patch (that I was planning to submit tomorrow, 2021-11-08), that is
IMHO, for a lack of better word, better.

Until I get aroun d to submit it, here's the commit message, describing it:

>   [CodeGen] Async unwind (7/7) - add a pass to fix CFI information
>    
>    This pass inserts the necessary `.cfi_remember_state` and
>    `.cfi_restore_state` CFI instructions to adjust for the inconsistency
>    of the call-frame information caused by final machine basic block
>    layout.
>    
>    Unlike the `CFIInstrInserer` pass, this one uses emits only
>    `.cfi_remember_state`/`.cfi_restore_state`, which results in smaller
>    unwind tables and also transparently handles custom unwind info
>    extensions, CFA offset adjustement and save locations of SVE
>    registers.
>    
>    The pass takes advantage on the contraints LLVM imposes on the
>    placement of save/restore points (cf. `ShrinkWrap.cpp`):
>    
>    * there is a single basic block, containing the function prologue
>    
>    * possibly multiple epilogue blocks, where each epilogue block is
>      complete and self-contained, i.e. CSR restore instructions (and the
>      corresponding CFI instructions are not split across two or more
>      blocks.
>    
>    * prologue and epilogue blocks are outside of any loops
>    
>    Thus at the beginning and at the end of each basic block we can be in
>    one of two states - "has frame" or "does not have frame", which can be
>    computed by a single RPO traversal.
>    
>    Then, for each epilogue block (one that transitions from "has frame"
>    to "does not have frame"), which is physically followed by a block
>    with a "has frame", we insert a `.cfi_remember_state`.
>    
>    Similarly, for each block thas "has frame", but is preceded an
>    epilogue block, we insert a `.cfi_restore_state".
>    
>    A block may need to have both instructions, in which case the restore
>    one has to precede the remember one.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109254/new/

https://reviews.llvm.org/D109254



More information about the llvm-commits mailing list