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 ptr
10 define dso_local i32 @main() personality ptr @__gxx_personality_v0 {
12 %retval = alloca i32, align 4
13 %exn.slot = alloca ptr, align 8
14 %ehselector.slot = alloca i32, align 4
15 store i32 0, ptr %retval, align 4
16 %exception = call ptr @__cxa_allocate_exception(i64 4) #1
17 store i32 1, ptr %exception, align 16
18 invoke void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) #2
19 to label %unreachable unwind label %lpad
21 lpad: ; preds = %entry
22 %0 = landingpad { ptr, i32 }
24 %1 = extractvalue { ptr, i32 } %0, 0
25 store ptr %1, ptr %exn.slot, align 8
26 %2 = extractvalue { ptr, i32 } %0, 1
27 store i32 %2, ptr %ehselector.slot, align 4
30 catch: ; preds = %lpad
31 %exn = load ptr, ptr %exn.slot, align 8
32 %3 = call ptr @__cxa_begin_catch(ptr %exn) #1
33 store i32 2, ptr %retval, align 4
34 call void @__cxa_end_catch()
37 try.cont: ; No predecessors!
38 store i32 1, ptr %retval, align 4
41 return: ; preds = %try.cont, %catch
42 %4 = load i32, ptr %retval, align 4
45 unreachable: ; preds = %entry
49 ; ASM: GCC_except_table0:
51 ; ASM: .byte 255 # @LPStart Encoding = omit
52 ; ASM: .byte 3 # @TType Encoding = udata4
55 ; NO128: .byte 3 # Call site Encoding = udata4
57 ; NO128: .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
58 ; NO128: .long .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
59 ; NO128: .long 0 # has no landing pad
60 ; NO128: .byte 0 # On action: cleanup
61 ; NO128: .long .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
62 ; NO128: .long .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
63 ; NO128: .long .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
64 ; NO128: .byte 1 # On action: 1
65 ; NO128: .long .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<
66 ; NO128: .long .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
67 ; NO128: .long 0 # has no landing pad
68 ; NO128: .byte 0 # On action: cleanup
70 ; ULEB128: .uleb128 .Lttbase0-.Lttbaseref0
71 ; ULEB128: .Lttbaseref0:
72 ; ULEB128: .byte 1 # Call site Encoding = uleb128
73 ; ULEB128: .uleb128 .Lcst_end0-.Lcst_begin0
74 ; ULEB128: .Lcst_begin0:
75 ; ULEB128: .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
76 ; ULEB128: .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
77 ; ULEB128: .byte 0 # has no landing pad
78 ; ULEB128: .byte 0 # On action: cleanup
79 ; ULEB128: .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
80 ; ULEB128: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
81 ; ULEB128: .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
82 ; ULEB128: .byte 1 # On action: 1
83 ; ULEB128: .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<
84 ; ULEB128: .uleb128 .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
85 ; ULEB128: .byte 0 # has no landing pad
86 ; ULEB128: .byte 0 # On action: cleanup
89 ; ASM: .byte 1 # >> Action Record 1 <<
90 ; ASM: # Catch TypeInfo 1
91 ; ASM: .byte 0 # No further actions
93 ; ASM: # >> Catch TypeInfos <<
94 ; ASM: .long 0 # TypeInfo 1
98 declare dso_local ptr @__cxa_allocate_exception(i64)
99 declare dso_local void @__cxa_throw(ptr, ptr, ptr)
100 declare dso_local i32 @__gxx_personality_v0(...)
101 declare dso_local ptr @__cxa_begin_catch(ptr)
102 declare dso_local void @__cxa_end_catch()