1 ; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
5 ;16-NEXT: .set $func_begin0, ([[TMP]])
6 ;16-NEXT: .cfi_startproc
7 ;16-NEXT: .cfi_personality
8 @.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1
9 @_ZTIi = external constant ptr
10 @.str1 = private unnamed_addr constant [15 x i8] c"exception %i \0A\00", align 1
12 define i32 @main() personality ptr @__gxx_personality_v0 {
14 %retval = alloca i32, align 4
15 %exn.slot = alloca ptr
16 %ehselector.slot = alloca i32
17 %e = alloca i32, align 4
18 store i32 0, ptr %retval
19 %call = call i32 (ptr, ...) @printf(ptr @.str)
20 %exception = call ptr @__cxa_allocate_exception(i32 4) nounwind
21 store i32 20, ptr %exception
22 invoke void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) noreturn
23 to label %unreachable unwind label %lpad
25 lpad: ; preds = %entry
26 %0 = landingpad { ptr, i32 }
28 %1 = extractvalue { ptr, i32 } %0, 0
29 store ptr %1, ptr %exn.slot
30 %2 = extractvalue { ptr, i32 } %0, 1
31 store i32 %2, ptr %ehselector.slot
32 br label %catch.dispatch
34 catch.dispatch: ; preds = %lpad
35 %sel = load i32, ptr %ehselector.slot
36 %3 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind
37 %matches = icmp eq i32 %sel, %3
38 br i1 %matches, label %catch, label %eh.resume
40 catch: ; preds = %catch.dispatch
41 %exn = load ptr, ptr %exn.slot
42 %4 = call ptr @__cxa_begin_catch(ptr %exn) nounwind
43 %exn.scalar = load i32, ptr %4
44 store i32 %exn.scalar, ptr %e, align 4
45 %5 = load i32, ptr %e, align 4
46 %call2 = invoke i32 (ptr, ...) @printf(ptr @.str1, i32 %5)
47 to label %invoke.cont unwind label %lpad1
49 invoke.cont: ; preds = %catch
50 call void @__cxa_end_catch() nounwind
53 try.cont: ; preds = %invoke.cont
56 lpad1: ; preds = %catch
57 %6 = landingpad { ptr, i32 }
59 %7 = extractvalue { ptr, i32 } %6, 0
60 store ptr %7, ptr %exn.slot
61 %8 = extractvalue { ptr, i32 } %6, 1
62 store i32 %8, ptr %ehselector.slot
63 call void @__cxa_end_catch() nounwind
66 eh.resume: ; preds = %lpad1, %catch.dispatch
67 %exn3 = load ptr, ptr %exn.slot
68 %sel4 = load i32, ptr %ehselector.slot
69 %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn3, 0
70 %lpad.val5 = insertvalue { ptr, i32 } %lpad.val, i32 %sel4, 1
71 resume { ptr, i32 } %lpad.val5
73 unreachable: ; preds = %entry
77 declare i32 @printf(ptr, ...)
79 declare ptr @__cxa_allocate_exception(i32)
81 declare i32 @__gxx_personality_v0(...)
83 declare void @__cxa_throw(ptr, ptr, ptr)
85 declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone
87 declare ptr @__cxa_begin_catch(ptr)
89 declare void @__cxa_end_catch()