[llvm] r318510 - [ARM] Use dwarf exception handling on MinGW

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 00:04:40 PST 2017


Author: mstorsjo
Date: Fri Nov 17 00:04:40 2017
New Revision: 318510

URL: http://llvm.org/viewvc/llvm-project?rev=318510&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
    llvm/trunk/test/CodeGen/ARM/ehabi.ll

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp?rev=318510&r1=318509&r2=318510&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp Fri Nov 17 00:04:40 2017
@@ -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;
 }
 

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp?rev=318510&r1=318509&r2=318510&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp Fri Nov 17 00:04:40 2017
@@ -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::EmitAssemblerFl
 void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
   getAssembler().setIsThumbFunc(Symbol);
 }
+
+void ARMWinCOFFStreamer::FinishImpl() {
+  EmitFrames(nullptr);
+
+  MCWinCOFFStreamer::FinishImpl();
+}
 }
 
 MCStreamer *llvm::createARMWinCOFFStreamer(

Modified: llvm/trunk/test/CodeGen/ARM/ehabi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ehabi.ll?rev=318510&r1=318509&r2=318510&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ehabi.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ehabi.ll Fri Nov 17 00:04:40 2017
@@ -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




More information about the llvm-commits mailing list