[all-commits] [llvm/llvm-project] 3be667: [X86] Use the CFA when appropriate for better vari...

Kyle Huey via All-commits all-commits at lists.llvm.org
Tue May 23 13:25:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3be667ae5a10e276acf7d1bb7e8c29ba07578032
      https://github.com/llvm/llvm-project/commit/3be667ae5a10e276acf7d1bb7e8c29ba07578032
  Author: Kyle Huey <khuey at pernos.co>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetFrameLowering.h
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    M llvm/lib/CodeGen/CFIInstrInserter.cpp
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/lib/Target/X86/X86FrameLowering.h
    M llvm/lib/Target/X86/X86MCInstLower.cpp
    M llvm/lib/Target/X86/X86MachineFunctionInfo.h
    A llvm/test/DebugInfo/X86/stack_adjustments_trigger_cfa_frame_base.ll

  Log Message:
  -----------
  [X86] Use the CFA when appropriate for better variable locations around calls.

Without frame pointers, the locations of variables on the stack are emitted
relative to the stack pointer (via the stack pointer being the value of
DW_AT_frame_base on the subprogram). If a call modifies the stack pointer
this results in the locations being wrong and the debugger displaying the
wrong values for variables.

By using DW_OP_call_frame_cfa in these situations the emitted location for
the variable will automatically handle changes in the stack pointer
(provided LLVM is emitting the correct CFI directives elsewhere, of course).
The CFA needs to be adjusted for the size of the stack frame (including the
return address) to allow the variable locations themselves to remain
unchanged by this patch.

Certain LLDB features cannot cope with DW_OP_call_frame_cfa, so this change
is heuristically limited to the cases where it's necessary for correctness
to minimize the fallout there.

Reviewed By: #debug-info, scott.linder, jryans, jmorse

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




More information about the All-commits mailing list