diff options
author | Fangrui Song <i@maskray.me> | 2025-04-08 19:44:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-08 19:44:40 -0700 |
commit | 50428fb5e90b8318148abdf67eefe99bf8fd310b (patch) | |
tree | cb0d95bc0c46822a4082c2d145dc5913f7081e1d /llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp | |
parent | a1f1bbf0534f57990c13a0bf0e6645da011f1d9d (diff) | |
download | llvm-50428fb5e90b8318148abdf67eefe99bf8fd310b.zip llvm-50428fb5e90b8318148abdf67eefe99bf8fd310b.tar.gz llvm-50428fb5e90b8318148abdf67eefe99bf8fd310b.tar.bz2 |
[WebAssembly] Add WebAssembly::Specifier
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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp index 7f35121..7ee6a3d8 100644 --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #include "AsmParser/WebAssemblyAsmTypeCheck.h" +#include "MCTargetDesc/WebAssemblyMCExpr.h" #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" #include "MCTargetDesc/WebAssemblyMCTypeUtilities.h" #include "MCTargetDesc/WebAssemblyTargetStreamer.h" @@ -700,8 +701,8 @@ public: auto *WasmSym = cast<MCSymbolWasm>(Sym); WasmSym->setSignature(Signature); WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION); - const MCExpr *Expr = MCSymbolRefExpr::create( - WasmSym, MCSymbolRefExpr::VK_WASM_TYPEINDEX, Ctx); + const MCExpr *Expr = + MCSymbolRefExpr::create(WasmSym, WebAssembly::S_TYPEINDEX, Ctx); Operands.push_back(std::make_unique<WebAssemblyOperand>( Loc.getLoc(), Loc.getEndLoc(), WebAssemblyOperand::SymOp{Expr})); } |