[ARM] Use dwarf exception handling on MinGW

Enabling and using dwarf exceptions seems like an easier path
to take, than to make the COFF/ARM backend output EHABI directives.
Previously, no EH model was enabled at all on this target.

There's no point in setting UseIntegratedAssembler to false since
GNU binutils doesn't support Windows on ARM, and since we don't
need to support external assembler, we don't need to use register
numbers in cfi directives.

Differential Revision: https://reviews.llvm.org/D39532

llvm-svn: 318510
This commit is contained in:
Martin Storsjo 2017-11-17 08:04:40 +00:00
parent e9a6456ab3
commit b4c907edd7
3 changed files with 59 additions and 3 deletions

View File

@ -105,10 +105,10 @@ ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
PrivateLabelPrefix = ".L";
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::None;
ExceptionsType = ExceptionHandling::DwarfCFI;
UseParensForSymbolVariant = true;
UseIntegratedAssembler = false;
DwarfRegNumForCFI = true;
UseIntegratedAssembler = true;
DwarfRegNumForCFI = false;
}

View File

@ -23,6 +23,7 @@ public:
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Symbol) override;
void FinishImpl() override;
};
void ARMWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
@ -37,6 +38,12 @@ void ARMWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
getAssembler().setIsThumbFunc(Symbol);
}
void ARMWinCOFFStreamer::FinishImpl() {
EmitFrames(nullptr);
MCWinCOFFStreamer::FinishImpl();
}
}
MCStreamer *llvm::createARMWinCOFFStreamer(

View File

@ -82,6 +82,10 @@
; RUN: -filetype=asm -o - %s \
; RUN: | FileCheck %s --check-prefix=DWARF-V7-FP-ELIM
; RUN: llc -mtriple thumbv7-windows-gnu \
; RUN: -filetype=asm -o - %s \
; RUN: | FileCheck %s --check-prefix=DWARF-WIN-FP-ELIM
;-------------------------------------------------------------------------------
; Test 1
;-------------------------------------------------------------------------------
@ -289,6 +293,26 @@ declare void @_ZSt9terminatev()
; DWARF-V7-FP-ELIM: pop {r4, pc}
; DWARF-V7-FP-ELIM: .cfi_endproc
; DWARF-WIN-FP-ELIM-LABEL: _Z4testiiiiiddddd:
; DWARF-WIN-FP-ELIM: .cfi_startproc
; DWARF-WIN-FP-ELIM: .cfi_personality 0, __gxx_personality_v0
; DWARF-WIN-FP-ELIM: .cfi_lsda 0, .Lexception0
; DWARF-WIN-FP-ELIM: push {r4, lr}
; DWARF-WIN-FP-ELIM: .cfi_def_cfa_offset 8
; DWARF-WIN-FP-ELIM: .cfi_offset lr, -4
; DWARF-WIN-FP-ELIM: .cfi_offset r4, -8
; DWARF-WIN-FP-ELIM: vpush {d8, d9, d10, d11, d12}
; DWARF-WIN-FP-ELIM: .cfi_offset d12, -16
; DWARF-WIN-FP-ELIM: .cfi_offset d11, -24
; DWARF-WIN-FP-ELIM: .cfi_offset d10, -32
; DWARF-WIN-FP-ELIM: .cfi_offset d9, -40
; DWARF-WIN-FP-ELIM: sub sp, #8
; DWARF-WIN-FP-ELIM: .cfi_def_cfa_offset 56
; DWARF-WIN-FP-ELIM: add sp, #8
; DWARF-WIN-FP-ELIM: vpop {d8, d9, d10, d11, d12}
; DWARF-WIN-FP-ELIM: pop {r4, pc}
; DWARF-WIN-FP-ELIM: .cfi_endproc
;-------------------------------------------------------------------------------
; Test 2
;-------------------------------------------------------------------------------
@ -377,6 +401,15 @@ entry:
; DWARF-V7-FP-ELIM: pop {r11, pc}
; DWARF-V7-FP-ELIM: .cfi_endproc
; DWARF-WIN-FP-ELIM-LABEL: test2:
; DWARF-WIN-FP-ELIM: .cfi_startproc
; DWARF-WIN-FP-ELIM: push.w {r11, lr}
; DWARF-WIN-FP-ELIM: .cfi_def_cfa_offset 8
; DWARF-WIN-FP-ELIM: .cfi_offset lr, -4
; DWARF-WIN-FP-ELIM: .cfi_offset r11, -8
; DWARF-WIN-FP-ELIM: pop.w {r11, pc}
; DWARF-WIN-FP-ELIM: .cfi_endproc
;-------------------------------------------------------------------------------
; Test 3
@ -483,6 +516,17 @@ entry:
; DWARF-V7-FP-ELIM: pop {r4, r5, r11, pc}
; DWARF-V7-FP-ELIM: .cfi_endproc
; DWARF-WIN-FP-ELIM-LABEL: test3:
; DWARF-WIN-FP-ELIM: .cfi_startproc
; DWARF-WIN-FP-ELIM: push.w {r4, r5, r11, lr}
; DWARF-WIN-FP-ELIM: .cfi_def_cfa_offset 16
; DWARF-WIN-FP-ELIM: .cfi_offset lr, -4
; DWARF-WIN-FP-ELIM: .cfi_offset r11, -8
; DWARF-WIN-FP-ELIM: .cfi_offset r5, -12
; DWARF-WIN-FP-ELIM: .cfi_offset r4, -16
; DWARF-WIN-FP-ELIM: pop.w {r4, r5, r11, pc}
; DWARF-WIN-FP-ELIM: .cfi_endproc
;-------------------------------------------------------------------------------
; Test 4
@ -540,3 +584,8 @@ entry:
; DWARF-V7-FP-ELIM: bx lr
; DWARF-V7-FP-ELIM-NOT: .cfi_endproc
; DWARF-V7-FP-ELIM: .size test4,
; DWARF-WIN-FP-ELIM-LABEL: test4:
; DWARF-WIN-FP-ELIM-NOT: .cfi_startproc
; DWARF-WIN-FP-ELIM: bx lr
; DWARF-WIN-FP-ELIM-NOT: .cfi_endproc