xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/ehabi-handlerdata.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; ARM EHABI test for the handlerdata.
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; This test case checks whether the handlerdata for exception
4*9880d681SAndroid Build Coastguard Worker; handling is generated properly.
5*9880d681SAndroid Build Coastguard Worker;
6*9880d681SAndroid Build Coastguard Worker; (1) The handlerdata must not be empty.
7*9880d681SAndroid Build Coastguard Worker; (2) LPStartEncoding == DW_EH_PE_omit
8*9880d681SAndroid Build Coastguard Worker; (3) TTypeEncoding == DW_EH_PE_absptr
9*9880d681SAndroid Build Coastguard Worker; (4) CallSiteEncoding == DW_EH_PE_udata4
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple arm-unknown-linux-gnueabi -filetype=asm -o - %s \
12*9880d681SAndroid Build Coastguard Worker; RUN:   | FileCheck %s
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple arm-unknown-linux-gnueabi -filetype=asm -o - %s \
15*9880d681SAndroid Build Coastguard Worker; RUN:     -relocation-model=pic \
16*9880d681SAndroid Build Coastguard Worker; RUN:   | FileCheck %s
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdeclare void @throw_exception()
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerdeclare i32 @__gxx_personality_v0(...)
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerdeclare i8* @__cxa_begin_catch(i8*)
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdeclare void @__cxa_end_catch()
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdefine void @test1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker  invoke void @throw_exception() to label %try.cont unwind label %lpad
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerlpad:
31*9880d681SAndroid Build Coastguard Worker  %0 = landingpad { i8*, i32 }
32*9880d681SAndroid Build Coastguard Worker          catch i8* null
33*9880d681SAndroid Build Coastguard Worker  %1 = extractvalue { i8*, i32 } %0, 0
34*9880d681SAndroid Build Coastguard Worker  %2 = tail call i8* @__cxa_begin_catch(i8* %1)
35*9880d681SAndroid Build Coastguard Worker  tail call void @__cxa_end_catch()
36*9880d681SAndroid Build Coastguard Worker  br label %try.cont
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workertry.cont:
39*9880d681SAndroid Build Coastguard Worker  ret void
40*9880d681SAndroid Build Coastguard Worker}
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; CHECK:   .globl test1
43*9880d681SAndroid Build Coastguard Worker; CHECK:   .p2align 2
44*9880d681SAndroid Build Coastguard Worker; CHECK:   .type test1,%function
45*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1:
46*9880d681SAndroid Build Coastguard Worker; CHECK:   .fnstart
47*9880d681SAndroid Build Coastguard Worker; CHECK:   .personality __gxx_personality_v0
48*9880d681SAndroid Build Coastguard Worker; CHECK:   .handlerdata
49*9880d681SAndroid Build Coastguard Worker; CHECK:   .p2align 2
50*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: GCC_except_table0:
51*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: .Lexception0:
52*9880d681SAndroid Build Coastguard Worker; CHECK:   .byte 255                     @ @LPStart Encoding = omit
53*9880d681SAndroid Build Coastguard Worker; CHECK:   .byte 0                       @ @TType Encoding = absptr
54*9880d681SAndroid Build Coastguard Worker; CHECK:   .asciz
55*9880d681SAndroid Build Coastguard Worker; CHECK:   .byte 3                       @ Call site Encoding = udata4
56*9880d681SAndroid Build Coastguard Worker; CHECK:   .long
57*9880d681SAndroid Build Coastguard Worker; CHECK:   .long
58*9880d681SAndroid Build Coastguard Worker; CHECK:   .long
59*9880d681SAndroid Build Coastguard Worker; CHECK:   .fnend
60