[PATCH] D52217: [codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 18:35:57 PDT 2018


rnk created this revision.
rnk added reviewers: hans, zturner.
Herald added subscribers: JDevlieghere, hiraditya, aprantl.
Herald added a reviewer: javed.absar.

Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.

On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.

To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit.  Offsets
to local variables are instead relative to this value.

This is part of PR38857.


https://reviews.llvm.org/D52217

Files:
  llvm/include/llvm/CodeGen/MachineFrameInfo.h
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/test/CodeGen/MIR/X86/diexpr-win32.mir
  llvm/test/DebugInfo/COFF/asm.ll
  llvm/test/DebugInfo/COFF/frameproc-flags.ll
  llvm/test/DebugInfo/COFF/local-variables.ll
  llvm/test/DebugInfo/COFF/multifile.ll
  llvm/test/DebugInfo/COFF/multifunction.ll
  llvm/test/DebugInfo/COFF/pieces.ll
  llvm/test/DebugInfo/COFF/simple.ll
  llvm/test/DebugInfo/COFF/types-array.ll
  llvm/test/DebugInfo/COFF/vframe-fpo.ll
  llvm/test/DebugInfo/X86/dbg-declare-inalloca.ll
  llvm/test/MC/ARM/coff-debugging-secrel.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52217.165875.patch
Type: text/x-patch
Size: 74967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/2c889bda/attachment-0001.bin>


More information about the llvm-commits mailing list