diff options
author | Andy Wingo <wingo@igalia.com> | 2021-03-23 16:13:54 +0100 |
---|---|---|
committer | Andy Wingo <wingo@igalia.com> | 2021-03-24 09:44:22 +0100 |
commit | c9801db2eb4b273ccf4b793784911b4465366f68 (patch) | |
tree | f76974f1b7c2fe07a0c25c382c24c9221ec12ce6 /llvm/lib/MC/WasmObjectWriter.cpp | |
parent | d905c1035395fb27a5599f3da20ade6874718549 (diff) | |
download | llvm-c9801db2eb4b273ccf4b793784911b4465366f68.zip llvm-c9801db2eb4b273ccf4b793784911b4465366f68.tar.gz llvm-c9801db2eb4b273ccf4b793784911b4465366f68.tar.bz2 |
[WebAssembly][MC] Record limit constraints for table sizes
This commit adds a full WasmTableType to MCSymbolWasm, differing from
the current situation (just an ElemType) in that it additionally records
a WasmLimits.
We add support for specifying the limits in .S files also, via the
following syntax variations:
.tabletype SYM, ELEMTYPE
.tabletype SYM, ELEMTYPE, MINSIZE
.tabletype SYM, ELEMTYPE, MINSIZE, MAXSIZE
Depends on D99186.
Differential Revision: https://reviews.llvm.org/D99191
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index 2a679ca..0eda8b5 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -1338,12 +1338,7 @@ void WasmObjectWriter::prepareImports( Import.Module = WS.getImportModule(); Import.Field = WS.getImportName(); Import.Kind = wasm::WASM_EXTERNAL_TABLE; - wasm::ValType ElemType = WS.getTableType(); - Import.Table.ElemType = uint8_t(ElemType); - // FIXME: Extend table type to include limits? For now we don't specify - // a min or max which does not place any restrictions on the size of the - // imported table. - Import.Table.Limits = {wasm::WASM_LIMITS_FLAG_NONE, 0, 0}; + Import.Table = WS.getTableType(); Imports.push_back(Import); assert(WasmIndices.count(&WS) == 0); WasmIndices[&WS] = NumTableImports++; @@ -1626,9 +1621,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm, if (WS.isDefined()) { wasm::WasmTable Table; Table.Index = NumTableImports + Tables.size(); - Table.Type.ElemType = static_cast<uint8_t>(WS.getTableType()); - // FIXME: Work on custom limits is ongoing - Table.Type.Limits = {wasm::WASM_LIMITS_FLAG_NONE, 0, 0}; + Table.Type = WS.getTableType(); assert(WasmIndices.count(&WS) == 0); WasmIndices[&WS] = Table.Index; Tables.push_back(Table); |