[WinEH] Split EH_RESTORE out of CATCHRET for 32-bit EH
authorReid Kleckner <rnk@google.com>
Fri, 6 Nov 2015 01:49:05 +0000 (01:49 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 6 Nov 2015 01:49:05 +0000 (01:49 +0000)
commit2ff8f92da7ba20cc88e46f991e406efef90f1da4
treefedbe949b8a828a9cfee6bf57ee97d57b0e2e5fa
parent70de10b99aceb4713039c2b3ade13cd7a87f37fa
[WinEH] Split EH_RESTORE out of CATCHRET for 32-bit EH

This adds the EH_RESTORE x86 pseudo instr, which is responsible for
restoring the stack pointers: EBP and ESP, and ESI if stack realignment
is involved. We only need this on 32-bit x86, because on x64 the runtime
restores CSRs for us.

Previously we had to keep the CATCHRET instruction around during SEH so
that we could convince X86FrameLowering to restore our frame pointers.
Now we can split these instructions earlier.

This was confusing, because we had a return instruction which wasn't
really a return and was ultimately going to be removed by
X86FrameLowering. This change also simplifies X86FrameLowering, which
really shouldn't be building new MBBs.

No observable functional change currently, but with the new register
mask stuff in D14407, CATCHRET will become a register allocator barrier,
and our existing tests rely on us having reasonable register allocation
around SEH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252266 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ExpandPseudo.cpp
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86FrameLowering.h
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86InstrCompiler.td