Revert "[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType"

This reverts commit 8ccc7e0aa4.

Wrong version of the patch was pushed.
This commit is contained in:
Alex Bradbury 2022-07-06 05:07:22 +01:00
parent 8ccc7e0aa4
commit 4dc46a174b
1 changed files with 12 additions and 7 deletions

View File

@ -179,14 +179,19 @@ void WebAssembly::wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
bool IsTable = false; bool IsTable = false;
if (GlobalVT->isArrayTy() && if (GlobalVT->isArrayTy() &&
WebAssembly::isRefType(GlobalVT->getArrayElementType())) { WebAssembly::isRefType(GlobalVT->getArrayElementType())) {
MVT VT;
IsTable = true; IsTable = true;
const Type *ElTy = GlobalVT->getArrayElementType(); switch (GlobalVT->getArrayElementType()->getPointerAddressSpace()) {
if (WebAssembly::isExternRefType(ElTy)) case WebAssembly::WasmAddressSpace::WASM_ADDRESS_SPACE_FUNCREF:
Type = wasm::ValType::EXTERNREF; VT = MVT::funcref;
else if (WebAssembly::isFuncRefType(ElTy)) break;
Type = wasm::ValType::FUNCREF; case WebAssembly::WasmAddressSpace::WASM_ADDRESS_SPACE_EXTERNREF:
else VT = MVT::externref;
report_fatal_error("unhandled reference type"); break;
default:
report_fatal_error("unhandled address space type");
}
Type = WebAssembly::toValType(VT);
} else if (VTs.size() == 1) { } else if (VTs.size() == 1) {
Type = WebAssembly::toValType(VTs[0]); Type = WebAssembly::toValType(VTs[0]);
} else } else