1 ; RUN: llc -verify-machineinstrs -mtriple x86_64-pc-linux-gnu -filetype=asm < %s | \
2 ; RUN: FileCheck --check-prefixes=ASM,ULEB128 %s
3 ; RUN: llc -verify-machineinstrs -mtriple x86_64-pc-linux-gnu -use-leb128-directives=true -filetype=asm < %s | \
4 ; RUN: FileCheck --check-prefixes=ASM,ULEB128 %s
5 ; RUN: llc -verify-machineinstrs -mtriple x86_64-pc-linux-gnu -use-leb128-directives=false -filetype=asm < %s | \
6 ; RUN: FileCheck --check-prefixes=ASM,NO128 %s
8 @_ZTIi = external dso_local constant i8*
10 define dso_local i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
12 %retval = alloca i32, align 4
13 %exn.slot = alloca i8*, align 8
14 %ehselector.slot = alloca i32, align 4
15 store i32 0, i32* %retval, align 4
16 %exception = call i8* @__cxa_allocate_exception(i64 4) #1
17 %0 = bitcast i8* %exception to i32*
18 store i32 1, i32* %0, align 16
19 invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
20 to label %unreachable unwind label %lpad
22 lpad: ; preds = %entry
23 %1 = landingpad { i8*, i32 }
25 %2 = extractvalue { i8*, i32 } %1, 0
26 store i8* %2, i8** %exn.slot, align 8
27 %3 = extractvalue { i8*, i32 } %1, 1
28 store i32 %3, i32* %ehselector.slot, align 4
31 catch: ; preds = %lpad
32 %exn = load i8*, i8** %exn.slot, align 8
33 %4 = call i8* @__cxa_begin_catch(i8* %exn) #1
34 store i32 2, i32* %retval, align 4
35 call void @__cxa_end_catch()
38 try.cont: ; No predecessors!
39 store i32 1, i32* %retval, align 4
42 return: ; preds = %try.cont, %catch
43 %5 = load i32, i32* %retval, align 4
46 unreachable: ; preds = %entry
50 ; ASM: GCC_except_table0:
52 ; ASM: .byte 255 # @LPStart Encoding = omit
53 ; ASM: .byte 3 # @TType Encoding = udata4
56 ; NO128: .byte 3 # Call site Encoding = udata4
58 ; NO128: .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
59 ; NO128: .long .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
60 ; NO128: .long 0 # has no landing pad
61 ; NO128: .byte 0 # On action: cleanup
62 ; NO128: .long .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
63 ; NO128: .long .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
64 ; NO128: .long .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
65 ; NO128: .byte 1 # On action: 1
66 ; NO128: .long .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<
67 ; NO128: .long .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
68 ; NO128: .long 0 # has no landing pad
69 ; NO128: .byte 0 # On action: cleanup
71 ; ULEB128: .uleb128 .Lttbase0-.Lttbaseref0
72 ; ULEB128: .Lttbaseref0:
73 ; ULEB128: .byte 1 # Call site Encoding = uleb128
74 ; ULEB128: .uleb128 .Lcst_end0-.Lcst_begin0
75 ; ULEB128: .Lcst_begin0:
76 ; ULEB128: .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
77 ; ULEB128: .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
78 ; ULEB128: .byte 0 # has no landing pad
79 ; ULEB128: .byte 0 # On action: cleanup
80 ; ULEB128: .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
81 ; ULEB128: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
82 ; ULEB128: .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
83 ; ULEB128: .byte 1 # On action: 1
84 ; ULEB128: .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<
85 ; ULEB128: .uleb128 .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
86 ; ULEB128: .byte 0 # has no landing pad
87 ; ULEB128: .byte 0 # On action: cleanup
90 ; ASM: .byte 1 # >> Action Record 1 <<
91 ; ASM: # Catch TypeInfo 1
92 ; ASM: .byte 0 # No further actions
94 ; ASM: # >> Catch TypeInfos <<
95 ; ASM: .long 0 # TypeInfo 1
99 declare dso_local i8* @__cxa_allocate_exception(i64)
100 declare dso_local void @__cxa_throw(i8*, i8*, i8*)
101 declare dso_local i32 @__gxx_personality_v0(...)
102 declare dso_local i8* @__cxa_begin_catch(i8*)
103 declare dso_local void @__cxa_end_catch()