[all-commits] [llvm/llvm-project] 3c96d0: Generate Callee Saved Register (CSR) related cfi d...

wmi-11 via All-commits all-commits at lists.llvm.org
Wed Mar 4 11:20:12 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c96d01d2e3de63304ca3429d349ec62ae2adef3
      https://github.com/llvm/llvm-project/commit/3c96d01d2e3de63304ca3429d349ec62ae2adef3
  Author: Wei Mi <wmi at google.com>
  Date:   2020-03-04 (Wed, 04 Mar 2020)

  Changed paths:
    M llvm/lib/CodeGen/CFIInstrInserter.cpp
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/lib/Target/X86/X86FrameLowering.h
    A llvm/test/CodeGen/X86/cfi-epilogue-with-return.mir
    A llvm/test/CodeGen/X86/cfi-epilogue-without-return.mir
    A llvm/test/CodeGen/X86/cfi-inserter-callee-save-register.mir
    A llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-csr.mir

  Log Message:
  -----------
  Generate Callee Saved Register (CSR) related cfi directives like .cfi_restore.

https://reviews.llvm.org/D42848 only handled CFA related cfi directives but
didn't handle CSR related cfi. The patch adds the CSR part. Basically it reuses
the framework created in D42848. For each basicblock, the patch tracks which
CSR set have been saved at its CFG predecessors's exits, and compare the CSR
set with the set at its previous basicblock's exit (The previous block is the
block laid before the current block). If the saved CSR set at its previous
basicblock's exit is larger, .cfi_restore will be inserted.

The patch also generates proper .cfi_restore in epilogue to make sure the
saved CSR set is consistent for the incoming edges of each block.

Differential Revision: https://reviews.llvm.org/D74303




More information about the All-commits mailing list