1 ; RUN: llc < %s -march=sparc -relocation-model=static | FileCheck -check-prefix=V8ABS %s
2 ; RUN: llc < %s -march=sparc -relocation-model=pic | FileCheck -check-prefix=V8PIC %s
3 ; RUN: llc < %s -march=sparc -relocation-model=pic -disable-cfi | FileCheck -check-prefix=V8PIC_NOCFI %s
4 ; RUN: llc < %s -march=sparcv9 -relocation-model=static | FileCheck -check-prefix=V9ABS %s
5 ; RUN: llc < %s -march=sparcv9 -relocation-model=pic | FileCheck -check-prefix=V9PIC %s
6 ; RUN: llc < %s -march=sparcv9 -relocation-model=pic -disable-cfi | FileCheck -check-prefix=V9PIC_NOCFI %s
9 %struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
10 %struct.__type_info_pseudo = type { i8*, i8* }
12 @_ZTIi = external constant %struct.__fundamental_type_info_pseudo
13 @_ZTIf = external constant %struct.__fundamental_type_info_pseudo
14 @.cst = linker_private unnamed_addr constant [12 x i8] c"catched int\00", align 64
15 @.cst1 = linker_private unnamed_addr constant [14 x i8] c"catched float\00", align 64
18 ; V8ABS: .cfi_startproc
19 ; V8ABS: .cfi_personality 0, __gxx_personality_v0
21 ; V8ABS: .cfi_def_cfa_register {{30|%fp}}
22 ; V8ABS: .cfi_window_save
23 ; V8ABS: .cfi_register 15, 31
25 ; V8ABS: call __cxa_throw
26 ; V8ABS: call __cxa_throw
28 ; V8ABS: call __cxa_begin_catch
29 ; V8ABS: call __cxa_end_catch
31 ; V8ABS: call __cxa_begin_catch
32 ; V8ABS: call __cxa_end_catch
37 ; V8PIC: .cfi_startproc
38 ; V8PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
39 ; V8PIC: .cfi_lsda 27,
40 ; V8PIC: .cfi_def_cfa_register {{30|%fp}}
41 ; V8PIC: .cfi_window_save
42 ; V8PIC: .cfi_register 15, 31
43 ; V8PIC: .section .gcc_except_table
45 ; V8PIC: .word %r_disp32(.L_ZTIi.DW.stub)
47 ; V8PIC: .L_ZTIi.DW.stub:
48 ; V8PIC-NEXT: .word _ZTIi
50 ; V8PIC_NOCFI-LABEL: main:
51 ; V8PIC_NOCFI: .section .gcc_except_table
52 ; V8PIC_NOCFI-NOT: .section
53 ; V8PIC_NOCFI: .word %r_disp32(.L_ZTIi.DW.stub)
55 ; V8PIC_NOCFI: .L_ZTIi.DW.stub:
56 ; V8PIC_NOCFI-NEXT: .word _ZTIi
57 ; V8PIC_NOCFI: .section .eh_frame
58 ; V8PIC_NOCFI-NOT: .section
59 ; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
60 ; V8PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
64 ; V9ABS: .cfi_startproc
65 ; V9ABS: .cfi_personality 0, __gxx_personality_v0
66 ; V9ABS: .cfi_lsda 27,
67 ; V9ABS: .cfi_def_cfa_register {{30|%fp}}
68 ; V9ABS: .cfi_window_save
69 ; V9ABS: .cfi_register 15, 31
70 ; V9ABS: .section .gcc_except_table
75 ; V9PIC: .cfi_startproc
76 ; V9PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
77 ; V9PIC: .cfi_lsda 27,
78 ; V9PIC: .cfi_def_cfa_register {{30|%fp}}
79 ; V9PIC: .cfi_window_save
80 ; V9PIC: .cfi_register 15, 31
81 ; V9PIC: .section .gcc_except_table
83 ; V9PIC: .word %r_disp32(.L_ZTIi.DW.stub)
85 ; V9PIC: .L_ZTIi.DW.stub:
86 ; V9PIC-NEXT: .xword _ZTIi
88 ; V9PIC_NOCFI-LABEL: main:
89 ; V9PIC_NOCFI: .section .gcc_except_table
90 ; V9PIC_NOCFI-NOT: .section
91 ; V9PIC_NOCFI: .word %r_disp32(.L_ZTIi.DW.stub)
93 ; V9PIC_NOCFI: .L_ZTIi.DW.stub:
94 ; V9PIC_NOCFI-NEXT: .xword _ZTIi
95 ; V9PIC_NOCFI: .section .eh_frame
96 ; V9PIC_NOCFI-NOT: .section
97 ; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
98 ; V9PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
100 define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
102 %0 = icmp eq i32 %argc, 2
103 %1 = tail call i8* @__cxa_allocate_exception(i32 4) #1
104 br i1 %0, label %"3", label %"4"
106 "3": ; preds = %entry
107 %2 = bitcast i8* %1 to i32*
108 store i32 0, i32* %2, align 4
109 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)* null) #2
110 to label %3 unwind label %"8"
112 ; <label>:3 ; preds = %"3"
115 "4": ; preds = %entry
116 %4 = bitcast i8* %1 to float*
117 store float 1.000000e+00, float* %4, align 4
120 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*), void (i8*)* null) #2
121 to label %5 unwind label %"8"
123 ; <label>:5 ; preds = %"4"
126 "5": ; preds = %"13", %"11"
127 %6 = phi i32 [ 2, %"13" ], [ 0, %"11" ]
130 "8": ; preds = %"4", %"3"
131 %exc = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0
132 catch %struct.__fundamental_type_info_pseudo* @_ZTIi
133 catch %struct.__fundamental_type_info_pseudo* @_ZTIf
134 %exc_ptr12 = extractvalue { i8*, i32 } %exc, 0
135 %filter13 = extractvalue { i8*, i32 } %exc, 1
136 %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
137 %7 = icmp eq i32 %filter13, %typeid
138 br i1 %7, label %"11", label %8
140 ; <label>:8 ; preds = %"8"
141 %typeid8 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*))
142 %9 = icmp eq i32 %filter13, %typeid8
143 br i1 %9, label %"13", label %"9"
146 resume { i8*, i32 } %exc
149 %10 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
150 %11 = tail call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.cst, i32 0, i32 0))
151 tail call void @__cxa_end_catch() #1
155 %12 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
156 %13 = tail call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.cst1, i32 0, i32 0))
157 tail call void @__cxa_end_catch() #1
161 ; Function Attrs: nounwind
162 declare i8* @__cxa_allocate_exception(i32) #1
164 ; Function Attrs: noreturn
165 declare void @__cxa_throw(i8*, i8*, void (i8*)*) #2
167 declare void @__cxa_end_catch()
169 ; Function Attrs: nounwind readnone
170 declare i32 @llvm.eh.typeid.for(i8*) #3
172 ; Function Attrs: nounwind
173 declare i8* @__cxa_begin_catch(i8*) #1
175 ; Function Attrs: nounwind
176 declare i32 @puts(i8* nocapture readonly) #1
178 declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
180 attributes #0 = { "no-frame-pointer-elim-non-leaf"="false" }
181 attributes #1 = { nounwind }
182 attributes #2 = { noreturn }
183 attributes #3 = { nounwind readnone }