[PATCH] D111086: [WebAssembly] Remove WasmTagType

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 11:52:31 PDT 2021


aheejin created this revision.
aheejin added reviewers: sbc100, tlively.
Herald added subscribers: wingo, ecnelises, mikhail.ramalho, sunfish, hiraditya, jgravelle-google, dschuff.
Herald added a reviewer: MaskRay.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This removes `WasmTagType`. `WasmTagType` contained an attribute and a
signature index:

  struct WasmTagType {
    uint8_t Attribute;
    uint32_t SigIndex;
  };

Currently the attribute field is not used and reserved for future use,
and always 0. And that this class contains `SigIndex` as its property is
a little weird in the place, because the tag type's signature index is
not an inherent property of a tag but rather a reference to another
section that changes after linking. This makes tag handling in the
linker also weird that tag-related methods are taking both `WasmTagType`
and `WasmSignature` even though `WasmTagType` contains a signature
index. This is because the signature index changes in linking so it
doesn't have any info at this point.

In this CL, in lib/MC and lib/Object, this now treats tag types in the
same way as function types. Also in YAML, this removes `struct Tag`,
because now it only contains the tag index. Also tags set `SigIndex` in
`WasmImport` union, as functions do.

I think this makes things simpler and makes tag handling more in line
with function handling. These two shares similar properties in that both
of them have signatures, but they are kind of nominal so having the same
signature doesn't mean they are the same element.

Also a drive-by fix: the reserved 'attirubute' part's encoding changed
from uleb32 to uint8 a while ago. This was fixed in lib/MC and
lib/Object but not in YAML. This doesn't change object files because the
field's value is always 0 and its encoding is the same for the both
encoding.

This is effectively NFC; I didn't mark it as such just because it
changed YAML test results.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111086

Files:
  lld/include/lld/Common/LLVM.h
  lld/test/wasm/tag-section.ll
  lld/wasm/InputElement.h
  lld/wasm/InputFiles.cpp
  lld/wasm/SymbolTable.cpp
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/WriterUtils.cpp
  lld/wasm/WriterUtils.h
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/tag-section.ll
  llvm/test/ObjectYAML/wasm/event_section.yaml
  llvm/tools/obj2yaml/wasm2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111086.376971.patch
Type: text/x-patch
Size: 26791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/16bd1b75/attachment.bin>


More information about the llvm-commits mailing list