diff options
author | Dan Gohman <dan433584@gmail.com> | 2017-12-07 13:49:27 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2017-12-07 13:49:27 +0000 |
commit | 959e37e669b0c3cfad4cb9f1f7c9261ce9f5e9ae (patch) | |
tree | 1aadace7e992f380160e6e1575b22538b6a19ed3 /test/CodeGen/WebAssembly | |
parent | 7d3718531c433321dccbb4808822d1078018f8e8 (diff) |
[WebAssemby] Support main functions with alternate signatures.
WebAssembly requires caller and callee signatures to match, so the usual
C runtime trick of calling main and having it just work regardless of
whether main is defined as '()' or '(int argc, char *argv[])' doesn't
work. Extend the FixFunctionBitcasts pass to rewrite main to use the
latter form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WebAssembly')
-rw-r--r-- | test/CodeGen/WebAssembly/main.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGen/WebAssembly/main.ll b/test/CodeGen/WebAssembly/main.ll new file mode 100644 index 00000000000..314dde28307 --- /dev/null +++ b/test/CodeGen/WebAssembly/main.ll @@ -0,0 +1,18 @@ +; RUN: llc < %s -asm-verbose=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 |