1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/CodeGen/WebAssembly/function-info.mir
Heejin Ahn ff03e33ba0 [WebAssembly] Support WasmEHFuncInfo serialization
This adds support for serialization of `WasmEHFuncInfo`, in the form of
<Source BB Number, Unwind destination BB number>. To make YAML mapping
work, we needed to make a copy of the existing `SrcToUnwindDest` map
within `yaml::WebAssemblyMachineFunctionInfo`.

It was hard to add EH MIR tests for CFGStackify because `WasmEHFuncInfo`
could not be read from test MIR files. This adds the serialization
support for that to make EH MIR tests easier.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D97174
2021-02-22 13:13:51 -08:00

58 lines
1.7 KiB
YAML

# RUN: llc -mtriple=wasm32-unknown-unknown -exception-model=wasm -mattr=+exception-handling -run-pass wasm-cfg-sort -run-pass wasm-cfg-stackify %s -o - | FileCheck %s
--- |
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"
declare i32 @__gxx_wasm_personality_v0(...)
declare void @foo()
define void @function_property_test() {
ret void
}
define void @wasm_eh_info_test() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) {
ret void
}
...
# CHECK-LABEL: name: function_property_test
# CHECK: machineFunctionInfo:
# CHECK: isCFGStackified: true
name: function_property_test
liveins:
- { reg: '$arguments' }
body: |
bb.0:
RETURN implicit-def dead $arguments
...
---
# CHECK-LABEL: name: wasm_eh_info_test
# CHECK: machineFunctionInfo:
name: wasm_eh_info_test
liveins:
- { reg: '$arguments' }
# CHECK: wasmEHFuncInfo:
# bb.2 becomes bb.1 and bb.3 becomes bb.2 after CFGSort.
# CHECK-NEXT: 1: 2
machineFunctionInfo:
wasmEHFuncInfo:
2: 3
body: |
bb.0:
successors: %bb.1, %bb.2
CALL @foo, implicit-def dead $arguments, implicit $sp32, implicit $sp64, implicit-def dead $arguments, implicit $sp32, implicit $sp64
bb.1:
RETURN implicit-def dead $arguments
bb.2 (landing-pad):
successors: %bb.1, %bb.3
%0:i32 = CATCH &__cpp_exception, implicit-def dead $arguments
CALL @foo, implicit-def dead $arguments, implicit $sp32, implicit $sp64, implicit-def dead $arguments, implicit $sp32, implicit $sp64
BR %bb.1, implicit-def $arguments
bb.3 (landing-pad):
CATCH_ALL implicit-def $arguments
RETHROW 0, implicit-def $arguments
...