[llvm] 4dc46a1 - Revert "[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType"
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 21:07:55 PDT 2022
Author: Alex Bradbury
Date: 2022-07-06T05:07:22+01:00
New Revision: 4dc46a174bf702883925cac905c4dca5d7bf58f0
URL: https://github.com/llvm/llvm-project/commit/4dc46a174bf702883925cac905c4dca5d7bf58f0
DIFF: https://github.com/llvm/llvm-project/commit/4dc46a174bf702883925cac905c4dca5d7bf58f0.diff
LOG: Revert "[WebAssembly][NFC] Refactor table handling in WebAssembly::wasmSymbolSetType"
This reverts commit 8ccc7e0aa461350bce02d70669c11f4a5e300ee7.
Wrong version of the patch was pushed.
Added:
Modified:
llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
index e087c7bd52b3c..0f1655718481a 100644
--- a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
+++ b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
@@ -179,14 +179,19 @@ void WebAssembly::wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
bool IsTable = false;
if (GlobalVT->isArrayTy() &&
WebAssembly::isRefType(GlobalVT->getArrayElementType())) {
+ MVT VT;
IsTable = true;
- const Type *ElTy = GlobalVT->getArrayElementType();
- if (WebAssembly::isExternRefType(ElTy))
- Type = wasm::ValType::EXTERNREF;
- else if (WebAssembly::isFuncRefType(ElTy))
- Type = wasm::ValType::FUNCREF;
- else
- report_fatal_error("unhandled reference type");
+ switch (GlobalVT->getArrayElementType()->getPointerAddressSpace()) {
+ case WebAssembly::WasmAddressSpace::WASM_ADDRESS_SPACE_FUNCREF:
+ VT = MVT::funcref;
+ break;
+ case WebAssembly::WasmAddressSpace::WASM_ADDRESS_SPACE_EXTERNREF:
+ VT = MVT::externref;
+ break;
+ default:
+ report_fatal_error("unhandled address space type");
+ }
+ Type = WebAssembly::toValType(VT);
} else if (VTs.size() == 1) {
Type = WebAssembly::toValType(VTs[0]);
} else
More information about the llvm-commits
mailing list