[PATCH] D39535: [AArch64] Use dwarf exception handling on MinGW

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 13:59:34 PDT 2017


mstorsjo updated this revision to Diff 121368.
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Simplified the test as suggested.


https://reviews.llvm.org/D39535

Files:
  lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
  lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
  test/CodeGen/AArch64/dwarf-cfi.ll


Index: test/CodeGen/AArch64/dwarf-cfi.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AArch64/dwarf-cfi.ll
@@ -0,0 +1,38 @@
+; RUN: llc -mtriple aarch64-windows-gnu \
+; RUN:     -filetype=asm -o - %s \
+; RUN:   | FileCheck %s
+
+define void @_Z1gv() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+entry:
+  invoke void @_Z1fv()
+          to label %try.cont unwind label %lpad
+
+lpad:
+  %0 = landingpad { i8*, i32 }
+          catch i8* null
+  %1 = extractvalue { i8*, i32 } %0, 0
+  %2 = tail call i8* @__cxa_begin_catch(i8* %1) #2
+  tail call void @__cxa_end_catch()
+  br label %try.cont                              
+  
+try.cont:
+  ret void
+}
+
+declare void @_Z1fv()
+
+declare i32 @__gxx_personality_v0(...)
+
+declare i8* @__cxa_begin_catch(i8*) local_unnamed_addr
+
+declare void @__cxa_end_catch() local_unnamed_addr
+
+; CHECK-LABEL: _Z1gv:
+; CHECK:    .cfi_startproc
+; CHECK:    .cfi_personality 0, __gxx_personality_v0
+; CHECK:    .cfi_lsda 0, .Lexception0
+; CHECK:    str x30, [sp, #-16]!
+; CHECK:    .cfi_def_cfa_offset 16
+; CHECK:    .cfi_offset w30, -16
+; CHECK:    ldr x30, [sp], #16
+; CHECK:    .cfi_endproc
Index: lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
===================================================================
--- lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
+++ lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
@@ -23,7 +23,15 @@
                          std::unique_ptr<MCCodeEmitter> CE,
                          raw_pwrite_stream &OS)
       : MCWinCOFFStreamer(C, std::move(AB), std::move(CE), OS) {}
+
+  void FinishImpl() override;
 };
+
+void AArch64WinCOFFStreamer::FinishImpl() {
+  EmitFrames(nullptr);
+
+  MCWinCOFFStreamer::FinishImpl();
+}
 } // end anonymous namespace
 
 namespace llvm {
Index: lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
===================================================================
--- lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
+++ lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp
@@ -106,13 +106,15 @@
   PrivateLabelPrefix = ".L";
   AlignmentIsInBytes = false;
   SupportsDebugInformation = true;
-  ExceptionsType = ExceptionHandling::WinEH;
+  CodePointerSize = 8;
 }
 
 AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
   CommentString = ";";
+  ExceptionsType = ExceptionHandling::WinEH;
 }
 
 AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
   CommentString = "//";
+  ExceptionsType = ExceptionHandling::DwarfCFI;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39535.121368.patch
Type: text/x-patch
Size: 2583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171102/2969ee80/attachment.bin>


More information about the llvm-commits mailing list