[codeview] Fix 32-bit x86 variable locations in realigned stack frames
authorReid Kleckner <rnk@google.com>
Tue, 2 Oct 2018 16:43:52 +0000 (16:43 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 2 Oct 2018 16:43:52 +0000 (16:43 +0000)
commitd5e4ec74e3daa50dc6f174d9b6f8951be09694a5
treeae4b16ec4884b3f7f850c1db183cdb0586d10704
parent6f40e21a1601aa1b83a13282918ddae47e58b7d5
[codeview] Fix 32-bit x86 variable locations in realigned stack frames

Add the .cv_fpo_stackalign directive so that we can define $T0, or the
VFRAME virtual register, with it. This was overlooked in the initial
implementation because unlike MSVC, we push CSRs before allocating stack
space, so this value is only needed to describe local variable
locations. Variables that the compiler now addresses via ESP are instead
described as being stored at offsets from VFRAME, which for us is ESP
after alignment in the prologue.

This adds tests that show that we use the VFRAME register properly in
our S_DEFRANGE records, and that we emit the correct FPO data to define
it.

Fixes PR38857

llvm-svn: 343603
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/MCTargetDesc/X86TargetStreamer.h
llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86InstrCompiler.td
llvm/lib/Target/X86/X86MCInstLower.cpp
llvm/test/DebugInfo/COFF/fpo-realign-alloca.ll
llvm/test/DebugInfo/COFF/fpo-realign-vframe.ll [new file with mode: 0644]
llvm/test/MC/COFF/cv-fpo-realign.s [new file with mode: 0644]