[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions
authorFangrui Song <i@maskray.me>
Fri, 1 Apr 2022 06:04:50 +0000 (23:04 -0700)
committerFangrui Song <i@maskray.me>
Fri, 1 Apr 2022 06:04:50 +0000 (23:04 -0700)
commitac6878b330f3dfb4a7e99093dfdd9d88bacead28
treeeb0e4635e129d019aa797ae57ca1d7d19ed2e482
parentdc77769fc66b23c0b065b256e5f5fe87cc85e57e
[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions

This approach is used by AArch64/RISCV to make frame-setup/frame-destroy
instructions contiguous instead of being interleaved by CFI instructions. Code
checking `MBBI->getFlag(MachineInstr::FrameSetup) || MBBI->isCFIInstruction()`
can be simplified to just check FrameSetup.

This helps locate all CFI instructions in the prologue, which can be handy to use
.cfi_remember_state/.cfi_restore_state to decrease unwind table size (D114545).

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D122541
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86FrameLowering.h
llvm/test/CodeGen/X86/cfi-xmm.ll
llvm/test/CodeGen/X86/epilogue-cfi-fp.ll
llvm/test/CodeGen/X86/push-cfi.ll
llvm/test/CodeGen/X86/throws-cfi-fp.ll