[WinEH] Only generate UnwindHelp slot for MSVCXX

Summary: Other personalities don't use this special frame slot.

Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14580

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252778 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joseph Tremoulet 2015-11-11 19:21:09 +00:00
parent 89837ac9ba
commit 5ae90aa384
2 changed files with 18 additions and 18 deletions

View File

@ -2878,18 +2878,18 @@ SDValue X86TargetLowering::LowerFormalArguments(
FuncInfo->setArgumentStackSize(StackSize);
if (MMI.hasWinEHFuncInfo(Fn)) {
if (Is64Bit) {
int UnwindHelpFI = MFI->CreateStackObject(8, 8, /*isSS=*/false);
SDValue StackSlot = DAG.getFrameIndex(UnwindHelpFI, MVT::i64);
MMI.getWinEHFuncInfo(MF.getFunction()).UnwindHelpFrameIdx = UnwindHelpFI;
SDValue Neg2 = DAG.getConstant(-2, dl, MVT::i64);
Chain = DAG.getStore(Chain, dl, Neg2, StackSlot,
MachinePointerInfo::getFixedStack(
DAG.getMachineFunction(), UnwindHelpFI),
/*isVolatile=*/true,
/*isNonTemporal=*/false, /*Alignment=*/0);
}
if (MMI.hasWinEHFuncInfo(Fn) && Is64Bit &&
classifyEHPersonality(Fn->getPersonalityFn()) ==
EHPersonality::MSVC_CXX) {
int UnwindHelpFI = MFI->CreateStackObject(8, 8, /*isSS=*/false);
SDValue StackSlot = DAG.getFrameIndex(UnwindHelpFI, MVT::i64);
MMI.getWinEHFuncInfo(MF.getFunction()).UnwindHelpFrameIdx = UnwindHelpFI;
SDValue Neg2 = DAG.getConstant(-2, dl, MVT::i64);
Chain = DAG.getStore(Chain, dl, Neg2, StackSlot,
MachinePointerInfo::getFixedStack(
DAG.getMachineFunction(), UnwindHelpFI),
/*isVolatile=*/true,
/*isNonTemporal=*/false, /*Alignment=*/0);
}
return Chain;

View File

@ -97,10 +97,10 @@ ehcleanup.end: ; preds = %ehcleanup
; CHECK: .seh_handler __C_specific_handler, @unwind, @except
; CHECK: pushq %rbp
; CHECK: .seh_pushreg 5
; CHECK: subq $48, %rsp
; CHECK: .seh_stackalloc 48
; CHECK: leaq 48(%rsp), %rbp
; CHECK: .seh_setframe 5, 48
; CHECK: subq $32, %rsp
; CHECK: .seh_stackalloc 32
; CHECK: leaq 32(%rsp), %rbp
; CHECK: .seh_setframe 5, 32
; CHECK: .seh_endprologue
; CHECK: .Ltmp0:
; CHECK: movl $1, %ecx
@ -109,7 +109,7 @@ ehcleanup.end: ; preds = %ehcleanup
; CHECK: .Ltmp1:
; CHECK: .LBB1_[[epilogue:[0-9]+]]: # %__try.cont.12
; CHECK: xorl %eax, %eax
; CHECK: addq $48, %rsp
; CHECK: addq $32, %rsp
; CHECK: popq %rbp
; CHECK: retq
; CHECK: .LBB1_[[except1bb:[0-9]+]]: # %catch.dispatch
@ -162,7 +162,7 @@ ehcleanup.end: ; preds = %ehcleanup
; CHECK: .seh_pushreg 5
; CHECK: subq $32, %rsp
; CHECK: .seh_stackalloc 32
; CHECK: leaq 48(%rdx), %rbp
; CHECK: leaq 32(%rdx), %rbp
; CHECK: .seh_endprologue
; CHECK: callq "?fin$0@0@main@@"
; CHECK: nop