diff options
author | Dan Gohman <dan433584@gmail.com> | 2017-12-08 21:18:21 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2017-12-08 21:18:21 +0000 |
commit | 2e99c3afdad5b63a6a999e4de2e3ed2b8fa7a2a8 (patch) | |
tree | 1d41393696fc481997eb984d46fae54dd326e78f /test/CodeGen/WebAssembly | |
parent | 789bf2ab8bbea231d5bef3314abcf6be50ad4129 (diff) |
[WebAssemby] Re-apply r320041: "Support main functions with alternate signatures."
This includes a fix so that it doesn't transform declarations, and it
puts the functionality under control of a command-line option which is off
by default to avoid breaking existing setups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WebAssembly')
-rw-r--r-- | test/CodeGen/WebAssembly/main-declaration.ll | 19 | ||||
-rw-r--r-- | test/CodeGen/WebAssembly/main.ll | 18 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/CodeGen/WebAssembly/main-declaration.ll b/test/CodeGen/WebAssembly/main-declaration.ll new file mode 100644 index 00000000000..4e337850b81 --- /dev/null +++ b/test/CodeGen/WebAssembly/main-declaration.ll @@ -0,0 +1,19 @@ +; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s + +; Test main functions with alternate signatures. + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown-wasm" + +declare void @main() + +define void @foo() { + call void @main() + ret void +} + +; CHECK-NOT: __original_main +; CHECK-LABEL: foo: +; CHECK-NEXT: call main@FUNCTION +; CHECK-NEXT: end_function +; CHECK-NOT: __original_main diff --git a/test/CodeGen/WebAssembly/main.ll b/test/CodeGen/WebAssembly/main.ll new file mode 100644 index 00000000000..c77db8467d8 --- /dev/null +++ b/test/CodeGen/WebAssembly/main.ll @@ -0,0 +1,18 @@ +; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s + +; Test main functions with alternate signatures. + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown-wasm" + +define void @main() { + ret void +} + +; CHECK-LABEL: .L__original_main: +; CHECK-NEXT: end_function + +; CHECK-LABEL: main: +; CHECK-NEXT: .param i32, i32 +; CHECK-NEXT: .result i32 +; CHECK: call .L__original_main@FUNCTION |