[WebAssembly] Refactor and fix emission of external IR global decls
authorPaulo Matos <pmatos@igalia.com>
Mon, 31 Jan 2022 10:42:02 +0000 (11:42 +0100)
committerPaulo Matos <pmatos@igalia.com>
Mon, 31 Jan 2022 10:42:21 +0000 (11:42 +0100)
commit00bf4755e90c89963a135739218ef49c2417109f
tree828f9ff70fed0a456fd986215741ad674e0704dd
parent4606f838b2b60ce7d3995adf194eee470bf2395b
[WebAssembly] Refactor and fix emission of external IR global decls

This patches fixes the visibility and linkage information of symbols
referring to IR globals.

Emission of external declarations is now done in the first execution
of emitConstantPool rather than in emitLinkage (and a few other
places). This is the point where we have already gathered information
about used symbols (by running the MC Lower PrePass) and not yet
started emitting any functions so that any declarations that need to
be emitted are done so at the top of the file before any functions.

This changes the order of a few directives in the final asm file which
required an update to a few tests.

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D118122
13 files changed:
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.h
llvm/lib/Target/WebAssembly/WebAssemblyMCLowerPrePass.cpp
llvm/test/CodeGen/WebAssembly/externref-tableget.ll
llvm/test/CodeGen/WebAssembly/externref-tableset.ll
llvm/test/CodeGen/WebAssembly/funcref-table_call.ll
llvm/test/CodeGen/WebAssembly/funcref-tableget.ll
llvm/test/CodeGen/WebAssembly/funcref-tableset.ll
llvm/test/CodeGen/WebAssembly/global-get.ll
llvm/test/CodeGen/WebAssembly/global-set.ll
llvm/test/CodeGen/WebAssembly/table-types.ll [new file with mode: 0644]
llvm/test/MC/WebAssembly/assembler-binary.ll
llvm/test/MC/WebAssembly/stack-ptr-mclower.ll