[llvm] r226767 - Win64 SEH: Emit the constant 1 for catch-all into xdata

Reid Kleckner reid at kleckner.net
Wed Jan 21 18:27:44 PST 2015


Author: rnk
Date: Wed Jan 21 20:27:44 2015
New Revision: 226767

URL: http://llvm.org/viewvc/llvm-project?rev=226767&view=rev
Log:
Win64 SEH: Emit the constant 1 for catch-all into xdata

Added:
    llvm/trunk/test/CodeGen/X86/seh-catch-all.ll
Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=226767&r1=226766&r2=226767&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Wed Jan 21 20:27:44 2015
@@ -145,7 +145,7 @@ const MCSymbolRefExpr *Win64Exception::c
 ///     struct Entry {
 ///       imagerel32 LabelStart;
 ///       imagerel32 LabelEnd;
-///       imagerel32 FilterOrFinally;  // Zero means catch-all.
+///       imagerel32 FilterOrFinally;  // One means catch-all.
 ///       imagerel32 LabelLPad;        // Zero means __finally.
 ///     } Entries[NumEntries];
 ///   };
@@ -241,7 +241,7 @@ void Win64Exception::emitCSpecificHandle
         if (TI) // Emit the filter function pointer.
           Asm->OutStreamer.EmitValue(createImageRel32(Asm->getSymbol(TI)), 4);
         else  // Otherwise, this is a "catch i8* null", or catch all.
-          Asm->OutStreamer.EmitIntValue(0, 4);
+          Asm->OutStreamer.EmitIntValue(1, 4);
       }
       Asm->OutStreamer.EmitValue(createImageRel32(ClauseLabel), 4);
     }

Added: llvm/trunk/test/CodeGen/X86/seh-catch-all.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-catch-all.ll?rev=226767&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/seh-catch-all.ll (added)
+++ llvm/trunk/test/CodeGen/X86/seh-catch-all.ll Wed Jan 21 20:27:44 2015
@@ -0,0 +1,29 @@
+; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
+
+ at str = internal unnamed_addr constant [10 x i8] c"recovered\00", align 1
+
+declare i32 @__C_specific_handler(...)
+declare void @crash()
+declare i32 @puts(i8*)
+
+define i32 @main() {
+entry:
+  invoke void @crash()
+          to label %__try.cont unwind label %lpad
+
+lpad:
+  %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
+          catch i8* null
+  call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @str, i64 0, i64 0))
+  br label %__try.cont
+
+__try.cont:
+  ret i32 0
+
+eh.resume:
+  resume { i8*, i32 } %0
+}
+
+; CHECK-LABEL: main:
+; CHECK: .seh_handlerdata
+; CHECK: .long





More information about the llvm-commits mailing list