xref: /llvm-project/llvm/test/CodeGen/LoongArch/dwarf-eh.ll (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1; RUN: llc --mtriple=loongarch32 -mattr=+d --relocation-model=static < %s | FileCheck %s
2; RUN: llc --mtriple=loongarch32 -mattr=+d --relocation-model=pic < %s | FileCheck %s
3; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=static < %s | FileCheck %s
4; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=pic < %s | FileCheck %s
5
6declare void @throw_exception()
7
8declare i32 @__gxx_personality_v0(...)
9
10declare ptr @__cxa_begin_catch(ptr)
11
12declare void @__cxa_end_catch()
13
14; CHECK-LABEL: test1:
15; CHECK: .cfi_startproc
16;; PersonalityEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
17; CHECK-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0
18;; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4
19; CHECK-NEXT: .cfi_lsda 27, .Lexception0
20
21define void @test1() personality ptr @__gxx_personality_v0 {
22entry:
23  invoke void @throw_exception() to label %try.cont unwind label %lpad
24
25lpad:
26  %0 = landingpad { ptr, i32 }
27          catch ptr null
28  %1 = extractvalue { ptr, i32 } %0, 0
29  %2 = tail call ptr @__cxa_begin_catch(ptr %1)
30  tail call void @__cxa_end_catch()
31  br label %try.cont
32
33try.cont:
34  ret void
35}
36
37; CHECK-LABEL: GCC_except_table0:
38; CHECK-NEXT: .Lexception0:
39; CHECK-NEXT: .byte 255 # @LPStart Encoding = omit
40;; TTypeEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
41; CHECK-NEXT: .byte 155 # @TType Encoding = indirect pcrel sdata4
42; CHECK: .Lttbaseref0:
43;; CallSiteEncoding = dwarf::DW_EH_PE_uleb128
44; CHECK-NEXT: .byte 1                       # Call site Encoding = uleb128
45; CHECK-NEXT: .uleb128 .Lcst_end0-.Lcst_begin0
46; CHECK-NEXT: .Lcst_begin0:
47; CHECK-NEXT: .uleb128 .Ltmp0-.Lfunc_begin0   # >> Call Site 1 <<
48; CHECK-NEXT: .uleb128 .Ltmp1-.Ltmp0          #   Call between .Ltmp0 and .Ltmp1
49; CHECK-NEXT: .uleb128 .Ltmp2-.Lfunc_begin0   #     jumps to .Ltmp2
50; CHECK-NEXT: .byte 1                       #   On action: 1
51; CHECK-NEXT: .uleb128 .Ltmp1-.Lfunc_begin0   # >> Call Site 2 <<
52; CHECK-NEXT: .uleb128 .Lfunc_end0-.Ltmp1     #   Call between .Ltmp1 and .Lfunc_end0
53; CHECK-NEXT: .byte 0                       #     has no landing pad
54; CHECK-NEXT: .byte 0                       #   On action: cleanup
55