brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 4e25aab Raw
47 lines · plain
1; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s2 3@str = linkonce_odr unnamed_addr constant [27 x i8] c"GetExceptionCode(): 0x%lx\0A\00", align 14 5declare i32 @llvm.eh.exceptioncode(token)6declare i32 @__C_specific_handler(...)7declare void @crash()8declare i32 @printf(ptr nocapture readonly, ...) nounwind9 10define i32 @main() personality ptr @__C_specific_handler {11entry:12  invoke void @crash()13          to label %__try.cont unwind label %lpad14 15__try.cont:16  ret i32 017 18lpad:19  %cs1 = catchswitch within none [label %catchall] unwind to caller20 21catchall:22  %p = catchpad within %cs1 [ptr null, i32 64, ptr null]23  %code = call i32 @llvm.eh.exceptioncode(token %p)24  call i32 (ptr, ...) @printf(ptr @str, i32 %code) [ "funclet"(token %p) ]25  catchret from %p to label %__try.cont26}27 28; Check that we can get the exception code from eax to the printf.29 30; CHECK-LABEL: main:31; CHECK: callq crash32; CHECK: retq33; CHECK: .LBB0_2: # %catchall34; CHECK: leaq str(%rip), %rcx35; CHECK: movl %eax, %edx36; CHECK: callq printf37 38; CHECK: .seh_handlerdata39; CHECK-NEXT: .Lmain$parent_frame_offset40; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/1641; CHECK-NEXT: .Llsda_begin0:42; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL43; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL44; CHECK-NEXT: .long 145; CHECK-NEXT: .long .LBB0_2@IMGREL46; CHECK-NEXT: .Llsda_end0:47