OSDN Git Service

[WebAssembly] Update WebAssemblyLowerEmscriptenEHSjLj to handle separate compilation
authorSam Clegg <sbc@chromium.org>
Tue, 17 Jul 2018 16:40:03 +0000 (16:40 +0000)
committerSam Clegg <sbc@chromium.org>
Tue, 17 Jul 2018 16:40:03 +0000 (16:40 +0000)
commitcf065f711832ef000f28f934bf92114dc6aa0d85
tree1f66c7217a26632e9917de8166117f34aad7ceac
parente40f77a66b72358e1679c953723fbf443fba69ac
[WebAssembly] Update WebAssemblyLowerEmscriptenEHSjLj to handle separate compilation

Previously we were assuming whole program compilation. Now that
separate compilation is a thing we need to update this pass.
Firstly, it can no longer assert on the existence of malloc and free.
This functions might not be in the current translation unit.  If we
need them then we will generate not imports for them.

Secondly the global helper function we create should be marked as
weak since we will be generating a separate copy in each translation
unit.

Finally the names of the symbols used must be unique and fixed since
they need to agree across translation units.

Differential Revision: https://reviews.llvm.org/D49263

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337301 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
test/CodeGen/WebAssembly/lower-em-exceptions.ll
test/CodeGen/WebAssembly/lower-em-sjlj.ll