SJLJ is arm/darwin only for now. force the triple for the test
[oota-llvm.git] / test / CodeGen / ARM / 2009-08-31-LSDA-Name.ll
1 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -march=arm -f | FileCheck %s
2
3 %struct.A = type { i32* }
4
5 define arm_apcscc void @"\01-[MyFunction Name:]"() {
6 entry:
7   %save_filt.1 = alloca i32                       ; <i32*> [#uses=2]
8   %save_eptr.0 = alloca i8*                       ; <i8**> [#uses=2]
9   %a = alloca %struct.A                           ; <%struct.A*> [#uses=3]
10   %eh_exception = alloca i8*                      ; <i8**> [#uses=5]
11   %eh_selector = alloca i32                       ; <i32*> [#uses=3]
12   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
13   call arm_apcscc  void @_ZN1AC1Ev(%struct.A* %a)
14   invoke arm_apcscc  void @_Z3barv()
15           to label %invcont unwind label %lpad
16
17 invcont:                                          ; preds = %entry
18   call arm_apcscc  void @_ZN1AD1Ev(%struct.A* %a) nounwind
19   br label %return
20
21 bb:                                               ; preds = %ppad
22   %eh_select = load i32* %eh_selector             ; <i32> [#uses=1]
23   store i32 %eh_select, i32* %save_filt.1, align 4
24   %eh_value = load i8** %eh_exception             ; <i8*> [#uses=1]
25   store i8* %eh_value, i8** %save_eptr.0, align 4
26   call arm_apcscc  void @_ZN1AD1Ev(%struct.A* %a) nounwind
27   %0 = load i8** %save_eptr.0, align 4            ; <i8*> [#uses=1]
28   store i8* %0, i8** %eh_exception, align 4
29   %1 = load i32* %save_filt.1, align 4            ; <i32> [#uses=1]
30   store i32 %1, i32* %eh_selector, align 4
31   br label %Unwind
32
33 return:                                           ; preds = %invcont
34   ret void
35
36 lpad:                                             ; preds = %entry
37   %eh_ptr = call i8* @llvm.eh.exception()         ; <i8*> [#uses=1]
38   store i8* %eh_ptr, i8** %eh_exception
39   %eh_ptr1 = load i8** %eh_exception              ; <i8*> [#uses=1]
40   %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*), i32 0) ; <i32> [#uses=1]
41   store i32 %eh_select2, i32* %eh_selector
42   br label %ppad
43
44 ppad:                                             ; preds = %lpad
45   br label %bb
46
47 Unwind:                                           ; preds = %bb
48   %eh_ptr3 = load i8** %eh_exception              ; <i8*> [#uses=1]
49   call arm_apcscc  void @_Unwind_SjLj_Resume(i8* %eh_ptr3)
50   unreachable
51 }
52
53 define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A* %this) {
54 entry:
55   %this_addr = alloca %struct.A*                  ; <%struct.A**> [#uses=2]
56   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
57   store %struct.A* %this, %struct.A** %this_addr
58   %0 = call arm_apcscc  i8* @_Znwm(i32 4)         ; <i8*> [#uses=1]
59   %1 = bitcast i8* %0 to i32*                     ; <i32*> [#uses=1]
60   %2 = load %struct.A** %this_addr, align 4       ; <%struct.A*> [#uses=1]
61   %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; <i32**> [#uses=1]
62   store i32* %1, i32** %3, align 4
63   br label %return
64
65 return:                                           ; preds = %entry
66   ret void
67 }
68
69 declare arm_apcscc i8* @_Znwm(i32)
70
71 define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this) nounwind {
72 entry:
73   %this_addr = alloca %struct.A*                  ; <%struct.A**> [#uses=2]
74   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
75   store %struct.A* %this, %struct.A** %this_addr
76   %0 = load %struct.A** %this_addr, align 4       ; <%struct.A*> [#uses=1]
77   %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; <i32**> [#uses=1]
78   %2 = load i32** %1, align 4                     ; <i32*> [#uses=1]
79   %3 = bitcast i32* %2 to i8*                     ; <i8*> [#uses=1]
80   call arm_apcscc  void @_ZdlPv(i8* %3) nounwind
81   br label %bb
82
83 bb:                                               ; preds = %entry
84   br label %return
85
86 return:                                           ; preds = %bb
87   ret void
88 }
89 ;CHECK: L_LSDA_1:
90
91 declare arm_apcscc void @_ZdlPv(i8*) nounwind
92
93 declare arm_apcscc void @_Z3barv()
94
95 declare i8* @llvm.eh.exception() nounwind
96
97 declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
98
99 declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind
100
101 declare arm_apcscc i32 @__gxx_personality_sj0(...)
102
103 declare arm_apcscc void @_Unwind_SjLj_Resume(i8*)