blob: b45d998a9c1f56a8d4da926767be3b1334a2ad4f [file] [log] [blame]
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +00001; 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
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +00003; RUN: llc < %s -march=sparc -relocation-model=pic -disable-cfi | FileCheck -check-prefix=V8PIC_NOCFI %s
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +00004; 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
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +00006; RUN: llc < %s -march=sparcv9 -relocation-model=pic -disable-cfi | FileCheck -check-prefix=V9PIC_NOCFI %s
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +00007
8
9%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
10%struct.__type_info_pseudo = type { i8*, i8* }
11
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
16
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000017; V8ABS-LABEL: main:
18; V8ABS: .cfi_startproc
19; V8ABS: .cfi_personality 0, __gxx_personality_v0
20; V8ABS: .cfi_lsda 0,
21; V8ABS: .cfi_def_cfa_register {{30|%fp}}
22; V8ABS: .cfi_window_save
23; V8ABS: .cfi_register 15, 31
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000024
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000025; V8ABS: call __cxa_throw
26; V8ABS: call __cxa_throw
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000027
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000028; V8ABS: call __cxa_begin_catch
29; V8ABS: call __cxa_end_catch
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000030
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000031; V8ABS: call __cxa_begin_catch
32; V8ABS: call __cxa_end_catch
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000033
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000034; V8ABS: .cfi_endproc
35
36; V8PIC-LABEL: main:
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
44; V8PIC-NOT: .section
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000045; V8PIC: .word %r_disp32(.L_ZTIi.DW.stub)
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000046; V8PIC: .data
47; V8PIC: .L_ZTIi.DW.stub:
48; V8PIC-NEXT: .word _ZTIi
49
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000050; 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)
54; V8PIC_NOCFI: .data
55; V8PIC_NOCFI: .L_ZTIi.DW.stub:
56; V8PIC_NOCFI-NEXT: .word _ZTIi
57; V8PIC_NOCFI: .section .eh_frame
58; V8PIC_NOCFI-NOT: .section
Venkatraman Govindaraju52b64732014-02-01 18:54:16 +000059; V8PIC_NOCFI: .byte 15 ! CIE Return Address Column
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000060; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
Venkatraman Govindaraju52b64732014-02-01 18:54:16 +000061; V8PIC_NOCFI: .byte 12 ! DW_CFA_def_cfa
62; V8PIC_NOCFI: .byte 14 ! Reg 14
63; V8PIC_NOCFI-NEXT: .byte 0 ! Offset 0
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +000064; V8PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000065
66
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000067; V9ABS-LABEL: main:
68; V9ABS: .cfi_startproc
69; V9ABS: .cfi_personality 0, __gxx_personality_v0
70; V9ABS: .cfi_lsda 27,
71; V9ABS: .cfi_def_cfa_register {{30|%fp}}
72; V9ABS: .cfi_window_save
73; V9ABS: .cfi_register 15, 31
74; V9ABS: .section .gcc_except_table
75; V9ABS-NOT: .section
76; V9ABS: .xword _ZTIi
77
78; V9PIC-LABEL: main:
79; V9PIC: .cfi_startproc
80; V9PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
81; V9PIC: .cfi_lsda 27,
82; V9PIC: .cfi_def_cfa_register {{30|%fp}}
83; V9PIC: .cfi_window_save
84; V9PIC: .cfi_register 15, 31
85; V9PIC: .section .gcc_except_table
86; V9PIC-NOT: .section
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000087; V9PIC: .word %r_disp32(.L_ZTIi.DW.stub)
Jakob Stoklund Olesen83c67732014-01-28 02:52:26 +000088; V9PIC: .data
89; V9PIC: .L_ZTIi.DW.stub:
90; V9PIC-NEXT: .xword _ZTIi
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000091
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000092; V9PIC_NOCFI-LABEL: main:
93; V9PIC_NOCFI: .section .gcc_except_table
94; V9PIC_NOCFI-NOT: .section
95; V9PIC_NOCFI: .word %r_disp32(.L_ZTIi.DW.stub)
96; V9PIC_NOCFI: .data
97; V9PIC_NOCFI: .L_ZTIi.DW.stub:
98; V9PIC_NOCFI-NEXT: .xword _ZTIi
99; V9PIC_NOCFI: .section .eh_frame
100; V9PIC_NOCFI-NOT: .section
Venkatraman Govindaraju52b64732014-02-01 18:54:16 +0000101; V9PIC_NOCFI: .byte 15 ! CIE Return Address Column
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +0000102; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
Venkatraman Govindaraju52b64732014-02-01 18:54:16 +0000103; V9PIC_NOCFI: .byte 12 ! DW_CFA_def_cfa
104; V9PIC_NOCFI-NEXT: .byte 14 ! Reg 14
105; V9PIC_NOCFI: .ascii "\377\017" ! Offset 2047
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +0000106; V9PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +0000107
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +0000108define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
109entry:
110 %0 = icmp eq i32 %argc, 2
111 %1 = tail call i8* @__cxa_allocate_exception(i32 4) #1
112 br i1 %0, label %"3", label %"4"
113
114"3": ; preds = %entry
115 %2 = bitcast i8* %1 to i32*
116 store i32 0, i32* %2, align 4
117 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)* null) #2
118 to label %3 unwind label %"8"
119
120; <label>:3 ; preds = %"3"
121 unreachable
122
123"4": ; preds = %entry
124 %4 = bitcast i8* %1 to float*
125 store float 1.000000e+00, float* %4, align 4
126
127
128 invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*), void (i8*)* null) #2
129 to label %5 unwind label %"8"
130
131; <label>:5 ; preds = %"4"
132 unreachable
133
134"5": ; preds = %"13", %"11"
135 %6 = phi i32 [ 2, %"13" ], [ 0, %"11" ]
136 ret i32 %6
137
138"8": ; preds = %"4", %"3"
139 %exc = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0
140 catch %struct.__fundamental_type_info_pseudo* @_ZTIi
141 catch %struct.__fundamental_type_info_pseudo* @_ZTIf
142 %exc_ptr12 = extractvalue { i8*, i32 } %exc, 0
143 %filter13 = extractvalue { i8*, i32 } %exc, 1
144 %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
145 %7 = icmp eq i32 %filter13, %typeid
146 br i1 %7, label %"11", label %8
147
148; <label>:8 ; preds = %"8"
149 %typeid8 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*))
150 %9 = icmp eq i32 %filter13, %typeid8
151 br i1 %9, label %"13", label %"9"
152
153"9": ; preds = %8
154 resume { i8*, i32 } %exc
155
156"11": ; preds = %"8"
157 %10 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
158 %11 = tail call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.cst, i32 0, i32 0))
159 tail call void @__cxa_end_catch() #1
160 br label %"5"
161
162"13": ; preds = %8
163 %12 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
164 %13 = tail call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.cst1, i32 0, i32 0))
165 tail call void @__cxa_end_catch() #1
166 br label %"5"
167}
168
169; Function Attrs: nounwind
170declare i8* @__cxa_allocate_exception(i32) #1
171
172; Function Attrs: noreturn
173declare void @__cxa_throw(i8*, i8*, void (i8*)*) #2
174
175declare void @__cxa_end_catch()
176
177; Function Attrs: nounwind readnone
178declare i32 @llvm.eh.typeid.for(i8*) #3
179
180; Function Attrs: nounwind
181declare i8* @__cxa_begin_catch(i8*) #1
182
183; Function Attrs: nounwind
184declare i32 @puts(i8* nocapture readonly) #1
185
186declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
187
188attributes #0 = { "no-frame-pointer-elim-non-leaf"="false" }
189attributes #1 = { nounwind }
190attributes #2 = { noreturn }
191attributes #3 = { nounwind readnone }