[PATCH] D104571: [WebAssembly] Make tag attribute's encoding uint8

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 21:23:13 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1c7b84108861: [WebAssembly] Make tag attribute's encoding uint8 (authored by aheejin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104571/new/

https://reviews.llvm.org/D104571

Files:
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp


Index: llvm/lib/Object/WasmObjectFile.cpp
===================================================================
--- llvm/lib/Object/WasmObjectFile.cpp
+++ llvm/lib/Object/WasmObjectFile.cpp
@@ -1066,7 +1066,7 @@
     }
     case wasm::WASM_EXTERNAL_TAG:
       NumImportedTags++;
-      Im.Tag.Attribute = readVarint32(Ctx);
+      Im.Tag.Attribute = readUint8(Ctx);
       Im.Tag.SigIndex = readVarint32(Ctx);
       break;
     default:
@@ -1143,7 +1143,7 @@
   while (Count--) {
     wasm::WasmTag Tag;
     Tag.Index = NumImportedTags + Tags.size();
-    Tag.Type.Attribute = readVaruint32(Ctx);
+    Tag.Type.Attribute = readUint8(Ctx);
     Tag.Type.SigIndex = readVaruint32(Ctx);
     Tags.push_back(Tag);
   }
Index: llvm/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/lib/MC/WasmObjectWriter.cpp
+++ llvm/lib/MC/WasmObjectWriter.cpp
@@ -814,7 +814,7 @@
       encodeULEB128(NumElements, W->OS); // initial
       break;
     case wasm::WASM_EXTERNAL_TAG:
-      encodeULEB128(Import.Tag.Attribute, W->OS);
+      W->OS << char(Import.Tag.Attribute);
       encodeULEB128(Import.Tag.SigIndex, W->OS);
       break;
     default:
@@ -848,7 +848,7 @@
 
   encodeULEB128(Tags.size(), W->OS);
   for (const wasm::WasmTagType &Tag : Tags) {
-    encodeULEB128(Tag.Attribute, W->OS);
+    W->OS << char(Tag.Attribute);
     encodeULEB128(Tag.SigIndex, W->OS);
   }
 
Index: llvm/include/llvm/BinaryFormat/Wasm.h
===================================================================
--- llvm/include/llvm/BinaryFormat/Wasm.h
+++ llvm/include/llvm/BinaryFormat/Wasm.h
@@ -103,7 +103,7 @@
 
 struct WasmTagType {
   // Kind of tag. Currently only WASM_TAG_ATTRIBUTE_EXCEPTION is possible.
-  uint32_t Attribute;
+  uint8_t Attribute;
   uint32_t SigIndex;
 };
 
@@ -363,7 +363,7 @@
 };
 
 // Kinds of tag attributes.
-enum WasmTagAttribute : unsigned {
+enum WasmTagAttribute : uint8_t {
   WASM_TAG_ATTRIBUTE_EXCEPTION = 0x0,
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104571.353547.patch
Type: text/x-patch
Size: 1986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210622/ce0fc4ee/attachment.bin>


More information about the llvm-commits mailing list