OSDN Git Service

[WebAssembly] Add a pass to create wrappers for function bitcasts.
authorDan Gohman <dan433584@gmail.com>
Sat, 7 Jan 2017 00:34:54 +0000 (00:34 +0000)
committerDan Gohman <dan433584@gmail.com>
Sat, 7 Jan 2017 00:34:54 +0000 (00:34 +0000)
commit91f4652a9e4d8c3dc419c3485e22939720cc684d
tree64cd51e5999218db5e4ef961dd6c23ffe243c26f
parentda319ede9aafd97596b5cd882813d18896daae34
[WebAssembly] Add a pass to create wrappers for function bitcasts.

WebAssembly requires caller and callee signatures to match exactly. In LLVM,
there are a variety of circumstances where signatures may be mismatched in
practice, and one can bitcast a function address to another type to call it
as that type. This patch adds a pass which replaces bitcasted function
addresses with wrappers to replace the bitcasts.

This doesn't catch everything, but it does match many common cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291315 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/CMakeLists.txt
lib/Target/WebAssembly/WebAssembly.h
lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp [new file with mode: 0644]
lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
test/CodeGen/WebAssembly/function-bitcasts.ll [new file with mode: 0644]