blob: 8bde7489d9b6b451b848a47d0ad83bf4721da4ae [file] [log] [blame]
Dan Gohman55a78772009-09-11 18:41:06 +00001; RUN: llc < %s -mtriple=arm-apple-darwin9 -march=arm | FileCheck %s
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +00002
Chris Lattnerb85e4eb2011-06-18 06:05:24 +00003; CHECK: L_LSDA_0:
4
5
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +00006%struct.A = type { i32* }
7
Rafael Espindola1e819662010-06-17 15:18:27 +00008define void @"\01-[MyFunction Name:]"() {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +00009entry:
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000010 %save_filt.1 = alloca i32
11 %save_eptr.0 = alloca i8*
12 %a = alloca %struct.A
13 %eh_exception = alloca i8*
14 %eh_selector = alloca i32
15 %"alloca point" = bitcast i32 0 to i32
16 call void @_ZN1AC1Ev(%struct.A* %a)
17 invoke void @_Z3barv()
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000018 to label %invcont unwind label %lpad
19
20invcont: ; preds = %entry
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000021 call void @_ZN1AD1Ev(%struct.A* %a) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000022 br label %return
23
24bb: ; preds = %ppad
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000025 %eh_select = load i32* %eh_selector
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000026 store i32 %eh_select, i32* %save_filt.1, align 4
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000027 %eh_value = load i8** %eh_exception
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000028 store i8* %eh_value, i8** %save_eptr.0, align 4
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000029 call void @_ZN1AD1Ev(%struct.A* %a) nounwind
30 %0 = load i8** %save_eptr.0, align 4
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000031 store i8* %0, i8** %eh_exception, align 4
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000032 %1 = load i32* %save_filt.1, align 4
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000033 store i32 %1, i32* %eh_selector, align 4
34 br label %Unwind
35
36return: ; preds = %invcont
37 ret void
38
39lpad: ; preds = %entry
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000040 %eh_ptr = call i8* @llvm.eh.exception()
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000041 store i8* %eh_ptr, i8** %eh_exception
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000042 %eh_ptr1 = load i8** %eh_exception
43 %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*), i32 0)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000044 store i32 %eh_select2, i32* %eh_selector
45 br label %ppad
46
47ppad: ; preds = %lpad
48 br label %bb
49
50Unwind: ; preds = %bb
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000051 %eh_ptr3 = load i8** %eh_exception
52 call void @_Unwind_SjLj_Resume(i8* %eh_ptr3)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000053 unreachable
54}
55
Rafael Espindola1e819662010-06-17 15:18:27 +000056define linkonce_odr void @_ZN1AC1Ev(%struct.A* %this) {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000057entry:
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000058 %this_addr = alloca %struct.A*
59 %"alloca point" = bitcast i32 0 to i32
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000060 store %struct.A* %this, %struct.A** %this_addr
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000061 %0 = call i8* @_Znwm(i32 4)
62 %1 = bitcast i8* %0 to i32*
63 %2 = load %struct.A** %this_addr, align 4
64 %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000065 store i32* %1, i32** %3, align 4
66 br label %return
67
68return: ; preds = %entry
69 ret void
70}
71
Rafael Espindola1e819662010-06-17 15:18:27 +000072declare i8* @_Znwm(i32)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000073
Rafael Espindola1e819662010-06-17 15:18:27 +000074define linkonce_odr void @_ZN1AD1Ev(%struct.A* %this) nounwind {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000075entry:
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000076 %this_addr = alloca %struct.A*
77 %"alloca point" = bitcast i32 0 to i32
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000078 store %struct.A* %this, %struct.A** %this_addr
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000079 %0 = load %struct.A** %this_addr, align 4
80 %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0
81 %2 = load i32** %1, align 4
82 %3 = bitcast i32* %2 to i8*
83 call void @_ZdlPv(i8* %3) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000084 br label %bb
85
86bb: ; preds = %entry
87 br label %return
88
89return: ; preds = %bb
90 ret void
91}
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000092
Rafael Espindola1e819662010-06-17 15:18:27 +000093declare void @_ZdlPv(i8*) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000094
Rafael Espindola1e819662010-06-17 15:18:27 +000095declare void @_Z3barv()
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000096
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000097declare i8* @llvm.eh.exception() nounwind readonly
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000098
Chris Lattnerb85e4eb2011-06-18 06:05:24 +000099declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +0000100
Chris Lattnerb85e4eb2011-06-18 06:05:24 +0000101declare i32 @llvm.eh.typeid.for(i8*) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +0000102
Rafael Espindola1e819662010-06-17 15:18:27 +0000103declare i32 @__gxx_personality_sj0(...)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +0000104
Rafael Espindola1e819662010-06-17 15:18:27 +0000105declare void @_Unwind_SjLj_Resume(i8*)