From 50428fb5e90b8318148abdf67eefe99bf8fd310b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 8 Apr 2025 19:44:40 -0700 Subject: [WebAssembly] Add WebAssembly::Specifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move wasm-specific members outside of MCSymbolRefExpr::VariantKind (a legacy interface I am eliminating). Most changes are mechanic and similar to what I've done for many ELF targets (e.g. X86 #132149) Notes: * `fixSymbolsInTLSFixups` is replaced with `setTLS` in `WebAssemblyWasmObjectWriter::getRelocType`, similar to what I've done for many ELF targets. * `SymA->setUsedInGOT()` in `recordRelocation` is moved to `getRelocType`. While here, rename "Modifier' to "Specifier": > "Relocation modifier", though concise, suggests adjustments happen during the linker's relocation step rather than the assembler's expression evaluation. I landed on "relocation specifier" as the winner. It's clear, aligns with Arm and IBM’s usage, and fits the assembler's role seamlessly. Pull Request: https://github.com/llvm/llvm-project/pull/133116 --- llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp') diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp index 8d4d271..7bee4af 100644 --- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp +++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp @@ -14,6 +14,7 @@ /// //===----------------------------------------------------------------------===// +#include "MCTargetDesc/WebAssemblyMCExpr.h" #include "MCTargetDesc/WebAssemblyMCTypeUtilities.h" #include "TargetInfo/WebAssemblyTargetInfo.h" #include "llvm/BinaryFormat/Wasm.h" @@ -238,7 +239,7 @@ MCDisassembler::DecodeStatus WebAssemblyDisassembler::getInstruction( auto *WasmSym = cast(Sym); WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION); const MCExpr *Expr = MCSymbolRefExpr::create( - WasmSym, MCSymbolRefExpr::VK_WASM_TYPEINDEX, getContext()); + WasmSym, WebAssembly::S_TYPEINDEX, getContext()); MI.addOperand(MCOperand::createExpr(Expr)); } break; -- cgit v1.1