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;
; 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
; 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
; 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