[WebAssemby] Support main functions with alternate signatures.
authorDan Gohman <dan433584@gmail.com>
Thu, 7 Dec 2017 13:49:27 +0000 (13:49 +0000)
committerDan Gohman <dan433584@gmail.com>
Thu, 7 Dec 2017 13:49:27 +0000 (13:49 +0000)
commitcdaa87dd2e5c91127348ca998ddac87f9622e88b
treeeb14ff1bba7740a481e10b293f86040a14863e55
parent439679c085373044bfc9ddb4e9f0197b000e180d
[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.

llvm-svn: 320041
llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
llvm/test/CodeGen/WebAssembly/main.ll [new file with mode: 0644]