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