1 # RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+exception-handling < %s | FileCheck %s
3 # Tests if block/loop/try/catch/end/branch/rethrow instructions are correctly
4 # printed with their annotations.
7 .section .text.test_annotation,"",@
8 .type test_annotation,@function
10 .functype test_annotation (exnref) -> ()
11 .tagtype __cpp_exception i32
12 .tagtype __c_longjmp i32
44 block
() -> (i32
, exnref
)
46 try_table
(catch __cpp_exception
0) (catch_ref __c_longjmp
1) (catch_all
2) (catch_all_ref
3)
62 try_table
(catch __cpp_exception
1) (catch_all_ref
0)
70 # CHECK: test_annotation:
72 # CHECK-NEXT: br 0 # 0: down to label0
73 # CHECK-NEXT: catch __cpp_exception # catch0:
76 # CHECK-NEXT: i32.const 0
77 # CHECK-NEXT: br_if 0 # 0: down to label1
78 # CHECK-NEXT: loop # label2:
79 # CHECK-NEXT: i32.const 0
80 # CHECK-NEXT: br_if 1 # 1: down to label1
81 # CHECK-NEXT: end_loop
82 # CHECK-NEXT: end_block # label1:
84 # CHECK-NEXT: rethrow 0 # down to catch3
85 # CHECK-NEXT: catch __cpp_exception # catch3:
87 # CHECK-NEXT: catch_all{{$}}
90 # CHECK-NEXT: br 0 # 0: down to label5
92 # CHECK-NEXT: delegate 1 # label/catch6: down to catch4
93 # CHECK-NEXT: catch_all # catch5:
94 # CHECK-NEXT: end_try # label5:
95 # CHECK-NEXT: end_block # label4:
96 # CHECK-NEXT: rethrow 0 # to caller
97 # CHECK-NEXT: end_try # label3:
98 # CHECK-NEXT: end_try # label0:
100 # CHECK: block exnref
102 # CHECK-NEXT: block () -> (i32, exnref)
103 # CHECK-NEXT: block i32
104 # CHECK-NEXT: try_table (catch __cpp_exception 0) (catch_ref __c_longjmp 1) (catch_all 2) (catch_all_ref 3) # 0: down to label10
105 # CHECK-NEXT: # 1: down to label9
106 # CHECK-NEXT: # 2: down to label8
107 # CHECK-NEXT: # 3: down to label7
108 # CHECK-NEXT: end_try_table # label11:
110 # CHECK-NEXT: end_block # label10:
112 # CHECK-NEXT: end_block # label9:
114 # CHECK-NEXT: end_block # label8:
116 # CHECK-NEXT: end_block # label7:
120 # CHECK-NEXT: loop (i32) -> () # label12:
121 # CHECK-NEXT: local.get 0
122 # CHECK-NEXT: loop (exnref) -> () # label13:
123 # CHECK-NEXT: try_table (catch __cpp_exception 1) (catch_all_ref 0) # 1: up to label12
124 # CHECK-NEXT: # 0: up to label13
125 # CHECK-NEXT: end_try_table # label14:
127 # CHECK-NEXT: end_loop
129 # CHECK-NEXT: end_loop
130 # CHECK-NEXT: end_function