[all-commits] [llvm/llvm-project] 3ec176: [WebAssembly] Remove WasmTagType

Heejin Ahn via All-commits all-commits at lists.llvm.org
Tue Oct 5 17:11:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ec1760d91a38e30d9535c313e4231e332910dd3
      https://github.com/llvm/llvm-project/commit/3ec1760d91a38e30d9535c313e4231e332910dd3
  Author: Heejin Ahn <aheejin at gmail.com>
  Date:   2021-10-05 (Tue, 05 Oct 2021)

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

  Log Message:
  -----------
  [WebAssembly] Remove WasmTagType

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. This instead moves `SigIndex` to
`struct WasmTag` itself, as we did for `struct WasmFunction` in D111104.

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.

Reviewed By: sbc100, tlively

Differential Revision: https://reviews.llvm.org/D111086




More information about the All-commits mailing list