[llvm] 1d891d4 - [WebAssembly] Rename event to tag

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 20:34:51 PDT 2021


Author: Heejin Ahn
Date: 2021-06-17T20:34:19-07:00
New Revision: 1d891d44f33f99c55e779acaeac4628e4ac9aaaf

URL: https://github.com/llvm/llvm-project/commit/1d891d44f33f99c55e779acaeac4628e4ac9aaaf
DIFF: https://github.com/llvm/llvm-project/commit/1d891d44f33f99c55e779acaeac4628e4ac9aaaf.diff

LOG: [WebAssembly] Rename event to tag

We recently decided to change 'event' to 'tag', and 'event section' to
'tag section', out of the rationale that the section contains a
generalized tag that references a type, which may be used for something
other than exceptions, and the name 'event' can be confusing in the web
context.

See
- https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130
- https://github.com/WebAssembly/exception-handling/pull/161

Reviewed By: tlively

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

Added: 
    lld/test/wasm/Inputs/tag-section1.ll
    lld/test/wasm/Inputs/tag-section2.ll
    lld/test/wasm/tag-section.ll
    llvm/test/MC/WebAssembly/tag-section-decoding.ll
    llvm/test/MC/WebAssembly/tag-section.ll

Modified: 
    lld/include/lld/Common/LLVM.h
    lld/wasm/InputChunks.cpp
    lld/wasm/InputElement.h
    lld/wasm/InputFiles.cpp
    lld/wasm/InputFiles.h
    lld/wasm/MarkLive.cpp
    lld/wasm/OutputSections.cpp
    lld/wasm/SymbolTable.cpp
    lld/wasm/SymbolTable.h
    lld/wasm/Symbols.cpp
    lld/wasm/Symbols.h
    lld/wasm/SyntheticSections.cpp
    lld/wasm/SyntheticSections.h
    lld/wasm/Writer.cpp
    lld/wasm/WriterUtils.cpp
    lld/wasm/WriterUtils.h
    lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    llvm/include/llvm/BinaryFormat/Wasm.h
    llvm/include/llvm/BinaryFormat/WasmRelocs.def
    llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
    llvm/include/llvm/MC/MCSymbolWasm.h
    llvm/include/llvm/Object/Wasm.h
    llvm/include/llvm/ObjectYAML/WasmYAML.h
    llvm/lib/BinaryFormat/Wasm.cpp
    llvm/lib/MC/WasmObjectWriter.cpp
    llvm/lib/Object/RelocationResolver.cpp
    llvm/lib/Object/WasmObjectFile.cpp
    llvm/lib/ObjectYAML/WasmEmitter.cpp
    llvm/lib/ObjectYAML/WasmYAML.cpp
    llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
    llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
    llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
    llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
    llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
    llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
    llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
    llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
    llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
    llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
    llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
    llvm/test/CodeGen/WebAssembly/exception.ll
    llvm/test/CodeGen/WebAssembly/null-streamer.ll
    llvm/test/MC/WebAssembly/annotations.s
    llvm/test/MC/WebAssembly/basic-assembly.s
    llvm/test/ObjectYAML/wasm/event_section.yaml
    llvm/tools/llvm-readobj/WasmDumper.cpp
    llvm/tools/obj2yaml/wasm2yaml.cpp

Removed: 
    lld/test/wasm/Inputs/event-section1.ll
    lld/test/wasm/Inputs/event-section2.ll
    lld/test/wasm/event-section.ll
    llvm/test/MC/WebAssembly/event-section-decoding.ll
    llvm/test/MC/WebAssembly/event-section.ll


################################################################################
diff  --git a/lld/include/lld/Common/LLVM.h b/lld/include/lld/Common/LLVM.h
index 2328521246b48..c19364ad9f6ce 100644
--- a/lld/include/lld/Common/LLVM.h
+++ b/lld/include/lld/Common/LLVM.h
@@ -44,8 +44,8 @@ class WasmSymbol;
 } // namespace object
 
 namespace wasm {
-struct WasmEvent;
-struct WasmEventType;
+struct WasmTag;
+struct WasmTagType;
 struct WasmFunction;
 struct WasmGlobal;
 struct WasmGlobalType;
@@ -87,8 +87,6 @@ using llvm::object::WasmObjectFile;
 using llvm::object::WasmSection;
 using llvm::object::WasmSegment;
 using llvm::object::WasmSymbol;
-using llvm::wasm::WasmEvent;
-using llvm::wasm::WasmEventType;
 using llvm::wasm::WasmFunction;
 using llvm::wasm::WasmGlobal;
 using llvm::wasm::WasmGlobalType;
@@ -98,6 +96,8 @@ using llvm::wasm::WasmRelocation;
 using llvm::wasm::WasmSignature;
 using llvm::wasm::WasmTable;
 using llvm::wasm::WasmTableType;
+using llvm::wasm::WasmTag;
+using llvm::wasm::WasmTagType;
 } // end namespace lld.
 
 namespace std {

diff  --git a/lld/test/wasm/Inputs/event-section1.ll b/lld/test/wasm/Inputs/tag-section1.ll
similarity index 100%
rename from lld/test/wasm/Inputs/event-section1.ll
rename to lld/test/wasm/Inputs/tag-section1.ll

diff  --git a/lld/test/wasm/Inputs/event-section2.ll b/lld/test/wasm/Inputs/tag-section2.ll
similarity index 100%
rename from lld/test/wasm/Inputs/event-section2.ll
rename to lld/test/wasm/Inputs/tag-section2.ll

diff  --git a/lld/test/wasm/event-section.ll b/lld/test/wasm/tag-section.ll
similarity index 84%
rename from lld/test/wasm/event-section.ll
rename to lld/test/wasm/tag-section.ll
index 15ef6366efee1..fd01a3919985e 100644
--- a/lld/test/wasm/event-section.ll
+++ b/lld/test/wasm/tag-section.ll
@@ -1,5 +1,5 @@
-; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/event-section1.ll -o %t1.o
-; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/event-section2.ll -o %t2.o
+; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section1.ll -o %t1.o
+; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section2.ll -o %t2.o
 ; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o %t.o
 ; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o
 ; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o
@@ -29,17 +29,17 @@ define void @_start() {
 ; CHECK-NEXT:           - I32
 ; CHECK-NEXT:         ReturnTypes:     []
 
-; CHECK:        - Type:            EVENT
-; CHECK-NEXT:     Events:
+; CHECK:        - Type:            TAG
+; CHECK-NEXT:     Tags:
 ; CHECK-NEXT:       - Index:           0
 ; CHECK-NEXT:         Attribute:       0
 ; CHECK-NEXT:         SigIndex:        1
 
-; Global section has to come after event section
+; Global section has to come after tag section
 ; CHECK:        - Type:            GLOBAL
 
 ; EXPORT-ALL:   - Type:            EXPORT
 ; EXPORT-ALL-NEXT Exports:
 ; EXPORT-ALL:       - Name:            __cpp_exception
-; EXPORT-ALL:         Kind:            EVENT
+; EXPORT-ALL:         Kind:            TAG
 ; EXPORT-ALL:         Index:           0

diff  --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 4bf7b5b3f4ac8..6912fcda0ba3f 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -117,7 +117,7 @@ void InputChunk::relocate(uint8_t *buf) const {
     case R_WASM_TYPE_INDEX_LEB:
     case R_WASM_FUNCTION_INDEX_LEB:
     case R_WASM_GLOBAL_INDEX_LEB:
-    case R_WASM_EVENT_INDEX_LEB:
+    case R_WASM_TAG_INDEX_LEB:
     case R_WASM_MEMORY_ADDR_LEB:
     case R_WASM_TABLE_NUMBER_LEB:
       encodeULEB128(value, loc, 5);
@@ -208,7 +208,7 @@ static unsigned writeCompressedReloc(uint8_t *buf, const WasmRelocation &rel,
   case R_WASM_TYPE_INDEX_LEB:
   case R_WASM_FUNCTION_INDEX_LEB:
   case R_WASM_GLOBAL_INDEX_LEB:
-  case R_WASM_EVENT_INDEX_LEB:
+  case R_WASM_TAG_INDEX_LEB:
   case R_WASM_MEMORY_ADDR_LEB:
   case R_WASM_MEMORY_ADDR_LEB64:
   case R_WASM_TABLE_NUMBER_LEB:
@@ -228,7 +228,7 @@ static unsigned getRelocWidthPadded(const WasmRelocation &rel) {
   case R_WASM_TYPE_INDEX_LEB:
   case R_WASM_FUNCTION_INDEX_LEB:
   case R_WASM_GLOBAL_INDEX_LEB:
-  case R_WASM_EVENT_INDEX_LEB:
+  case R_WASM_TAG_INDEX_LEB:
   case R_WASM_MEMORY_ADDR_LEB:
   case R_WASM_TABLE_NUMBER_LEB:
   case R_WASM_TABLE_INDEX_SLEB:

diff  --git a/lld/wasm/InputElement.h b/lld/wasm/InputElement.h
index f39a1727047f4..d00e60b4ae96b 100644
--- a/lld/wasm/InputElement.h
+++ b/lld/wasm/InputElement.h
@@ -18,7 +18,7 @@
 namespace lld {
 namespace wasm {
 
-// Represents a single element (Global, Event, Table, etc) within an input
+// Represents a single element (Global, Tag, Table, etc) within an input
 // file.
 class InputElement {
 protected:
@@ -71,17 +71,17 @@ class InputGlobal : public InputElement {
   WasmInitExpr initExpr;
 };
 
-class InputEvent : public InputElement {
+class InputTag : public InputElement {
 public:
-  InputEvent(const WasmSignature &s, const WasmEvent &e, ObjFile *f)
-      : InputElement(e.SymbolName, f), signature(s), type(e.Type) {}
+  InputTag(const WasmSignature &s, const WasmTag &t, ObjFile *f)
+      : InputElement(t.SymbolName, f), signature(s), type(t.Type) {}
 
-  const WasmEventType &getType() const { return type; }
+  const WasmTagType &getType() const { return type; }
 
   const WasmSignature &signature;
 
 private:
-  WasmEventType type;
+  WasmTagType type;
 };
 
 class InputTable : public InputElement {

diff  --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index 4688590415055..f9e279501b700 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -93,7 +93,7 @@ void ObjFile::dumpInfo() const {
       "\n              Symbols : " + Twine(symbols.size()) +
       "\n     Function Imports : " + Twine(wasmObj->getNumImportedFunctions()) +
       "\n       Global Imports : " + Twine(wasmObj->getNumImportedGlobals()) +
-      "\n        Event Imports : " + Twine(wasmObj->getNumImportedEvents()) +
+      "\n          Tag Imports : " + Twine(wasmObj->getNumImportedTags()) +
       "\n        Table Imports : " + Twine(wasmObj->getNumImportedTables()));
 }
 
@@ -209,8 +209,8 @@ uint64_t ObjFile::calcNewValue(const WasmRelocation &reloc, uint64_t tombstone,
     if (auto gs = dyn_cast<GlobalSymbol>(sym))
       return gs->getGlobalIndex();
     return sym->getGOTIndex();
-  case R_WASM_EVENT_INDEX_LEB:
-    return getEventSymbol(reloc.Index)->getEventIndex();
+  case R_WASM_TAG_INDEX_LEB:
+    return getTagSymbol(reloc.Index)->getTagIndex();
   case R_WASM_FUNCTION_OFFSET_I32:
   case R_WASM_FUNCTION_OFFSET_I64: {
     auto *f = cast<DefinedFunction>(sym);
@@ -343,10 +343,10 @@ void ObjFile::addLegacyIndirectFunctionTableIfNeeded(
   LLVM_DEBUG(dbgs() << "Synthesizing symbol for table import: " << info->Name
                     << "\n");
   const WasmGlobalType *globalType = nullptr;
-  const WasmEventType *eventType = nullptr;
+  const WasmTagType *tagType = nullptr;
   const WasmSignature *signature = nullptr;
   auto *wasmSym = make<WasmSymbol>(*info, globalType, &tableImport->Table,
-                                   eventType, signature);
+                                   tagType, signature);
   Symbol *sym = createUndefined(*wasmSym, false);
   // We're only sure it's a TableSymbol if the createUndefined succeeded.
   if (errorCount())
@@ -515,9 +515,9 @@ void ObjFile::parse(bool ignoreComdats) {
   for (const WasmGlobal &g : wasmObj->globals())
     globals.emplace_back(make<InputGlobal>(g, this));
 
-  // Populate `Events`.
-  for (const WasmEvent &e : wasmObj->events())
-    events.emplace_back(make<InputEvent>(types[e.Type.SigIndex], e, this));
+  // Populate `Tags`.
+  for (const WasmTag &t : wasmObj->tags())
+    tags.emplace_back(make<InputTag>(types[t.Type.SigIndex], t, this));
 
   // Populate `Symbols` based on the symbols in the object.
   symbols.reserve(wasmObj->getNumberOfSymbols());
@@ -556,8 +556,8 @@ GlobalSymbol *ObjFile::getGlobalSymbol(uint32_t index) const {
   return cast<GlobalSymbol>(symbols[index]);
 }
 
-EventSymbol *ObjFile::getEventSymbol(uint32_t index) const {
-  return cast<EventSymbol>(symbols[index]);
+TagSymbol *ObjFile::getTagSymbol(uint32_t index) const {
+  return cast<TagSymbol>(symbols[index]);
 }
 
 TableSymbol *ObjFile::getTableSymbol(uint32_t index) const {
@@ -612,12 +612,11 @@ Symbol *ObjFile::createDefined(const WasmSymbol &sym) {
       return nullptr;
     return make<SectionSymbol>(flags, section, this);
   }
-  case WASM_SYMBOL_TYPE_EVENT: {
-    InputEvent *event =
-        events[sym.Info.ElementIndex - wasmObj->getNumImportedEvents()];
+  case WASM_SYMBOL_TYPE_TAG: {
+    InputTag *tag = tags[sym.Info.ElementIndex - wasmObj->getNumImportedTags()];
     if (sym.isBindingLocal())
-      return make<DefinedEvent>(name, flags, this, event);
-    return symtab->addDefinedEvent(name, flags, this, event);
+      return make<DefinedTag>(name, flags, this, tag);
+    return symtab->addDefinedTag(name, flags, this, tag);
   }
   case WASM_SYMBOL_TYPE_TABLE: {
     InputTable *table =

diff  --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h
index 49337bd0eb33f..f4ff8bbb1d159 100644
--- a/lld/wasm/InputFiles.h
+++ b/lld/wasm/InputFiles.h
@@ -31,7 +31,7 @@ class InputChunk;
 class InputFunction;
 class InputSegment;
 class InputGlobal;
-class InputEvent;
+class InputTag;
 class InputTable;
 class InputSection;
 
@@ -139,7 +139,7 @@ class ObjFile : public InputFile {
   std::vector<InputChunk *> segments;
   std::vector<InputFunction *> functions;
   std::vector<InputGlobal *> globals;
-  std::vector<InputEvent *> events;
+  std::vector<InputTag *> tags;
   std::vector<InputTable *> tables;
   std::vector<InputChunk *> customSections;
   llvm::DenseMap<uint32_t, InputChunk *> customSectionsByIndex;
@@ -149,7 +149,7 @@ class ObjFile : public InputFile {
   DataSymbol *getDataSymbol(uint32_t index) const;
   GlobalSymbol *getGlobalSymbol(uint32_t index) const;
   SectionSymbol *getSectionSymbol(uint32_t index) const;
-  EventSymbol *getEventSymbol(uint32_t index) const;
+  TagSymbol *getTagSymbol(uint32_t index) const;
   TableSymbol *getTableSymbol(uint32_t index) const;
 
 private:

diff  --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index 2f82d1aa6a905..3e5d234eeccc0 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -162,9 +162,9 @@ void markLive() {
       for (InputGlobal *g : obj->globals)
         if (!g->live)
           message("removing unused section " + toString(g));
-      for (InputEvent *e : obj->events)
-        if (!e->live)
-          message("removing unused section " + toString(e));
+      for (InputTag *t : obj->tags)
+        if (!t->live)
+          message("removing unused section " + toString(t));
       for (InputTable *t : obj->tables)
         if (!t->live)
           message("removing unused section " + toString(t));

diff  --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp
index 44e6cdcaf68cb..85994ea5f839e 100644
--- a/lld/wasm/OutputSections.cpp
+++ b/lld/wasm/OutputSections.cpp
@@ -49,8 +49,8 @@ static StringRef sectionTypeToString(uint32_t sectionType) {
     return "MEMORY";
   case WASM_SEC_GLOBAL:
     return "GLOBAL";
-  case WASM_SEC_EVENT:
-    return "EVENT";
+  case WASM_SEC_TAG:
+    return "TAG";
   case WASM_SEC_EXPORT:
     return "EXPORT";
   case WASM_SEC_START:

diff  --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 7e794a1bd4318..1a5213347ba3d 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -168,23 +168,23 @@ static void checkGlobalType(const Symbol *existing, const InputFile *file,
   }
 }
 
-static void checkEventType(const Symbol *existing, const InputFile *file,
-                           const WasmEventType *newType,
-                           const WasmSignature *newSig) {
-  auto existingEvent = dyn_cast<EventSymbol>(existing);
-  if (!isa<EventSymbol>(existing)) {
-    reportTypeError(existing, file, WASM_SYMBOL_TYPE_EVENT);
+static void checkTagType(const Symbol *existing, const InputFile *file,
+                         const WasmTagType *newType,
+                         const WasmSignature *newSig) {
+  const auto *existingTag = dyn_cast<TagSymbol>(existing);
+  if (!isa<TagSymbol>(existing)) {
+    reportTypeError(existing, file, WASM_SYMBOL_TYPE_TAG);
     return;
   }
 
-  const WasmEventType *oldType = cast<EventSymbol>(existing)->getEventType();
-  const WasmSignature *oldSig = existingEvent->signature;
+  const WasmTagType *oldType = cast<TagSymbol>(existing)->getTagType();
+  const WasmSignature *oldSig = existingTag->signature;
   if (newType->Attribute != oldType->Attribute)
-    error("Event type mismatch: " + existing->getName() + "\n>>> defined as " +
+    error("Tag type mismatch: " + existing->getName() + "\n>>> defined as " +
           toString(*oldType) + " in " + toString(existing->getFile()) +
           "\n>>> defined as " + toString(*newType) + " in " + toString(file));
   if (*newSig != *oldSig)
-    warn("Event signature mismatch: " + existing->getName() +
+    warn("Tag signature mismatch: " + existing->getName() +
          "\n>>> defined as " + toString(*oldSig) + " in " +
          toString(existing->getFile()) + "\n>>> defined as " +
          toString(*newSig) + " in " + toString(file));
@@ -413,16 +413,16 @@ Symbol *SymbolTable::addDefinedGlobal(StringRef name, uint32_t flags,
   return s;
 }
 
-Symbol *SymbolTable::addDefinedEvent(StringRef name, uint32_t flags,
-                                     InputFile *file, InputEvent *event) {
-  LLVM_DEBUG(dbgs() << "addDefinedEvent:" << name << "\n");
+Symbol *SymbolTable::addDefinedTag(StringRef name, uint32_t flags,
+                                   InputFile *file, InputTag *tag) {
+  LLVM_DEBUG(dbgs() << "addDefinedTag:" << name << "\n");
 
   Symbol *s;
   bool wasInserted;
   std::tie(s, wasInserted) = insert(name, file);
 
   auto replaceSym = [&]() {
-    replaceSymbol<DefinedEvent>(s, name, flags, file, event);
+    replaceSymbol<DefinedTag>(s, name, flags, file, tag);
   };
 
   if (wasInserted || s->isLazy()) {
@@ -430,7 +430,7 @@ Symbol *SymbolTable::addDefinedEvent(StringRef name, uint32_t flags,
     return s;
   }
 
-  checkEventType(s, file, &event->getType(), &event->signature);
+  checkTagType(s, file, &tag->getType(), &tag->signature);
 
   if (shouldReplace(s, file, flags))
     replaceSym();

diff  --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h
index bee18ce9c6bde..aea2f164928a5 100644
--- a/lld/wasm/SymbolTable.h
+++ b/lld/wasm/SymbolTable.h
@@ -57,8 +57,8 @@ class SymbolTable {
                          InputChunk *segment, uint64_t address, uint64_t size);
   Symbol *addDefinedGlobal(StringRef name, uint32_t flags, InputFile *file,
                            InputGlobal *g);
-  Symbol *addDefinedEvent(StringRef name, uint32_t flags, InputFile *file,
-                          InputEvent *e);
+  Symbol *addDefinedTag(StringRef name, uint32_t flags, InputFile *file,
+                        InputTag *t);
   Symbol *addDefinedTable(StringRef name, uint32_t flags, InputFile *file,
                           InputTable *t);
 

diff  --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index c18510ca5fce4..37a26b3a1dc86 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -48,8 +48,8 @@ std::string toString(wasm::Symbol::Kind kind) {
     return "DefinedGlobal";
   case wasm::Symbol::DefinedTableKind:
     return "DefinedTable";
-  case wasm::Symbol::DefinedEventKind:
-    return "DefinedEvent";
+  case wasm::Symbol::DefinedTagKind:
+    return "DefinedTag";
   case wasm::Symbol::UndefinedFunctionKind:
     return "UndefinedFunction";
   case wasm::Symbol::UndefinedDataKind:
@@ -100,8 +100,8 @@ WasmSymbolType Symbol::getWasmType() const {
     return WASM_SYMBOL_TYPE_DATA;
   if (isa<GlobalSymbol>(this))
     return WASM_SYMBOL_TYPE_GLOBAL;
-  if (isa<EventSymbol>(this))
-    return WASM_SYMBOL_TYPE_EVENT;
+  if (isa<TagSymbol>(this))
+    return WASM_SYMBOL_TYPE_TAG;
   if (isa<TableSymbol>(this))
     return WASM_SYMBOL_TYPE_TABLE;
   if (isa<SectionSymbol>(this) || isa<OutputSectionSymbol>(this))
@@ -137,8 +137,8 @@ bool Symbol::isDiscarded() const {
 bool Symbol::isLive() const {
   if (auto *g = dyn_cast<DefinedGlobal>(this))
     return g->global->live;
-  if (auto *e = dyn_cast<DefinedEvent>(this))
-    return e->event->live;
+  if (auto *t = dyn_cast<DefinedTag>(this))
+    return t->tag->live;
   if (auto *t = dyn_cast<DefinedTable>(this))
     return t->table->live;
   if (InputChunk *c = getChunk())
@@ -153,8 +153,8 @@ void Symbol::markLive() {
     file->markLive();
   if (auto *g = dyn_cast<DefinedGlobal>(this))
     g->global->live = true;
-  if (auto *e = dyn_cast<DefinedEvent>(this))
-    e->event->live = true;
+  if (auto *t = dyn_cast<DefinedTag>(this))
+    t->tag->live = true;
   if (auto *t = dyn_cast<DefinedTable>(this))
     t->table->live = true;
   if (InputChunk *c = getChunk()) {
@@ -336,31 +336,31 @@ DefinedGlobal::DefinedGlobal(StringRef name, uint32_t flags, InputFile *file,
                    global ? &global->getType() : nullptr),
       global(global) {}
 
-uint32_t EventSymbol::getEventIndex() const {
-  if (auto *f = dyn_cast<DefinedEvent>(this))
-    return f->event->getAssignedIndex();
-  assert(eventIndex != INVALID_INDEX);
-  return eventIndex;
+uint32_t TagSymbol::getTagIndex() const {
+  if (auto *f = dyn_cast<DefinedTag>(this))
+    return f->tag->getAssignedIndex();
+  assert(tagIndex != INVALID_INDEX);
+  return tagIndex;
 }
 
-void EventSymbol::setEventIndex(uint32_t index) {
-  LLVM_DEBUG(dbgs() << "setEventIndex " << name << " -> " << index << "\n");
-  assert(eventIndex == INVALID_INDEX);
-  eventIndex = index;
+void TagSymbol::setTagIndex(uint32_t index) {
+  LLVM_DEBUG(dbgs() << "setTagIndex " << name << " -> " << index << "\n");
+  assert(tagIndex == INVALID_INDEX);
+  tagIndex = index;
 }
 
-bool EventSymbol::hasEventIndex() const {
-  if (auto *f = dyn_cast<DefinedEvent>(this))
-    return f->event->hasAssignedIndex();
-  return eventIndex != INVALID_INDEX;
+bool TagSymbol::hasTagIndex() const {
+  if (auto *f = dyn_cast<DefinedTag>(this))
+    return f->tag->hasAssignedIndex();
+  return tagIndex != INVALID_INDEX;
 }
 
-DefinedEvent::DefinedEvent(StringRef name, uint32_t flags, InputFile *file,
-                           InputEvent *event)
-    : EventSymbol(name, DefinedEventKind, flags, file,
-                  event ? &event->getType() : nullptr,
-                  event ? &event->signature : nullptr),
-      event(event) {}
+DefinedTag::DefinedTag(StringRef name, uint32_t flags, InputFile *file,
+                       InputTag *tag)
+    : TagSymbol(name, DefinedTagKind, flags, file,
+                tag ? &tag->getType() : nullptr,
+                tag ? &tag->signature : nullptr),
+      tag(tag) {}
 
 void TableSymbol::setLimits(const WasmLimits &limits) {
   if (auto *t = dyn_cast<DefinedTable>(this))

diff  --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h
index 95c7dd12b894a..243f194b75310 100644
--- a/lld/wasm/Symbols.h
+++ b/lld/wasm/Symbols.h
@@ -33,7 +33,7 @@ class InputChunk;
 class InputSegment;
 class InputFunction;
 class InputGlobal;
-class InputEvent;
+class InputTag;
 class InputSection;
 class InputTable;
 class OutputSection;
@@ -47,7 +47,7 @@ class Symbol {
     DefinedFunctionKind,
     DefinedDataKind,
     DefinedGlobalKind,
-    DefinedEventKind,
+    DefinedTagKind,
     DefinedTableKind,
     SectionKind,
     OutputSectionKind,
@@ -414,48 +414,48 @@ class UndefinedTable : public TableSymbol {
   llvm::Optional<StringRef> importModule;
 };
 
-// Wasm events are features that suspend the current execution and transfer the
-// control flow to a corresponding handler. Currently the only supported event
-// kind is exceptions.
+// A tag is a general format to distinguish typed entities. Each tag has an
+// attribute and a type. Currently the attribute can only specify that the tag
+// is for an exception tag.
 //
-// Event tags are values to distinguish 
diff erent events. For exceptions, they
-// can be used to distinguish 
diff erent language's exceptions, i.e., all C++
-// exceptions have the same tag. Wasm can generate code capable of doing
-// 
diff erent handling actions based on the tag of caught exceptions.
+// In exception handling, tags are used to distinguish 
diff erent kinds of
+// exceptions. For example, they can be used to distinguish 
diff erent language's
+// exceptions, e.g., all C++ exceptions have the same tag and Java exceptions
+// would have a distinct tag. Wasm can filter the exceptions it catches based on
+// their tag.
 //
-// A single EventSymbol object represents a single tag. C++ exception event
-// symbol is a weak symbol generated in every object file in which exceptions
-// are used, and has name '__cpp_exception' for linking.
-class EventSymbol : public Symbol {
+// A single TagSymbol object represents a single tag. The C++ exception symbol
+// is a weak symbol generated in every object file in which exceptions are used,
+// and is named '__cpp_exception' for linking.
+class TagSymbol : public Symbol {
 public:
-  static bool classof(const Symbol *s) { return s->kind() == DefinedEventKind; }
+  static bool classof(const Symbol *s) { return s->kind() == DefinedTagKind; }
 
-  const WasmEventType *getEventType() const { return eventType; }
+  const WasmTagType *getTagType() const { return tagType; }
 
-  // Get/set the event index
-  uint32_t getEventIndex() const;
-  void setEventIndex(uint32_t index);
-  bool hasEventIndex() const;
+  // Get/set the tag index
+  uint32_t getTagIndex() const;
+  void setTagIndex(uint32_t index);
+  bool hasTagIndex() const;
 
   const WasmSignature *signature;
 
 protected:
-  EventSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f,
-              const WasmEventType *eventType, const WasmSignature *sig)
-      : Symbol(name, k, flags, f), signature(sig), eventType(eventType) {}
+  TagSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f,
+            const WasmTagType *tagType, const WasmSignature *sig)
+      : Symbol(name, k, flags, f), signature(sig), tagType(tagType) {}
 
-  const WasmEventType *eventType;
-  uint32_t eventIndex = INVALID_INDEX;
+  const WasmTagType *tagType;
+  uint32_t tagIndex = INVALID_INDEX;
 };
 
-class DefinedEvent : public EventSymbol {
+class DefinedTag : public TagSymbol {
 public:
-  DefinedEvent(StringRef name, uint32_t flags, InputFile *file,
-               InputEvent *event);
+  DefinedTag(StringRef name, uint32_t flags, InputFile *file, InputTag *tag);
 
-  static bool classof(const Symbol *s) { return s->kind() == DefinedEventKind; }
+  static bool classof(const Symbol *s) { return s->kind() == DefinedTagKind; }
 
-  InputEvent *event;
+  InputTag *tag;
 };
 
 // LazySymbol represents a symbol that is not yet in the link, but we know where
@@ -588,7 +588,7 @@ union SymbolUnion {
   alignas(DefinedFunction) char a[sizeof(DefinedFunction)];
   alignas(DefinedData) char b[sizeof(DefinedData)];
   alignas(DefinedGlobal) char c[sizeof(DefinedGlobal)];
-  alignas(DefinedEvent) char d[sizeof(DefinedEvent)];
+  alignas(DefinedTag) char d[sizeof(DefinedTag)];
   alignas(DefinedTable) char e[sizeof(DefinedTable)];
   alignas(LazySymbol) char f[sizeof(LazySymbol)];
   alignas(UndefinedFunction) char g[sizeof(UndefinedFunction)];

diff  --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp
index b8cf1cbfddcae..a3d6207bbe61b 100644
--- a/lld/wasm/SyntheticSections.cpp
+++ b/lld/wasm/SyntheticSections.cpp
@@ -114,8 +114,8 @@ void ImportSection::addImport(Symbol *sym) {
     f->setFunctionIndex(numImportedFunctions++);
   else if (auto *g = dyn_cast<GlobalSymbol>(sym))
     g->setGlobalIndex(numImportedGlobals++);
-  else if (auto *e = dyn_cast<EventSymbol>(sym))
-    e->setEventIndex(numImportedEvents++);
+  else if (auto *t = dyn_cast<TagSymbol>(sym))
+    t->setTagIndex(numImportedTags++);
   else
     cast<TableSymbol>(sym)->setTableNumber(numImportedTables++);
 }
@@ -165,10 +165,10 @@ void ImportSection::writeBody() {
     } else if (auto *globalSym = dyn_cast<GlobalSymbol>(sym)) {
       import.Kind = WASM_EXTERNAL_GLOBAL;
       import.Global = *globalSym->getGlobalType();
-    } else if (auto *eventSym = dyn_cast<EventSymbol>(sym)) {
-      import.Kind = WASM_EXTERNAL_EVENT;
-      import.Event.Attribute = eventSym->getEventType()->Attribute;
-      import.Event.SigIndex = out.typeSec->lookupType(*eventSym->signature);
+    } else if (auto *tagSym = dyn_cast<TagSymbol>(sym)) {
+      import.Kind = WASM_EXTERNAL_TAG;
+      import.Tag.Attribute = tagSym->getTagType()->Attribute;
+      import.Tag.SigIndex = out.typeSec->lookupType(*tagSym->signature);
     } else {
       auto *tableSym = cast<TableSymbol>(sym);
       import.Kind = WASM_EXTERNAL_TABLE;
@@ -267,25 +267,24 @@ void MemorySection::writeBody() {
     writeUleb128(os, maxMemoryPages, "max pages");
 }
 
-void EventSection::writeBody() {
+void TagSection::writeBody() {
   raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(os, inputEvents.size(), "event count");
-  for (InputEvent *e : inputEvents) {
-    WasmEventType type = e->getType();
-    type.SigIndex = out.typeSec->lookupType(e->signature);
-    writeEventType(os, type);
+  writeUleb128(os, inputTags.size(), "tag count");
+  for (InputTag *t : inputTags) {
+    WasmTagType type = t->getType();
+    type.SigIndex = out.typeSec->lookupType(t->signature);
+    writeTagType(os, type);
   }
 }
 
-void EventSection::addEvent(InputEvent *event) {
-  if (!event->live)
+void TagSection::addTag(InputTag *tag) {
+  if (!tag->live)
     return;
-  uint32_t eventIndex =
-      out.importSec->getNumImportedEvents() + inputEvents.size();
-  LLVM_DEBUG(dbgs() << "addEvent: " << eventIndex << "\n");
-  event->assignIndex(eventIndex);
-  inputEvents.push_back(event);
+  uint32_t tagIndex = out.importSec->getNumImportedTags() + inputTags.size();
+  LLVM_DEBUG(dbgs() << "addTag: " << tagIndex << "\n");
+  tag->assignIndex(tagIndex);
+  inputTags.push_back(tag);
 }
 
 void GlobalSection::assignIndexes() {
@@ -505,8 +504,8 @@ void LinkingSection::writeBody() {
         writeUleb128(sub.os, g->getGlobalIndex(), "index");
         if (sym->isDefined() || (flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
           writeStr(sub.os, sym->getName(), "sym name");
-      } else if (auto *e = dyn_cast<EventSymbol>(sym)) {
-        writeUleb128(sub.os, e->getEventIndex(), "index");
+      } else if (auto *t = dyn_cast<TagSymbol>(sym)) {
+        writeUleb128(sub.os, t->getTagIndex(), "index");
         if (sym->isDefined() || (flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
           writeStr(sub.os, sym->getName(), "sym name");
       } else if (auto *t = dyn_cast<TableSymbol>(sym)) {

diff  --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h
index 586fd7226c35d..f57fc8832dd28 100644
--- a/lld/wasm/SyntheticSections.h
+++ b/lld/wasm/SyntheticSections.h
@@ -113,9 +113,9 @@ class ImportSection : public SyntheticSection {
     assert(isSealed);
     return numImportedFunctions;
   }
-  uint32_t getNumImportedEvents() const {
+  uint32_t getNumImportedTags() const {
     assert(isSealed);
-    return numImportedEvents;
+    return numImportedTags;
   }
   uint32_t getNumImportedTables() const {
     assert(isSealed);
@@ -129,7 +129,7 @@ class ImportSection : public SyntheticSection {
   bool isSealed = false;
   unsigned numImportedGlobals = 0;
   unsigned numImportedFunctions = 0;
-  unsigned numImportedEvents = 0;
+  unsigned numImportedTags = 0;
   unsigned numImportedTables = 0;
 };
 
@@ -169,24 +169,23 @@ class MemorySection : public SyntheticSection {
   uint64_t maxMemoryPages = 0;
 };
 
-// The event section contains a list of declared wasm events associated with the
-// module. Currently the only supported event kind is exceptions. A single event
-// entry represents a single event with an event tag. All C++ exceptions are
-// represented by a single event. An event entry in this section contains
-// information on what kind of event it is (e.g. exception) and the type of
-// values contained in a single event object. (In wasm, an event can contain
-// multiple values of primitive types. But for C++ exceptions, we just throw a
-// pointer which is an i32 value (for wasm32 architecture), so the signature of
-// C++ exception is (i32)->(void), because all event types are assumed to have
-// void return type to share WasmSignature with functions.)
-class EventSection : public SyntheticSection {
+// The tag section contains a list of declared wasm tags associated with the
+// module. Currently the only supported tag kind is exceptions. All C++
+// exceptions are represented by a single tag. A tag entry in this section
+// contains information on what kind of tag it is (e.g. exception) and the type
+// of values associated with the tag. (In Wasm, a tag can contain multiple
+// values of primitive types. But for C++ exceptions, we just throw a pointer
+// which is an i32 value (for wasm32 architecture), so the signature of C++
+// exception is (i32)->(void), because all exception tag types are assumed to
+// have void return type to share WasmSignature with functions.)
+class TagSection : public SyntheticSection {
 public:
-  EventSection() : SyntheticSection(llvm::wasm::WASM_SEC_EVENT) {}
+  TagSection() : SyntheticSection(llvm::wasm::WASM_SEC_TAG) {}
   void writeBody() override;
-  bool isNeeded() const override { return inputEvents.size() > 0; }
-  void addEvent(InputEvent *event);
+  bool isNeeded() const override { return inputTags.size() > 0; }
+  void addTag(InputTag *tag);
 
-  std::vector<InputEvent *> inputEvents;
+  std::vector<InputTag *> inputTags;
 };
 
 class GlobalSection : public SyntheticSection {
@@ -363,7 +362,7 @@ struct OutStruct {
   TableSection *tableSec;
   MemorySection *memorySec;
   GlobalSection *globalSec;
-  EventSection *eventSec;
+  TagSection *tagSec;
   ExportSection *exportSec;
   StartSection *startSec;
   ElemSection *elemSec;

diff  --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index ddc79f8b434a5..7312386ef417f 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -391,7 +391,7 @@ void Writer::addSections() {
   addSection(out.functionSec);
   addSection(out.tableSec);
   addSection(out.memorySec);
-  addSection(out.eventSec);
+  addSection(out.tagSec);
   addSection(out.globalSec);
   addSection(out.exportSec);
   addSection(out.startSec);
@@ -625,8 +625,8 @@ void Writer::calculateExports() {
         continue;
       }
       export_ = {name, WASM_EXTERNAL_GLOBAL, g->getGlobalIndex()};
-    } else if (auto *e = dyn_cast<DefinedEvent>(sym)) {
-      export_ = {name, WASM_EXTERNAL_EVENT, e->getEventIndex()};
+    } else if (auto *t = dyn_cast<DefinedTag>(sym)) {
+      export_ = {name, WASM_EXTERNAL_TAG, t->getTagIndex()};
     } else if (auto *d = dyn_cast<DefinedData>(sym)) {
       if (d->segment && d->segment->isTLS()) {
         // We can't currenly export TLS data symbols.
@@ -668,8 +668,8 @@ void Writer::calculateTypes() {
   // 1. Any signature used in the TYPE relocation
   // 2. The signatures of all imported functions
   // 3. The signatures of all defined functions
-  // 4. The signatures of all imported events
-  // 5. The signatures of all defined events
+  // 4. The signatures of all imported tags
+  // 5. The signatures of all defined tags
 
   for (ObjFile *file : symtab->objectFiles) {
     ArrayRef<WasmSignature> types = file->getWasmObj()->types();
@@ -681,15 +681,15 @@ void Writer::calculateTypes() {
   for (const Symbol *sym : out.importSec->importedSymbols) {
     if (auto *f = dyn_cast<FunctionSymbol>(sym))
       out.typeSec->registerType(*f->signature);
-    else if (auto *e = dyn_cast<EventSymbol>(sym))
-      out.typeSec->registerType(*e->signature);
+    else if (auto *t = dyn_cast<TagSymbol>(sym))
+      out.typeSec->registerType(*t->signature);
   }
 
   for (const InputFunction *f : out.functionSec->inputFunctions)
     out.typeSec->registerType(f->signature);
 
-  for (const InputEvent *e : out.eventSec->inputEvents)
-    out.typeSec->registerType(e->signature);
+  for (const InputTag *t : out.tagSec->inputTags)
+    out.typeSec->registerType(t->signature);
 }
 
 // In a command-style link, create a wrapper for each exported symbol
@@ -797,9 +797,9 @@ void Writer::assignIndexes() {
   }
 
   for (ObjFile *file : symtab->objectFiles) {
-    LLVM_DEBUG(dbgs() << "Events: " << file->getName() << "\n");
-    for (InputEvent *event : file->events)
-      out.eventSec->addEvent(event);
+    LLVM_DEBUG(dbgs() << "Tags: " << file->getName() << "\n");
+    for (InputTag *tag : file->tags)
+      out.tagSec->addTag(tag);
   }
 
   for (ObjFile *file : symtab->objectFiles) {
@@ -1361,7 +1361,7 @@ void Writer::createSyntheticSections() {
   out.functionSec = make<FunctionSection>();
   out.tableSec = make<TableSection>();
   out.memorySec = make<MemorySection>();
-  out.eventSec = make<EventSection>();
+  out.tagSec = make<TagSection>();
   out.globalSec = make<GlobalSection>();
   out.exportSec = make<ExportSection>();
   out.startSec = make<StartSection>();
@@ -1494,12 +1494,12 @@ void Writer::run() {
   if (errorHandler().verbose) {
     log("Defined Functions: " + Twine(out.functionSec->inputFunctions.size()));
     log("Defined Globals  : " + Twine(out.globalSec->numGlobals()));
-    log("Defined Events   : " + Twine(out.eventSec->inputEvents.size()));
+    log("Defined Tags     : " + Twine(out.tagSec->inputTags.size()));
     log("Defined Tables   : " + Twine(out.tableSec->inputTables.size()));
     log("Function Imports : " +
         Twine(out.importSec->getNumImportedFunctions()));
     log("Global Imports   : " + Twine(out.importSec->getNumImportedGlobals()));
-    log("Event Imports    : " + Twine(out.importSec->getNumImportedEvents()));
+    log("Tag Imports      : " + Twine(out.importSec->getNumImportedTags()));
     log("Table Imports    : " + Twine(out.importSec->getNumImportedTables()));
     for (ObjFile *file : symtab->objectFiles)
       file->dumpInfo();

diff  --git a/lld/wasm/WriterUtils.cpp b/lld/wasm/WriterUtils.cpp
index 1870b36863418..17e7c17cf1f59 100644
--- a/lld/wasm/WriterUtils.cpp
+++ b/lld/wasm/WriterUtils.cpp
@@ -58,8 +58,8 @@ std::string toString(const WasmGlobalType &type) {
          toString(static_cast<ValType>(type.Type));
 }
 
-std::string toString(const WasmEventType &type) {
-  if (type.Attribute == WASM_EVENT_ATTRIBUTE_EXCEPTION)
+std::string toString(const WasmTagType &type) {
+  if (type.Attribute == WASM_TAG_ATTRIBUTE_EXCEPTION)
     return "exception";
   return "unknown";
 }
@@ -202,13 +202,13 @@ void writeGlobalType(raw_ostream &os, const WasmGlobalType &type) {
   writeU8(os, type.Mutable, "global mutable");
 }
 
-void writeEventType(raw_ostream &os, const WasmEventType &type) {
-  writeUleb128(os, type.Attribute, "event attribute");
+void writeTagType(raw_ostream &os, const WasmTagType &type) {
+  writeUleb128(os, type.Attribute, "tag attribute");
   writeUleb128(os, type.SigIndex, "sig index");
 }
 
-void writeEvent(raw_ostream &os, const WasmEvent &event) {
-  writeEventType(os, event.Type);
+void writeTag(raw_ostream &os, const WasmTag &tag) {
+  writeTagType(os, tag.Type);
 }
 
 void writeTableType(raw_ostream &os, const WasmTableType &type) {
@@ -227,8 +227,8 @@ void writeImport(raw_ostream &os, const WasmImport &import) {
   case WASM_EXTERNAL_GLOBAL:
     writeGlobalType(os, import.Global);
     break;
-  case WASM_EXTERNAL_EVENT:
-    writeEventType(os, import.Event);
+  case WASM_EXTERNAL_TAG:
+    writeTagType(os, import.Tag);
     break;
   case WASM_EXTERNAL_MEMORY:
     writeLimits(os, import.Memory);
@@ -251,8 +251,8 @@ void writeExport(raw_ostream &os, const WasmExport &export_) {
   case WASM_EXTERNAL_GLOBAL:
     writeUleb128(os, export_.Index, "global index");
     break;
-  case WASM_EXTERNAL_EVENT:
-    writeUleb128(os, export_.Index, "event index");
+  case WASM_EXTERNAL_TAG:
+    writeUleb128(os, export_.Index, "tag index");
     break;
   case WASM_EXTERNAL_MEMORY:
     writeUleb128(os, export_.Index, "memory index");

diff  --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index a96d8aab4edd2..40daf45559483 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -51,9 +51,9 @@ void writeLimits(raw_ostream &os, const llvm::wasm::WasmLimits &limits);
 
 void writeGlobalType(raw_ostream &os, const llvm::wasm::WasmGlobalType &type);
 
-void writeEventType(raw_ostream &os, const llvm::wasm::WasmEventType &type);
+void writeTagType(raw_ostream &os, const llvm::wasm::WasmTagType &type);
 
-void writeEvent(raw_ostream &os, const llvm::wasm::WasmEvent &event);
+void writeTag(raw_ostream &os, const llvm::wasm::WasmTag &tag);
 
 void writeTableType(raw_ostream &os, const llvm::wasm::WasmTableType &type);
 
@@ -66,7 +66,7 @@ void writeExport(raw_ostream &os, const llvm::wasm::WasmExport &export_);
 std::string toString(llvm::wasm::ValType type);
 std::string toString(const llvm::wasm::WasmSignature &sig);
 std::string toString(const llvm::wasm::WasmGlobalType &type);
-std::string toString(const llvm::wasm::WasmEventType &type);
+std::string toString(const llvm::wasm::WasmTagType &type);
 std::string toString(const llvm::wasm::WasmTableType &type);
 
 } // namespace lld

diff  --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
index 6c29c2326212e..5272da9ab33a4 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -196,7 +196,7 @@ bool ObjectFileWasm::DecodeNextSection(lldb::offset_t *offset_ptr) {
     m_sect_infos.push_back(section_info{*offset_ptr + c.tell(), section_length,
                                         section_id, *sect_name});
     *offset_ptr += (c.tell() + section_length);
-  } else if (section_id <= llvm::wasm::WASM_SEC_EVENT) {
+  } else if (section_id <= llvm::wasm::WASM_SEC_TAG) {
     m_sect_infos.push_back(section_info{*offset_ptr + c.tell(),
                                         static_cast<uint32_t>(payload_len),
                                         section_id, ConstString()});

diff  --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h
index 999f4a2578130..9dfe1d1e10681 100644
--- a/llvm/include/llvm/BinaryFormat/Wasm.h
+++ b/llvm/include/llvm/BinaryFormat/Wasm.h
@@ -101,15 +101,15 @@ struct WasmGlobal {
   StringRef SymbolName; // from the "linking" section
 };
 
-struct WasmEventType {
-  // Kind of event. Currently only WASM_EVENT_ATTRIBUTE_EXCEPTION is possible.
+struct WasmTagType {
+  // Kind of tag. Currently only WASM_TAG_ATTRIBUTE_EXCEPTION is possible.
   uint32_t Attribute;
   uint32_t SigIndex;
 };
 
-struct WasmEvent {
+struct WasmTag {
   uint32_t Index;
-  WasmEventType Type;
+  WasmTagType Type;
   StringRef SymbolName; // from the "linking" section
 };
 
@@ -122,7 +122,7 @@ struct WasmImport {
     WasmGlobalType Global;
     WasmTableType Table;
     WasmLimits Memory;
-    WasmEventType Event;
+    WasmTagType Tag;
   };
 };
 
@@ -238,7 +238,7 @@ enum : unsigned {
   WASM_SEC_CODE = 10,      // Function bodies (code)
   WASM_SEC_DATA = 11,      // Data segments
   WASM_SEC_DATACOUNT = 12, // Data segment count
-  WASM_SEC_EVENT = 13      // Event declarations
+  WASM_SEC_TAG = 13        // Tag declarations
 };
 
 // Type immediate encodings used in various contexts.
@@ -260,7 +260,7 @@ enum : unsigned {
   WASM_EXTERNAL_TABLE = 0x1,
   WASM_EXTERNAL_MEMORY = 0x2,
   WASM_EXTERNAL_GLOBAL = 0x3,
-  WASM_EXTERNAL_EVENT = 0x4,
+  WASM_EXTERNAL_TAG = 0x4,
 };
 
 // Opcodes used in initializer expressions.
@@ -343,7 +343,7 @@ enum : unsigned {
 enum : unsigned {
   WASM_COMDAT_DATA = 0x0,
   WASM_COMDAT_FUNCTION = 0x1,
-  // GLOBAL, EVENT, and TABLE are in here but LLVM doesn't use them yet.
+  // GLOBAL, TAG, and TABLE are in here but LLVM doesn't use them yet.
   WASM_COMDAT_SECTION = 0x5,
 };
 
@@ -353,7 +353,7 @@ enum WasmSymbolType : unsigned {
   WASM_SYMBOL_TYPE_DATA = 0x1,
   WASM_SYMBOL_TYPE_GLOBAL = 0x2,
   WASM_SYMBOL_TYPE_SECTION = 0x3,
-  WASM_SYMBOL_TYPE_EVENT = 0x4,
+  WASM_SYMBOL_TYPE_TAG = 0x4,
   WASM_SYMBOL_TYPE_TABLE = 0x5,
 };
 
@@ -362,9 +362,9 @@ enum WasmSegmentFlag : unsigned {
   WASM_SEG_FLAG_TLS = 0x2,
 };
 
-// Kinds of event attributes.
-enum WasmEventAttribute : unsigned {
-  WASM_EVENT_ATTRIBUTE_EXCEPTION = 0x0,
+// Kinds of tag attributes.
+enum WasmTagAttribute : unsigned {
+  WASM_TAG_ATTRIBUTE_EXCEPTION = 0x0,
 };
 
 const unsigned WASM_SYMBOL_BINDING_MASK = 0x3;

diff  --git a/llvm/include/llvm/BinaryFormat/WasmRelocs.def b/llvm/include/llvm/BinaryFormat/WasmRelocs.def
index 80c9ebcb1fa2d..a78a76f5778f9 100644
--- a/llvm/include/llvm/BinaryFormat/WasmRelocs.def
+++ b/llvm/include/llvm/BinaryFormat/WasmRelocs.def
@@ -12,7 +12,7 @@ WASM_RELOC(R_WASM_TYPE_INDEX_LEB,          6)
 WASM_RELOC(R_WASM_GLOBAL_INDEX_LEB,        7)
 WASM_RELOC(R_WASM_FUNCTION_OFFSET_I32,     8)
 WASM_RELOC(R_WASM_SECTION_OFFSET_I32,      9)
-WASM_RELOC(R_WASM_EVENT_INDEX_LEB,        10)
+WASM_RELOC(R_WASM_TAG_INDEX_LEB,          10)
 WASM_RELOC(R_WASM_MEMORY_ADDR_REL_SLEB,   11)
 WASM_RELOC(R_WASM_TABLE_INDEX_REL_SLEB,   12)
 WASM_RELOC(R_WASM_GLOBAL_INDEX_I32,       13)

diff  --git a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
index 1bd22af3e1354..8b55a45b61e8b 100644
--- a/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
+++ b/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
@@ -24,7 +24,7 @@ class Function;
 class MachineBasicBlock;
 
 namespace WebAssembly {
-enum EventTag { CPP_EXCEPTION = 0, C_LONGJMP = 1 };
+enum Tag { CPP_EXCEPTION = 0, C_LONGJMP = 1 };
 }
 
 using BBOrMBB = PointerUnion<const BasicBlock *, MachineBasicBlock *>;

diff  --git a/llvm/include/llvm/MC/MCSymbolWasm.h b/llvm/include/llvm/MC/MCSymbolWasm.h
index 14b3a5d8e941d..852ab678e6165 100644
--- a/llvm/include/llvm/MC/MCSymbolWasm.h
+++ b/llvm/include/llvm/MC/MCSymbolWasm.h
@@ -27,7 +27,7 @@ class MCSymbolWasm : public MCSymbol {
   wasm::WasmSignature *Signature = nullptr;
   Optional<wasm::WasmGlobalType> GlobalType;
   Optional<wasm::WasmTableType> TableType;
-  Optional<wasm::WasmEventType> EventType;
+  Optional<wasm::WasmTagType> TagType;
 
   /// An expression describing how to calculate the size of a symbol. If a
   /// symbol has no size this field will be NULL.
@@ -47,7 +47,7 @@ class MCSymbolWasm : public MCSymbol {
   bool isGlobal() const { return Type == wasm::WASM_SYMBOL_TYPE_GLOBAL; }
   bool isTable() const { return Type == wasm::WASM_SYMBOL_TYPE_TABLE; }
   bool isSection() const { return Type == wasm::WASM_SYMBOL_TYPE_SECTION; }
-  bool isEvent() const { return Type == wasm::WASM_SYMBOL_TYPE_EVENT; }
+  bool isTag() const { return Type == wasm::WASM_SYMBOL_TYPE_TAG; }
 
   Optional<wasm::WasmSymbolType> getType() const { return Type; }
 
@@ -143,11 +143,11 @@ class MCSymbolWasm : public MCSymbol {
     setTableType({uint8_t(VT), Limits});
   }
 
-  const wasm::WasmEventType &getEventType() const {
-    assert(EventType.hasValue());
-    return EventType.getValue();
+  const wasm::WasmTagType &getTagType() const {
+    assert(TagType.hasValue());
+    return TagType.getValue();
   }
-  void setEventType(wasm::WasmEventType ET) { EventType = ET; }
+  void setTagType(wasm::WasmTagType ET) { TagType = ET; }
 };
 
 } // end namespace llvm

diff  --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h
index 1e270814546a6..2cea950fcf253 100644
--- a/llvm/include/llvm/Object/Wasm.h
+++ b/llvm/include/llvm/Object/Wasm.h
@@ -37,15 +37,15 @@ class WasmSymbol {
   WasmSymbol(const wasm::WasmSymbolInfo &Info,
              const wasm::WasmGlobalType *GlobalType,
              const wasm::WasmTableType *TableType,
-             const wasm::WasmEventType *EventType,
+             const wasm::WasmTagType *TagType,
              const wasm::WasmSignature *Signature)
       : Info(Info), GlobalType(GlobalType), TableType(TableType),
-        EventType(EventType), Signature(Signature) {}
+        TagType(TagType), Signature(Signature) {}
 
   const wasm::WasmSymbolInfo &Info;
   const wasm::WasmGlobalType *GlobalType;
   const wasm::WasmTableType *TableType;
-  const wasm::WasmEventType *EventType;
+  const wasm::WasmTagType *TagType;
   const wasm::WasmSignature *Signature;
 
   bool isTypeFunction() const {
@@ -64,7 +64,7 @@ class WasmSymbol {
     return Info.Kind == wasm::WASM_SYMBOL_TYPE_SECTION;
   }
 
-  bool isTypeEvent() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_EVENT; }
+  bool isTypeTag() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG; }
 
   bool isDefined() const { return !isUndefined(); }
 
@@ -143,7 +143,7 @@ class WasmObjectFile : public ObjectFile {
   ArrayRef<wasm::WasmTable> tables() const { return Tables; }
   ArrayRef<wasm::WasmLimits> memories() const { return Memories; }
   ArrayRef<wasm::WasmGlobal> globals() const { return Globals; }
-  ArrayRef<wasm::WasmEvent> events() const { return Events; }
+  ArrayRef<wasm::WasmTag> tags() const { return Tags; }
   ArrayRef<wasm::WasmExport> exports() const { return Exports; }
   ArrayRef<WasmSymbol> syms() const { return Symbols; }
   const wasm::WasmLinkingData &linkingData() const { return LinkingData; }
@@ -156,7 +156,7 @@ class WasmObjectFile : public ObjectFile {
   uint32_t getNumImportedGlobals() const { return NumImportedGlobals; }
   uint32_t getNumImportedTables() const { return NumImportedTables; }
   uint32_t getNumImportedFunctions() const { return NumImportedFunctions; }
-  uint32_t getNumImportedEvents() const { return NumImportedEvents; }
+  uint32_t getNumImportedTags() const { return NumImportedTags; }
   uint32_t getNumSections() const { return Sections.size(); }
   void moveSymbolNext(DataRefImpl &Symb) const override;
 
@@ -223,18 +223,18 @@ class WasmObjectFile : public ObjectFile {
   bool isValidTableNumber(uint32_t Index) const;
   bool isDefinedGlobalIndex(uint32_t Index) const;
   bool isDefinedTableNumber(uint32_t Index) const;
-  bool isValidEventIndex(uint32_t Index) const;
-  bool isDefinedEventIndex(uint32_t Index) const;
+  bool isValidTagIndex(uint32_t Index) const;
+  bool isDefinedTagIndex(uint32_t Index) const;
   bool isValidFunctionSymbol(uint32_t Index) const;
   bool isValidTableSymbol(uint32_t Index) const;
   bool isValidGlobalSymbol(uint32_t Index) const;
-  bool isValidEventSymbol(uint32_t Index) const;
+  bool isValidTagSymbol(uint32_t Index) const;
   bool isValidDataSymbol(uint32_t Index) const;
   bool isValidSectionSymbol(uint32_t Index) const;
   wasm::WasmFunction &getDefinedFunction(uint32_t Index);
   const wasm::WasmFunction &getDefinedFunction(uint32_t Index) const;
   wasm::WasmGlobal &getDefinedGlobal(uint32_t Index);
-  wasm::WasmEvent &getDefinedEvent(uint32_t Index);
+  wasm::WasmTag &getDefinedTag(uint32_t Index);
 
   const WasmSection &getWasmSection(DataRefImpl Ref) const;
   const wasm::WasmRelocation &getWasmRelocation(DataRefImpl Ref) const;
@@ -249,7 +249,7 @@ class WasmObjectFile : public ObjectFile {
   Error parseFunctionSection(ReadContext &Ctx);
   Error parseTableSection(ReadContext &Ctx);
   Error parseMemorySection(ReadContext &Ctx);
-  Error parseEventSection(ReadContext &Ctx);
+  Error parseTagSection(ReadContext &Ctx);
   Error parseGlobalSection(ReadContext &Ctx);
   Error parseExportSection(ReadContext &Ctx);
   Error parseStartSection(ReadContext &Ctx);
@@ -278,7 +278,7 @@ class WasmObjectFile : public ObjectFile {
   std::vector<wasm::WasmTable> Tables;
   std::vector<wasm::WasmLimits> Memories;
   std::vector<wasm::WasmGlobal> Globals;
-  std::vector<wasm::WasmEvent> Events;
+  std::vector<wasm::WasmTag> Tags;
   std::vector<wasm::WasmImport> Imports;
   std::vector<wasm::WasmExport> Exports;
   std::vector<wasm::WasmElemSegment> ElemSegments;
@@ -296,10 +296,10 @@ class WasmObjectFile : public ObjectFile {
   uint32_t NumImportedGlobals = 0;
   uint32_t NumImportedTables = 0;
   uint32_t NumImportedFunctions = 0;
-  uint32_t NumImportedEvents = 0;
+  uint32_t NumImportedTags = 0;
   uint32_t CodeSection = 0;
   uint32_t DataSection = 0;
-  uint32_t EventSection = 0;
+  uint32_t TagSection = 0;
   uint32_t GlobalSection = 0;
   uint32_t TableSection = 0;
 };
@@ -317,7 +317,7 @@ class WasmSectionOrderChecker {
     WASM_SEC_ORDER_FUNCTION,
     WASM_SEC_ORDER_TABLE,
     WASM_SEC_ORDER_MEMORY,
-    WASM_SEC_ORDER_EVENT,
+    WASM_SEC_ORDER_TAG,
     WASM_SEC_ORDER_GLOBAL,
     WASM_SEC_ORDER_EXPORT,
     WASM_SEC_ORDER_START,

diff  --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h
index 708e82c9b9f1d..661e06fba8bd6 100644
--- a/llvm/include/llvm/ObjectYAML/WasmYAML.h
+++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h
@@ -77,7 +77,7 @@ struct Global {
   wasm::WasmInitExpr InitExpr;
 };
 
-struct Event {
+struct Tag {
   uint32_t Index;
   uint32_t Attribute;
   uint32_t SigIndex;
@@ -92,7 +92,7 @@ struct Import {
     Global GlobalImport;
     Table TableImport;
     Limits Memory;
-    Event EventImport;
+    Tag TagImport;
   };
 };
 
@@ -316,14 +316,14 @@ struct MemorySection : Section {
   std::vector<Limits> Memories;
 };
 
-struct EventSection : Section {
-  EventSection() : Section(wasm::WASM_SEC_EVENT) {}
+struct TagSection : Section {
+  TagSection() : Section(wasm::WASM_SEC_TAG) {}
 
   static bool classof(const Section *S) {
-    return S->Type == wasm::WASM_SEC_EVENT;
+    return S->Type == wasm::WASM_SEC_TAG;
   }
 
-  std::vector<Event> Events;
+  std::vector<Tag> Tags;
 };
 
 struct GlobalSection : Section {
@@ -425,7 +425,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo)
 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::InitFunction)
 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ComdatEntry)
 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Comdat)
-LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Event)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Tag)
 
 namespace llvm {
 namespace yaml {
@@ -570,8 +570,8 @@ template <> struct ScalarEnumerationTraits<WasmYAML::RelocType> {
   static void enumeration(IO &IO, WasmYAML::RelocType &Kind);
 };
 
-template <> struct MappingTraits<WasmYAML::Event> {
-  static void mapping(IO &IO, WasmYAML::Event &Event);
+template <> struct MappingTraits<WasmYAML::Tag> {
+  static void mapping(IO &IO, WasmYAML::Tag &Tag);
 };
 
 } // end namespace yaml

diff  --git a/llvm/lib/BinaryFormat/Wasm.cpp b/llvm/lib/BinaryFormat/Wasm.cpp
index 81264a940ce1e..4192622d2d217 100644
--- a/llvm/lib/BinaryFormat/Wasm.cpp
+++ b/llvm/lib/BinaryFormat/Wasm.cpp
@@ -20,8 +20,8 @@ std::string llvm::wasm::toString(wasm::WasmSymbolType Type) {
     return "WASM_SYMBOL_TYPE_DATA";
   case wasm::WASM_SYMBOL_TYPE_SECTION:
     return "WASM_SYMBOL_TYPE_SECTION";
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
-    return "WASM_SYMBOL_TYPE_EVENT";
+  case wasm::WASM_SYMBOL_TYPE_TAG:
+    return "WASM_SYMBOL_TYPE_TAG";
   }
   llvm_unreachable("unknown symbol type");
 }

diff  --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 23208183121e8..41f50f636112c 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -195,7 +195,7 @@ class WasmObjectWriter : public MCObjectWriter {
   // for TABLE_INDEX relocation types (i.e. address taken functions).
   DenseMap<const MCSymbolWasm *, uint32_t> TableIndices;
   // Maps function/global/table symbols to the
-  // function/global/table/event/section index space.
+  // function/global/table/tag/section index space.
   DenseMap<const MCSymbolWasm *, uint32_t> WasmIndices;
   DenseMap<const MCSymbolWasm *, uint32_t> GOTIndices;
   // Maps data symbols to the Wasm segment and offset/size with the segment.
@@ -219,7 +219,7 @@ class WasmObjectWriter : public MCObjectWriter {
   unsigned NumFunctionImports = 0;
   unsigned NumGlobalImports = 0;
   unsigned NumTableImports = 0;
-  unsigned NumEventImports = 0;
+  unsigned NumTagImports = 0;
   uint32_t SectionCount = 0;
 
   enum class DwoMode {
@@ -317,7 +317,7 @@ class WasmObjectWriter : public MCObjectWriter {
   uint32_t writeCodeSection(const MCAssembler &Asm, const MCAsmLayout &Layout,
                             ArrayRef<WasmFunction> Functions);
   uint32_t writeDataSection(const MCAsmLayout &Layout);
-  void writeEventSection(ArrayRef<wasm::WasmEventType> Events);
+  void writeTagSection(ArrayRef<wasm::WasmTagType> Tags);
   void writeGlobalSection(ArrayRef<wasm::WasmGlobal> Globals);
   void writeTableSection(ArrayRef<wasm::WasmTable> Tables);
   void writeRelocSection(uint32_t SectionIndex, StringRef Name,
@@ -337,9 +337,9 @@ class WasmObjectWriter : public MCObjectWriter {
 
   uint32_t getRelocationIndexValue(const WasmRelocationEntry &RelEntry);
   uint32_t getFunctionType(const MCSymbolWasm &Symbol);
-  uint32_t getEventType(const MCSymbolWasm &Symbol);
+  uint32_t getTagType(const MCSymbolWasm &Symbol);
   void registerFunctionType(const MCSymbolWasm &Symbol);
-  void registerEventType(const MCSymbolWasm &Symbol);
+  void registerTagType(const MCSymbolWasm &Symbol);
 };
 
 } // end anonymous namespace
@@ -612,9 +612,9 @@ WasmObjectWriter::getProvisionalValue(const WasmRelocationEntry &RelEntry,
   case wasm::R_WASM_FUNCTION_INDEX_LEB:
   case wasm::R_WASM_GLOBAL_INDEX_LEB:
   case wasm::R_WASM_GLOBAL_INDEX_I32:
-  case wasm::R_WASM_EVENT_INDEX_LEB:
+  case wasm::R_WASM_TAG_INDEX_LEB:
   case wasm::R_WASM_TABLE_NUMBER_LEB:
-    // Provisional value is function/global/event Wasm index
+    // Provisional value is function/global/tag Wasm index
     assert(WasmIndices.count(RelEntry.Symbol) > 0 && "symbol not found in wasm index space");
     return WasmIndices[RelEntry.Symbol];
   case wasm::R_WASM_FUNCTION_OFFSET_I32:
@@ -717,7 +717,7 @@ void WasmObjectWriter::applyRelocations(
     case wasm::R_WASM_TYPE_INDEX_LEB:
     case wasm::R_WASM_GLOBAL_INDEX_LEB:
     case wasm::R_WASM_MEMORY_ADDR_LEB:
-    case wasm::R_WASM_EVENT_INDEX_LEB:
+    case wasm::R_WASM_TAG_INDEX_LEB:
     case wasm::R_WASM_TABLE_NUMBER_LEB:
       writePatchableLEB<5>(Stream, Value, Offset);
       break;
@@ -813,9 +813,9 @@ void WasmObjectWriter::writeImportSection(ArrayRef<wasm::WasmImport> Imports,
       encodeULEB128(0, W->OS);           // flags
       encodeULEB128(NumElements, W->OS); // initial
       break;
-    case wasm::WASM_EXTERNAL_EVENT:
-      encodeULEB128(Import.Event.Attribute, W->OS);
-      encodeULEB128(Import.Event.SigIndex, W->OS);
+    case wasm::WASM_EXTERNAL_TAG:
+      encodeULEB128(Import.Tag.Attribute, W->OS);
+      encodeULEB128(Import.Tag.SigIndex, W->OS);
       break;
     default:
       llvm_unreachable("unsupported import kind");
@@ -839,17 +839,17 @@ void WasmObjectWriter::writeFunctionSection(ArrayRef<WasmFunction> Functions) {
   endSection(Section);
 }
 
-void WasmObjectWriter::writeEventSection(ArrayRef<wasm::WasmEventType> Events) {
-  if (Events.empty())
+void WasmObjectWriter::writeTagSection(ArrayRef<wasm::WasmTagType> Tags) {
+  if (Tags.empty())
     return;
 
   SectionBookkeeping Section;
-  startSection(Section, wasm::WASM_SEC_EVENT);
+  startSection(Section, wasm::WASM_SEC_TAG);
 
-  encodeULEB128(Events.size(), W->OS);
-  for (const wasm::WasmEventType &Event : Events) {
-    encodeULEB128(Event.Attribute, W->OS);
-    encodeULEB128(Event.SigIndex, W->OS);
+  encodeULEB128(Tags.size(), W->OS);
+  for (const wasm::WasmTagType &Tag : Tags) {
+    encodeULEB128(Tag.Attribute, W->OS);
+    encodeULEB128(Tag.SigIndex, W->OS);
   }
 
   endSection(Section);
@@ -1103,7 +1103,7 @@ void WasmObjectWriter::writeLinkingMetaDataSection(
       switch (Sym.Kind) {
       case wasm::WASM_SYMBOL_TYPE_FUNCTION:
       case wasm::WASM_SYMBOL_TYPE_GLOBAL:
-      case wasm::WASM_SYMBOL_TYPE_EVENT:
+      case wasm::WASM_SYMBOL_TYPE_TAG:
       case wasm::WASM_SYMBOL_TYPE_TABLE:
         encodeULEB128(Sym.ElementIndex, W->OS);
         if ((Sym.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 ||
@@ -1196,8 +1196,8 @@ uint32_t WasmObjectWriter::getFunctionType(const MCSymbolWasm &Symbol) {
   return TypeIndices[&Symbol];
 }
 
-uint32_t WasmObjectWriter::getEventType(const MCSymbolWasm &Symbol) {
-  assert(Symbol.isEvent());
+uint32_t WasmObjectWriter::getTagType(const MCSymbolWasm &Symbol) {
+  assert(Symbol.isTag());
   assert(TypeIndices.count(&Symbol));
   return TypeIndices[&Symbol];
 }
@@ -1222,8 +1222,8 @@ void WasmObjectWriter::registerFunctionType(const MCSymbolWasm &Symbol) {
   LLVM_DEBUG(dbgs() << "  -> type index: " << Pair.first->second << "\n");
 }
 
-void WasmObjectWriter::registerEventType(const MCSymbolWasm &Symbol) {
-  assert(Symbol.isEvent());
+void WasmObjectWriter::registerTagType(const MCSymbolWasm &Symbol) {
+  assert(Symbol.isTag());
 
   // TODO Currently we don't generate imported exceptions, but if we do, we
   // should have a way of infering types of imported exceptions.
@@ -1238,7 +1238,7 @@ void WasmObjectWriter::registerEventType(const MCSymbolWasm &Symbol) {
     Signatures.push_back(S);
   TypeIndices[&Symbol] = Pair.first->second;
 
-  LLVM_DEBUG(dbgs() << "registerEventType: " << Symbol << " new:" << Pair.second
+  LLVM_DEBUG(dbgs() << "registerTagType: " << Symbol << " new:" << Pair.second
                     << "\n");
   LLVM_DEBUG(dbgs() << "  -> type index: " << Pair.first->second << "\n");
 }
@@ -1292,8 +1292,8 @@ void WasmObjectWriter::prepareImports(
       registerFunctionType(*cast<MCSymbolWasm>(BS));
     }
 
-    if (WS.isEvent())
-      registerEventType(WS);
+    if (WS.isTag())
+      registerTagType(WS);
 
     if (WS.isTemporary())
       continue;
@@ -1321,19 +1321,19 @@ void WasmObjectWriter::prepareImports(
         Imports.push_back(Import);
         assert(WasmIndices.count(&WS) == 0);
         WasmIndices[&WS] = NumGlobalImports++;
-      } else if (WS.isEvent()) {
+      } else if (WS.isTag()) {
         if (WS.isWeak())
-          report_fatal_error("undefined event symbol cannot be weak");
+          report_fatal_error("undefined tag symbol cannot be weak");
 
         wasm::WasmImport Import;
         Import.Module = WS.getImportModule();
         Import.Field = WS.getImportName();
-        Import.Kind = wasm::WASM_EXTERNAL_EVENT;
-        Import.Event.Attribute = wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION;
-        Import.Event.SigIndex = getEventType(WS);
+        Import.Kind = wasm::WASM_EXTERNAL_TAG;
+        Import.Tag.Attribute = wasm::WASM_TAG_ATTRIBUTE_EXCEPTION;
+        Import.Tag.SigIndex = getTagType(WS);
         Imports.push_back(Import);
         assert(WasmIndices.count(&WS) == 0);
-        WasmIndices[&WS] = NumEventImports++;
+        WasmIndices[&WS] = NumTagImports++;
       } else if (WS.isTable()) {
         if (WS.isWeak())
           report_fatal_error("undefined table symbol cannot be weak");
@@ -1398,7 +1398,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
   SmallVector<uint32_t, 4> TableElems;
   SmallVector<wasm::WasmImport, 4> Imports;
   SmallVector<wasm::WasmExport, 4> Exports;
-  SmallVector<wasm::WasmEventType, 1> Events;
+  SmallVector<wasm::WasmTagType, 1> Tags;
   SmallVector<wasm::WasmGlobal, 1> Globals;
   SmallVector<wasm::WasmTable, 1> Tables;
   SmallVector<wasm::WasmSymbolInfo, 4> SymbolInfos;
@@ -1632,23 +1632,23 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
         }
         LLVM_DEBUG(dbgs() << " -> table index: "
                           << WasmIndices.find(&WS)->second << "\n");
-      } else if (WS.isEvent()) {
+      } else if (WS.isTag()) {
         // C++ exception symbol (__cpp_exception)
         unsigned Index;
         if (WS.isDefined()) {
-          Index = NumEventImports + Events.size();
-          wasm::WasmEventType Event;
-          Event.SigIndex = getEventType(WS);
-          Event.Attribute = wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION;
+          Index = NumTagImports + Tags.size();
+          wasm::WasmTagType Tag;
+          Tag.SigIndex = getTagType(WS);
+          Tag.Attribute = wasm::WASM_TAG_ATTRIBUTE_EXCEPTION;
           assert(WasmIndices.count(&WS) == 0);
           WasmIndices[&WS] = Index;
-          Events.push_back(Event);
+          Tags.push_back(Tag);
         } else {
           // An import; the index was assigned above.
           assert(WasmIndices.count(&WS) > 0);
         }
-        LLVM_DEBUG(dbgs() << "  -> event index: "
-                          << WasmIndices.find(&WS)->second << "\n");
+        LLVM_DEBUG(dbgs() << "  -> tag index: " << WasmIndices.find(&WS)->second
+                          << "\n");
 
       } else {
         assert(WS.isSection());
@@ -1703,7 +1703,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
         DataLocations[&WS] = Ref;
         LLVM_DEBUG(dbgs() << "  -> index:" << Ref.Segment << "\n");
       } else {
-        report_fatal_error("don't yet support global/event aliases");
+        report_fatal_error("don't yet support global/tag aliases");
       }
     }
   }
@@ -1858,7 +1858,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
     writeFunctionSection(Functions);
     writeTableSection(Tables);
     // Skip the "memory" section; we import the memory instead.
-    writeEventSection(Events);
+    writeTagSection(Tags);
     writeGlobalSection(Globals);
     writeExportSection(Exports);
     const MCSymbol *IndirectFunctionTable =

diff  --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp
index 7df9b97de5bdb..d86e692286bec 100644
--- a/llvm/lib/Object/RelocationResolver.cpp
+++ b/llvm/lib/Object/RelocationResolver.cpp
@@ -572,7 +572,7 @@ static bool supportsWasm32(uint64_t Type) {
   case wasm::R_WASM_GLOBAL_INDEX_LEB:
   case wasm::R_WASM_FUNCTION_OFFSET_I32:
   case wasm::R_WASM_SECTION_OFFSET_I32:
-  case wasm::R_WASM_EVENT_INDEX_LEB:
+  case wasm::R_WASM_TAG_INDEX_LEB:
   case wasm::R_WASM_GLOBAL_INDEX_I32:
   case wasm::R_WASM_TABLE_NUMBER_LEB:
   case wasm::R_WASM_MEMORY_ADDR_LOCREL_I32:
@@ -609,7 +609,7 @@ static uint64_t resolveWasm32(uint64_t Type, uint64_t Offset, uint64_t S,
   case wasm::R_WASM_GLOBAL_INDEX_LEB:
   case wasm::R_WASM_FUNCTION_OFFSET_I32:
   case wasm::R_WASM_SECTION_OFFSET_I32:
-  case wasm::R_WASM_EVENT_INDEX_LEB:
+  case wasm::R_WASM_TAG_INDEX_LEB:
   case wasm::R_WASM_GLOBAL_INDEX_I32:
   case wasm::R_WASM_TABLE_NUMBER_LEB:
   case wasm::R_WASM_MEMORY_ADDR_LOCREL_I32:

diff  --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 38895e46d0e23..0f4eaa1a3555d 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -316,8 +316,8 @@ Error WasmObjectFile::parseSection(WasmSection &Sec) {
     return parseTableSection(Ctx);
   case wasm::WASM_SEC_MEMORY:
     return parseMemorySection(Ctx);
-  case wasm::WASM_SEC_EVENT:
-    return parseEventSection(Ctx);
+  case wasm::WASM_SEC_TAG:
+    return parseTagSection(Ctx);
   case wasm::WASM_SEC_GLOBAL:
     return parseGlobalSection(Ctx);
   case wasm::WASM_SEC_EXPORT:
@@ -507,19 +507,19 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
 
   std::vector<wasm::WasmImport *> ImportedGlobals;
   std::vector<wasm::WasmImport *> ImportedFunctions;
-  std::vector<wasm::WasmImport *> ImportedEvents;
+  std::vector<wasm::WasmImport *> ImportedTags;
   std::vector<wasm::WasmImport *> ImportedTables;
   ImportedGlobals.reserve(Imports.size());
   ImportedFunctions.reserve(Imports.size());
-  ImportedEvents.reserve(Imports.size());
+  ImportedTags.reserve(Imports.size());
   ImportedTables.reserve(Imports.size());
   for (auto &I : Imports) {
     if (I.Kind == wasm::WASM_EXTERNAL_FUNCTION)
       ImportedFunctions.emplace_back(&I);
     else if (I.Kind == wasm::WASM_EXTERNAL_GLOBAL)
       ImportedGlobals.emplace_back(&I);
-    else if (I.Kind == wasm::WASM_EXTERNAL_EVENT)
-      ImportedEvents.emplace_back(&I);
+    else if (I.Kind == wasm::WASM_EXTERNAL_TAG)
+      ImportedTags.emplace_back(&I);
     else if (I.Kind == wasm::WASM_EXTERNAL_TABLE)
       ImportedTables.emplace_back(&I);
   }
@@ -529,7 +529,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
     const wasm::WasmSignature *Signature = nullptr;
     const wasm::WasmGlobalType *GlobalType = nullptr;
     const wasm::WasmTableType *TableType = nullptr;
-    const wasm::WasmEventType *EventType = nullptr;
+    const wasm::WasmTagType *TagType = nullptr;
 
     Info.Kind = readUint8(Ctx);
     Info.Flags = readVaruint32(Ctx);
@@ -660,11 +660,11 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
       break;
     }
 
-    case wasm::WASM_SYMBOL_TYPE_EVENT: {
+    case wasm::WASM_SYMBOL_TYPE_TAG: {
       Info.ElementIndex = readVaruint32(Ctx);
-      if (!isValidEventIndex(Info.ElementIndex) ||
-          IsDefined != isDefinedEventIndex(Info.ElementIndex))
-        return make_error<GenericBinaryError>("invalid event symbol index",
+      if (!isValidTagIndex(Info.ElementIndex) ||
+          IsDefined != isDefinedTagIndex(Info.ElementIndex))
+        return make_error<GenericBinaryError>("invalid tag symbol index",
                                               object_error::parse_failed);
       if (!IsDefined && (Info.Flags & wasm::WASM_SYMBOL_BINDING_MASK) ==
                             wasm::WASM_SYMBOL_BINDING_WEAK)
@@ -672,23 +672,23 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
                                               object_error::parse_failed);
       if (IsDefined) {
         Info.Name = readString(Ctx);
-        unsigned EventIndex = Info.ElementIndex - NumImportedEvents;
-        wasm::WasmEvent &Event = Events[EventIndex];
-        Signature = &Signatures[Event.Type.SigIndex];
-        EventType = &Event.Type;
-        if (Event.SymbolName.empty())
-          Event.SymbolName = Info.Name;
+        unsigned TagIndex = Info.ElementIndex - NumImportedTags;
+        wasm::WasmTag &Tag = Tags[TagIndex];
+        Signature = &Signatures[Tag.Type.SigIndex];
+        TagType = &Tag.Type;
+        if (Tag.SymbolName.empty())
+          Tag.SymbolName = Info.Name;
 
       } else {
-        wasm::WasmImport &Import = *ImportedEvents[Info.ElementIndex];
+        wasm::WasmImport &Import = *ImportedTags[Info.ElementIndex];
         if ((Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) {
           Info.Name = readString(Ctx);
           Info.ImportName = Import.Field;
         } else {
           Info.Name = Import.Field;
         }
-        EventType = &Import.Event;
-        Signature = &Signatures[EventType->SigIndex];
+        TagType = &Import.Tag;
+        Signature = &Signatures[TagType->SigIndex];
         if (!Import.Module.empty()) {
           Info.ImportModule = Import.Module;
         }
@@ -710,7 +710,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
                                             object_error::parse_failed);
     LinkingData.SymbolTable.emplace_back(Info);
     Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType, TableType,
-                         EventType, Signature);
+                         TagType, Signature);
     LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n");
   }
 
@@ -899,9 +899,9 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) {
         return make_error<GenericBinaryError>("invalid relocation global index",
                                               object_error::parse_failed);
       break;
-    case wasm::R_WASM_EVENT_INDEX_LEB:
-      if (!isValidEventSymbol(Reloc.Index))
-        return make_error<GenericBinaryError>("invalid relocation event index",
+    case wasm::R_WASM_TAG_INDEX_LEB:
+      if (!isValidTagSymbol(Reloc.Index))
+        return make_error<GenericBinaryError>("invalid relocation tag index",
                                               object_error::parse_failed);
       break;
     case wasm::R_WASM_MEMORY_ADDR_LEB:
@@ -1064,10 +1064,10 @@ Error WasmObjectFile::parseImportSection(ReadContext &Ctx) {
                                               object_error::parse_failed);
       break;
     }
-    case wasm::WASM_EXTERNAL_EVENT:
-      NumImportedEvents++;
-      Im.Event.Attribute = readVarint32(Ctx);
-      Im.Event.SigIndex = readVarint32(Ctx);
+    case wasm::WASM_EXTERNAL_TAG:
+      NumImportedTags++;
+      Im.Tag.Attribute = readVarint32(Ctx);
+      Im.Tag.SigIndex = readVarint32(Ctx);
       break;
     default:
       return make_error<GenericBinaryError>("unexpected import kind",
@@ -1136,20 +1136,20 @@ Error WasmObjectFile::parseMemorySection(ReadContext &Ctx) {
   return Error::success();
 }
 
-Error WasmObjectFile::parseEventSection(ReadContext &Ctx) {
-  EventSection = Sections.size();
+Error WasmObjectFile::parseTagSection(ReadContext &Ctx) {
+  TagSection = Sections.size();
   uint32_t Count = readVaruint32(Ctx);
-  Events.reserve(Count);
+  Tags.reserve(Count);
   while (Count--) {
-    wasm::WasmEvent Event;
-    Event.Index = NumImportedEvents + Events.size();
-    Event.Type.Attribute = readVaruint32(Ctx);
-    Event.Type.SigIndex = readVaruint32(Ctx);
-    Events.push_back(Event);
+    wasm::WasmTag Tag;
+    Tag.Index = NumImportedTags + Tags.size();
+    Tag.Type.Attribute = readVaruint32(Ctx);
+    Tag.Type.SigIndex = readVaruint32(Ctx);
+    Tags.push_back(Tag);
   }
 
   if (Ctx.Ptr != Ctx.End)
-    return make_error<GenericBinaryError>("event section ended prematurely",
+    return make_error<GenericBinaryError>("tag section ended prematurely",
                                           object_error::parse_failed);
   return Error::success();
 }
@@ -1194,9 +1194,9 @@ Error WasmObjectFile::parseExportSection(ReadContext &Ctx) {
         return make_error<GenericBinaryError>("invalid global export",
                                               object_error::parse_failed);
       break;
-    case wasm::WASM_EXTERNAL_EVENT:
-      if (!isValidEventIndex(Ex.Index))
-        return make_error<GenericBinaryError>("invalid event export",
+    case wasm::WASM_EXTERNAL_TAG:
+      if (!isValidTagIndex(Ex.Index))
+        return make_error<GenericBinaryError>("invalid tag export",
                                               object_error::parse_failed);
       break;
     case wasm::WASM_EXTERNAL_MEMORY:
@@ -1238,12 +1238,12 @@ bool WasmObjectFile::isDefinedTableNumber(uint32_t Index) const {
   return Index >= NumImportedTables && isValidTableNumber(Index);
 }
 
-bool WasmObjectFile::isValidEventIndex(uint32_t Index) const {
-  return Index < NumImportedEvents + Events.size();
+bool WasmObjectFile::isValidTagIndex(uint32_t Index) const {
+  return Index < NumImportedTags + Tags.size();
 }
 
-bool WasmObjectFile::isDefinedEventIndex(uint32_t Index) const {
-  return Index >= NumImportedEvents && isValidEventIndex(Index);
+bool WasmObjectFile::isDefinedTagIndex(uint32_t Index) const {
+  return Index >= NumImportedTags && isValidTagIndex(Index);
 }
 
 bool WasmObjectFile::isValidFunctionSymbol(uint32_t Index) const {
@@ -1258,8 +1258,8 @@ bool WasmObjectFile::isValidGlobalSymbol(uint32_t Index) const {
   return Index < Symbols.size() && Symbols[Index].isTypeGlobal();
 }
 
-bool WasmObjectFile::isValidEventSymbol(uint32_t Index) const {
-  return Index < Symbols.size() && Symbols[Index].isTypeEvent();
+bool WasmObjectFile::isValidTagSymbol(uint32_t Index) const {
+  return Index < Symbols.size() && Symbols[Index].isTypeTag();
 }
 
 bool WasmObjectFile::isValidDataSymbol(uint32_t Index) const {
@@ -1286,9 +1286,9 @@ wasm::WasmGlobal &WasmObjectFile::getDefinedGlobal(uint32_t Index) {
   return Globals[Index - NumImportedGlobals];
 }
 
-wasm::WasmEvent &WasmObjectFile::getDefinedEvent(uint32_t Index) {
-  assert(isDefinedEventIndex(Index));
-  return Events[Index - NumImportedEvents];
+wasm::WasmTag &WasmObjectFile::getDefinedTag(uint32_t Index) {
+  assert(isDefinedTagIndex(Index));
+  return Tags[Index - NumImportedTags];
 }
 
 Error WasmObjectFile::parseStartSection(ReadContext &Ctx) {
@@ -1515,7 +1515,7 @@ uint64_t WasmObjectFile::getWasmSymbolValue(const WasmSymbol &Sym) const {
   switch (Sym.Info.Kind) {
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
   case wasm::WASM_SYMBOL_TYPE_GLOBAL:
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
   case wasm::WASM_SYMBOL_TYPE_TABLE:
     return Sym.Info.ElementIndex;
   case wasm::WASM_SYMBOL_TYPE_DATA: {
@@ -1564,7 +1564,7 @@ WasmObjectFile::getSymbolType(DataRefImpl Symb) const {
     return SymbolRef::ST_Data;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
     return SymbolRef::ST_Debug;
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
     return SymbolRef::ST_Other;
   case wasm::WASM_SYMBOL_TYPE_TABLE:
     return SymbolRef::ST_Other;
@@ -1600,8 +1600,8 @@ uint32_t WasmObjectFile::getSymbolSectionIdImpl(const WasmSymbol &Sym) const {
     return DataSection;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
     return Sym.Info.ElementIndex;
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
-    return EventSection;
+  case wasm::WASM_SYMBOL_TYPE_TAG:
+    return TagSection;
   case wasm::WASM_SYMBOL_TYPE_TABLE:
     return TableSection;
   default:
@@ -1623,7 +1623,7 @@ Expected<StringRef> WasmObjectFile::getSectionName(DataRefImpl Sec) const {
     ECase(TABLE);
     ECase(MEMORY);
     ECase(GLOBAL);
-    ECase(EVENT);
+    ECase(TAG);
     ECase(EXPORT);
     ECase(START);
     ECase(ELEM);
@@ -1822,8 +1822,8 @@ int WasmSectionOrderChecker::getSectionOrder(unsigned ID,
     return WASM_SEC_ORDER_DATA;
   case wasm::WASM_SEC_DATACOUNT:
     return WASM_SEC_ORDER_DATACOUNT;
-  case wasm::WASM_SEC_EVENT:
-    return WASM_SEC_ORDER_EVENT;
+  case wasm::WASM_SEC_TAG:
+    return WASM_SEC_ORDER_TAG;
   default:
     return WASM_SEC_ORDER_NONE;
   }
@@ -1845,9 +1845,9 @@ int WasmSectionOrderChecker::DisallowedPredecessors
         // WASM_SEC_ORDER_TABLE
         {WASM_SEC_ORDER_TABLE, WASM_SEC_ORDER_MEMORY},
         // WASM_SEC_ORDER_MEMORY
-        {WASM_SEC_ORDER_MEMORY, WASM_SEC_ORDER_EVENT},
-        // WASM_SEC_ORDER_EVENT
-        {WASM_SEC_ORDER_EVENT, WASM_SEC_ORDER_GLOBAL},
+        {WASM_SEC_ORDER_MEMORY, WASM_SEC_ORDER_TAG},
+        // WASM_SEC_ORDER_TAG
+        {WASM_SEC_ORDER_TAG, WASM_SEC_ORDER_GLOBAL},
         // WASM_SEC_ORDER_GLOBAL
         {WASM_SEC_ORDER_GLOBAL, WASM_SEC_ORDER_EXPORT},
         // WASM_SEC_ORDER_EXPORT

diff  --git a/llvm/lib/ObjectYAML/WasmEmitter.cpp b/llvm/lib/ObjectYAML/WasmEmitter.cpp
index acc5dff7369a5..888ba115e2d94 100644
--- a/llvm/lib/ObjectYAML/WasmEmitter.cpp
+++ b/llvm/lib/ObjectYAML/WasmEmitter.cpp
@@ -41,7 +41,7 @@ class WasmWriter {
   void writeSectionContent(raw_ostream &OS, WasmYAML::FunctionSection &Section);
   void writeSectionContent(raw_ostream &OS, WasmYAML::TableSection &Section);
   void writeSectionContent(raw_ostream &OS, WasmYAML::MemorySection &Section);
-  void writeSectionContent(raw_ostream &OS, WasmYAML::EventSection &Section);
+  void writeSectionContent(raw_ostream &OS, WasmYAML::TagSection &Section);
   void writeSectionContent(raw_ostream &OS, WasmYAML::GlobalSection &Section);
   void writeSectionContent(raw_ostream &OS, WasmYAML::ExportSection &Section);
   void writeSectionContent(raw_ostream &OS, WasmYAML::StartSection &Section);
@@ -61,7 +61,7 @@ class WasmWriter {
   uint32_t NumImportedFunctions = 0;
   uint32_t NumImportedGlobals = 0;
   uint32_t NumImportedTables = 0;
-  uint32_t NumImportedEvents = 0;
+  uint32_t NumImportedTags = 0;
 
   bool HasError = false;
   yaml::ErrorHandler ErrHandler;
@@ -189,7 +189,7 @@ void WasmWriter::writeSectionContent(raw_ostream &OS,
       case wasm::WASM_SYMBOL_TYPE_FUNCTION:
       case wasm::WASM_SYMBOL_TYPE_GLOBAL:
       case wasm::WASM_SYMBOL_TYPE_TABLE:
-      case wasm::WASM_SYMBOL_TYPE_EVENT:
+      case wasm::WASM_SYMBOL_TYPE_TAG:
         encodeULEB128(Info.ElementIndex, SubSection.getStream());
         if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 ||
             (Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0)
@@ -385,10 +385,10 @@ void WasmWriter::writeSectionContent(raw_ostream &OS,
       writeUint8(OS, Import.GlobalImport.Mutable);
       NumImportedGlobals++;
       break;
-    case wasm::WASM_EXTERNAL_EVENT:
-      writeUint32(OS, Import.EventImport.Attribute);
-      writeUint32(OS, Import.EventImport.SigIndex);
-      NumImportedEvents++;
+    case wasm::WASM_EXTERNAL_TAG:
+      writeUint32(OS, Import.TagImport.Attribute);
+      writeUint32(OS, Import.TagImport.SigIndex);
+      NumImportedTags++;
       break;
     case wasm::WASM_EXTERNAL_MEMORY:
       writeLimits(Import.Memory, OS);
@@ -450,17 +450,17 @@ void WasmWriter::writeSectionContent(raw_ostream &OS,
 }
 
 void WasmWriter::writeSectionContent(raw_ostream &OS,
-                                     WasmYAML::EventSection &Section) {
-  encodeULEB128(Section.Events.size(), OS);
-  uint32_t ExpectedIndex = NumImportedEvents;
-  for (auto &Event : Section.Events) {
-    if (Event.Index != ExpectedIndex) {
-      reportError("unexpected event index: " + Twine(Event.Index));
+                                     WasmYAML::TagSection &Section) {
+  encodeULEB128(Section.Tags.size(), OS);
+  uint32_t ExpectedIndex = NumImportedTags;
+  for (auto &Tag : Section.Tags) {
+    if (Tag.Index != ExpectedIndex) {
+      reportError("unexpected tag index: " + Twine(Tag.Index));
       return;
     }
     ++ExpectedIndex;
-    encodeULEB128(Event.Attribute, OS);
-    encodeULEB128(Event.SigIndex, OS);
+    encodeULEB128(Tag.Attribute, OS);
+    encodeULEB128(Tag.SigIndex, OS);
   }
 }
 
@@ -626,7 +626,7 @@ bool WasmWriter::writeWasm(raw_ostream &OS) {
       writeSectionContent(StringStream, *S);
     else if (auto S = dyn_cast<WasmYAML::MemorySection>(Sec.get()))
       writeSectionContent(StringStream, *S);
-    else if (auto S = dyn_cast<WasmYAML::EventSection>(Sec.get()))
+    else if (auto S = dyn_cast<WasmYAML::TagSection>(Sec.get()))
       writeSectionContent(StringStream, *S);
     else if (auto S = dyn_cast<WasmYAML::GlobalSection>(Sec.get()))
       writeSectionContent(StringStream, *S);

diff  --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp
index 6b7357c4d1d8e..752654ddbbaf1 100644
--- a/llvm/lib/ObjectYAML/WasmYAML.cpp
+++ b/llvm/lib/ObjectYAML/WasmYAML.cpp
@@ -120,9 +120,9 @@ static void sectionMapping(IO &IO, WasmYAML::MemorySection &Section) {
   IO.mapOptional("Memories", Section.Memories);
 }
 
-static void sectionMapping(IO &IO, WasmYAML::EventSection &Section) {
+static void sectionMapping(IO &IO, WasmYAML::TagSection &Section) {
   commonSectionMapping(IO, Section);
-  IO.mapOptional("Events", Section.Events);
+  IO.mapOptional("Tags", Section.Tags);
 }
 
 static void sectionMapping(IO &IO, WasmYAML::GlobalSection &Section) {
@@ -229,10 +229,10 @@ void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping(
       Section.reset(new WasmYAML::MemorySection());
     sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
     break;
-  case wasm::WASM_SEC_EVENT:
+  case wasm::WASM_SEC_TAG:
     if (!IO.outputting())
-      Section.reset(new WasmYAML::EventSection());
-    sectionMapping(IO, *cast<WasmYAML::EventSection>(Section.get()));
+      Section.reset(new WasmYAML::TagSection());
+    sectionMapping(IO, *cast<WasmYAML::TagSection>(Section.get()));
     break;
   case wasm::WASM_SEC_GLOBAL:
     if (!IO.outputting())
@@ -284,7 +284,7 @@ void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
   ECase(TABLE);
   ECase(MEMORY);
   ECase(GLOBAL);
-  ECase(EVENT);
+  ECase(TAG);
   ECase(EXPORT);
   ECase(START);
   ECase(ELEM);
@@ -396,9 +396,9 @@ void MappingTraits<WasmYAML::Import>::mapping(IO &IO,
   } else if (Import.Kind == wasm::WASM_EXTERNAL_GLOBAL) {
     IO.mapRequired("GlobalType", Import.GlobalImport.Type);
     IO.mapRequired("GlobalMutable", Import.GlobalImport.Mutable);
-  } else if (Import.Kind == wasm::WASM_EXTERNAL_EVENT) {
-    IO.mapRequired("EventAttribute", Import.EventImport.Attribute);
-    IO.mapRequired("EventSigIndex", Import.EventImport.SigIndex);
+  } else if (Import.Kind == wasm::WASM_EXTERNAL_TAG) {
+    IO.mapRequired("TagAttribute", Import.TagImport.Attribute);
+    IO.mapRequired("TagSigIndex", Import.TagImport.SigIndex);
   } else if (Import.Kind == wasm::WASM_EXTERNAL_TABLE) {
     IO.mapRequired("Table", Import.TableImport);
   } else if (Import.Kind == wasm::WASM_EXTERNAL_MEMORY) {
@@ -510,8 +510,8 @@ void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
     IO.mapRequired("Global", Info.ElementIndex);
   } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TABLE) {
     IO.mapRequired("Table", Info.ElementIndex);
-  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_EVENT) {
-    IO.mapRequired("Event", Info.ElementIndex);
+  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG) {
+    IO.mapRequired("Tag", Info.ElementIndex);
   } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_DATA) {
     if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) {
       IO.mapRequired("Segment", Info.DataRef.Segment);
@@ -525,10 +525,10 @@ void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
   }
 }
 
-void MappingTraits<WasmYAML::Event>::mapping(IO &IO, WasmYAML::Event &Event) {
-  IO.mapRequired("Index", Event.Index);
-  IO.mapRequired("Attribute", Event.Attribute);
-  IO.mapRequired("SigIndex", Event.SigIndex);
+void MappingTraits<WasmYAML::Tag>::mapping(IO &IO, WasmYAML::Tag &Tag) {
+  IO.mapRequired("Index", Tag.Index);
+  IO.mapRequired("Attribute", Tag.Attribute);
+  IO.mapRequired("SigIndex", Tag.SigIndex);
 }
 
 void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
@@ -572,7 +572,7 @@ void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
   ECase(GLOBAL);
   ECase(TABLE);
   ECase(SECTION);
-  ECase(EVENT);
+  ECase(TAG);
 #undef ECase
 }
 
@@ -597,7 +597,7 @@ void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
   ECase(TABLE);
   ECase(MEMORY);
   ECase(GLOBAL);
-  ECase(EVENT);
+  ECase(TAG);
 #undef ECase
 }
 

diff  --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index 424e8e6728dea..5003a843f35c3 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -899,7 +899,7 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
       TOut.emitImportName(WasmSym, ImportName);
     }
 
-    if (DirectiveID.getString() == ".eventtype") {
+    if (DirectiveID.getString() == ".tagtype") {
       auto SymName = expectIdent();
       if (SymName.empty())
         return true;
@@ -909,8 +909,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
         return true;
       WasmSym->setSignature(Signature.get());
       addSignature(std::move(Signature));
-      WasmSym->setType(wasm::WASM_SYMBOL_TYPE_EVENT);
-      TOut.emitEventType(WasmSym);
+      WasmSym->setType(wasm::WASM_SYMBOL_TYPE_TAG);
+      TOut.emitTagType(WasmSym);
       // TODO: backend also calls TOut.emitIndIdx, but that is not implemented.
       return expect(AsmToken::EndOfStatement, "EOL");
     }

diff  --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
index 174903ae51bed..6770ccc9df6ae 100644
--- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
+++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
@@ -203,7 +203,7 @@ MCDisassembler::DecodeStatus WebAssemblyDisassembler::getInstruction(
     case WebAssembly::OPERAND_OFFSET64:
     case WebAssembly::OPERAND_P2ALIGN:
     case WebAssembly::OPERAND_TYPEINDEX:
-    case WebAssembly::OPERAND_EVENT:
+    case WebAssembly::OPERAND_TAG:
     case MCOI::OPERAND_IMMEDIATE: {
       if (!parseLEBImmediate(MI, Size, Bytes, false))
         return MCDisassembler::Fail;

diff  --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
index e53c20203d35f..4961c2ef9529a 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
@@ -154,7 +154,7 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
       case WebAssembly::OPERAND_SIGNATURE:
       case WebAssembly::OPERAND_TYPEINDEX:
       case WebAssembly::OPERAND_GLOBAL:
-      case WebAssembly::OPERAND_EVENT:
+      case WebAssembly::OPERAND_TAG:
         FixupKind = MCFixupKind(WebAssembly::fixup_uleb128_i32);
         break;
       case WebAssembly::OPERAND_OFFSET64:

diff  --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
index 836c6fb81fea5..99defb42e3807 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
@@ -72,8 +72,8 @@ enum OperandType {
   OPERAND_SIGNATURE,
   /// type signature immediate for call_indirect.
   OPERAND_TYPEINDEX,
-  /// Event index.
-  OPERAND_EVENT,
+  /// Tag index.
+  OPERAND_TAG,
   /// A list of branch targets for br_list.
   OPERAND_BRLIST,
   /// 32-bit unsigned table number.

diff  --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
index fd45965f8ac5d..397b9b0ee9dad 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
@@ -91,9 +91,9 @@ void WebAssemblyTargetAsmStreamer::emitTableType(const MCSymbolWasm *Sym) {
   OS << '\n';
 }
 
-void WebAssemblyTargetAsmStreamer::emitEventType(const MCSymbolWasm *Sym) {
-  assert(Sym->isEvent());
-  OS << "\t.eventtype\t" << Sym->getName() << " ";
+void WebAssemblyTargetAsmStreamer::emitTagType(const MCSymbolWasm *Sym) {
+  assert(Sym->isTag());
+  OS << "\t.tagtype\t" << Sym->getName() << " ";
   OS << WebAssembly::typeListToString(Sym->getSignature()->Params);
   OS << "\n";
 }

diff  --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
index 80a8c8110fd1b..c0ad63c8dd509 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
@@ -42,8 +42,8 @@ class WebAssemblyTargetStreamer : public MCTargetStreamer {
   virtual void emitGlobalType(const MCSymbolWasm *Sym) = 0;
   /// .tabletype
   virtual void emitTableType(const MCSymbolWasm *Sym) = 0;
-  /// .eventtype
-  virtual void emitEventType(const MCSymbolWasm *Sym) = 0;
+  /// .tagtype
+  virtual void emitTagType(const MCSymbolWasm *Sym) = 0;
   /// .import_module
   virtual void emitImportModule(const MCSymbolWasm *Sym,
                                 StringRef ImportModule) = 0;
@@ -71,7 +71,7 @@ class WebAssemblyTargetAsmStreamer final : public WebAssemblyTargetStreamer {
   void emitIndIdx(const MCExpr *Value) override;
   void emitGlobalType(const MCSymbolWasm *Sym) override;
   void emitTableType(const MCSymbolWasm *Sym) override;
-  void emitEventType(const MCSymbolWasm *Sym) override;
+  void emitTagType(const MCSymbolWasm *Sym) override;
   void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override;
   void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override;
   void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName) override;
@@ -88,7 +88,7 @@ class WebAssemblyTargetWasmStreamer final : public WebAssemblyTargetStreamer {
   void emitIndIdx(const MCExpr *Value) override;
   void emitGlobalType(const MCSymbolWasm *Sym) override {}
   void emitTableType(const MCSymbolWasm *Sym) override {}
-  void emitEventType(const MCSymbolWasm *Sym) override {}
+  void emitTagType(const MCSymbolWasm *Sym) override {}
   void emitImportModule(const MCSymbolWasm *Sym,
                         StringRef ImportModule) override {}
   void emitImportName(const MCSymbolWasm *Sym,
@@ -109,7 +109,7 @@ class WebAssemblyTargetNullStreamer final : public WebAssemblyTargetStreamer {
   void emitIndIdx(const MCExpr *) override {}
   void emitGlobalType(const MCSymbolWasm *) override {}
   void emitTableType(const MCSymbolWasm *) override {}
-  void emitEventType(const MCSymbolWasm *) override {}
+  void emitTagType(const MCSymbolWasm *) override {}
   void emitImportModule(const MCSymbolWasm *, StringRef) override {}
   void emitImportName(const MCSymbolWasm *, StringRef) override {}
   void emitExportName(const MCSymbolWasm *, StringRef) override {}

diff  --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
index 9a2bd39a54a57..cd3465a1b3736 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
@@ -104,8 +104,8 @@ unsigned WebAssemblyWasmObjectWriter::getRelocType(const MCValue &Target,
       return wasm::R_WASM_GLOBAL_INDEX_LEB;
     if (SymA.isFunction())
       return wasm::R_WASM_FUNCTION_INDEX_LEB;
-    if (SymA.isEvent())
-      return wasm::R_WASM_EVENT_INDEX_LEB;
+    if (SymA.isTag())
+      return wasm::R_WASM_TAG_INDEX_LEB;
     if (SymA.isTable())
       return wasm::R_WASM_TABLE_NUMBER_LEB;
     return wasm::R_WASM_MEMORY_ADDR_LEB;

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index d9e56e9dceebb..d70c383b5743f 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -209,7 +209,7 @@ void WebAssemblyAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
 
 void WebAssemblyAsmPrinter::emitEndOfAsmFile(Module &M) {
   for (auto &It : OutContext.getSymbols()) {
-    // Emit .globaltype, .eventtype, or .tabletype declarations.
+    // Emit .globaltype, .tagtype, or .tabletype declarations.
     auto Sym = cast<MCSymbolWasm>(It.getValue());
     if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_GLOBAL) {
       // .globaltype already handled by emitGlobalVariable for defined
@@ -217,8 +217,8 @@ void WebAssemblyAsmPrinter::emitEndOfAsmFile(Module &M) {
       // written to the file.
       if (Sym->isUndefined())
         getTargetStreamer()->emitGlobalType(Sym);
-    } else if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_EVENT)
-      getTargetStreamer()->emitEventType(Sym);
+    } else if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_TAG)
+      getTargetStreamer()->emitTagType(Sym);
     else if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_TABLE)
       getTargetStreamer()->emitTableType(Sym);
   }

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
index dab516130a14d..437b07bf8baf1 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
@@ -129,8 +129,8 @@ let Predicates = [HasExceptionHandling] in {
 
 // Throwing an exception: throw / rethrow
 let isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in {
-defm THROW : I<(outs), (ins event_op:$tag, variable_ops),
-               (outs), (ins event_op:$tag),
+defm THROW : I<(outs), (ins tag_op:$tag, variable_ops),
+               (outs), (ins tag_op:$tag),
                [(WebAssemblythrow (WebAssemblywrapper texternalsym:$tag))],
                "throw   \t$tag", "throw   \t$tag", 0x08>;
 defm RETHROW : NRI<(outs), (ins i32imm:$depth), [], "rethrow \t$depth", 0x09>;
@@ -149,9 +149,9 @@ defm END_TRY : NRI<(outs), (ins), [], "end_try", 0x0b>;
 let hasCtrlDep = 1, hasSideEffects = 1 in {
 // Currently 'catch' can only extract an i32, which is sufficient for C++
 // support, but according to the spec 'catch' can extract any number of values
-// based on the event type.
-defm CATCH : I<(outs I32:$dst), (ins event_op:$tag),
-               (outs), (ins event_op:$tag),
+// based on the tag type.
+defm CATCH : I<(outs I32:$dst), (ins tag_op:$tag),
+               (outs), (ins tag_op:$tag),
                [(set I32:$dst,
                  (WebAssemblycatch (WebAssemblywrapper texternalsym:$tag)))],
                "catch   \t$dst, $tag", "catch   \t$tag", 0x07>;

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
index ac8ad84605f0b..62b34ee9da427 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
@@ -196,8 +196,8 @@ def P2Align : Operand<i32> {
   let PrintMethod = "printWebAssemblyP2AlignOperand";
 }
 
-let OperandType = "OPERAND_EVENT" in
-def event_op : Operand<i32>;
+let OperandType = "OPERAND_TAG" in
+def tag_op : Operand<i32>;
 
 } // OperandType = "OPERAND_P2ALIGN"
 

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index 2468df9ab4001..93e5f2300386e 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -116,11 +116,10 @@ MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
   SmallVector<wasm::ValType, 4> Returns;
   SmallVector<wasm::ValType, 4> Params;
   if (strcmp(Name, "__cpp_exception") == 0) {
-    WasmSym->setType(wasm::WASM_SYMBOL_TYPE_EVENT);
+    WasmSym->setType(wasm::WASM_SYMBOL_TYPE_TAG);
     // We can't confirm its signature index for now because there can be
     // imported exceptions. Set it to be 0 for now.
-    WasmSym->setEventType(
-        {wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION, /* SigIndex */ 0});
+    WasmSym->setTagType({wasm::WASM_TAG_ATTRIBUTE_EXCEPTION, /* SigIndex */ 0});
     // We may have multiple C++ compilation units to be linked together, each of
     // which defines the exception symbol. To resolve them, we declare them as
     // weak.
@@ -179,8 +178,8 @@ MCOperand WebAssemblyMCInstLower::lowerSymbolOperand(const MachineOperand &MO,
       report_fatal_error("Function addresses with offsets not supported");
     if (WasmSym->isGlobal())
       report_fatal_error("Global indexes with offsets not supported");
-    if (WasmSym->isEvent())
-      report_fatal_error("Event indexes with offsets not supported");
+    if (WasmSym->isTag())
+      report_fatal_error("Tag indexes with offsets not supported");
     if (WasmSym->isTable())
       report_fatal_error("Table indexes with offsets not supported");
 

diff  --git a/llvm/test/CodeGen/WebAssembly/exception.ll b/llvm/test/CodeGen/WebAssembly/exception.ll
index a6308205b21a8..7cd5225bf5691 100644
--- a/llvm/test/CodeGen/WebAssembly/exception.ll
+++ b/llvm/test/CodeGen/WebAssembly/exception.ll
@@ -372,4 +372,4 @@ attributes #0 = { nounwind }
 attributes #1 = { noreturn }
 
 ; CHECK: __cpp_exception:
-; CHECK: .eventtype  __cpp_exception i32
+; CHECK: .tagtype  __cpp_exception i32

diff  --git a/llvm/test/CodeGen/WebAssembly/null-streamer.ll b/llvm/test/CodeGen/WebAssembly/null-streamer.ll
index eb86075466289..2004b7df52e09 100644
--- a/llvm/test/CodeGen/WebAssembly/null-streamer.ll
+++ b/llvm/test/CodeGen/WebAssembly/null-streamer.ll
@@ -15,5 +15,5 @@ define i32 @test(i8* %p)  {
 }
 
 ; CHECK-DAG: .globaltype
-; CHECK-DAG: .eventtype
+; CHECK-DAG: .tagtype
 ; CHECK-DAG: .functype

diff  --git a/llvm/test/MC/WebAssembly/annotations.s b/llvm/test/MC/WebAssembly/annotations.s
index 9a797a17ad9fe..2d8de388b9895 100644
--- a/llvm/test/MC/WebAssembly/annotations.s
+++ b/llvm/test/MC/WebAssembly/annotations.s
@@ -8,7 +8,7 @@
   .type    test_annotation, at function
 test_annotation:
   .functype   test_annotation () -> ()
-  .eventtype  __cpp_exception i32
+  .tagtype  __cpp_exception i32
   try
   br        0
   catch     __cpp_exception

diff  --git a/llvm/test/MC/WebAssembly/basic-assembly.s b/llvm/test/MC/WebAssembly/basic-assembly.s
index a9ebe225f9652..a52bc3ed03261 100644
--- a/llvm/test/MC/WebAssembly/basic-assembly.s
+++ b/llvm/test/MC/WebAssembly/basic-assembly.s
@@ -12,7 +12,7 @@ test0:
 .Ltest0begin:
     # Test all types:
     .functype   test0 (i32, i64) -> (i32)
-    .eventtype  __cpp_exception i32
+    .tagtype  __cpp_exception i32
     .local      f32, f64, v128, v128
     # Explicit getlocal/setlocal:
     local.get   2
@@ -131,7 +131,7 @@ empty_fref_table:
 # CHECK-LABEL: test0:
 # CHECK-NEXT:  .Ltest0begin:
 # CHECK-NEXT:      .functype   test0 (i32, i64) -> (i32)
-# CHECK-NEXT:      .eventtype  __cpp_exception i32
+# CHECK-NEXT:      .tagtype  __cpp_exception i32
 # CHECK-NEXT:      .local      f32, f64
 # CHECK-NEXT:      local.get   2
 # CHECK-NEXT:      local.set   2

diff  --git a/llvm/test/MC/WebAssembly/event-section-decoding.ll b/llvm/test/MC/WebAssembly/tag-section-decoding.ll
similarity index 98%
rename from llvm/test/MC/WebAssembly/event-section-decoding.ll
rename to llvm/test/MC/WebAssembly/tag-section-decoding.ll
index 19a1ec6565687..9f40167798b4e 100644
--- a/llvm/test/MC/WebAssembly/event-section-decoding.ll
+++ b/llvm/test/MC/WebAssembly/tag-section-decoding.ll
@@ -1,9 +1,9 @@
 ; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o - | obj2yaml | FileCheck %s
 
-; This is a regression test for a decoding bug that happens when an event's
+; This is a regression test for a decoding bug that happens when a tag's
 ; sigindex is greater than 63, so we put 63 dummy functions with 
diff erent
 ; signatures before the function that contains the 'throw' instruction to make
-; the event's sigindex 64.
+; the tag's sigindex 64.
 
 target triple = "wasm32-unknown-unknown"
 
@@ -334,12 +334,12 @@ define i32 @test_throw(i8* %p) {
   ret i32 0
 }
 
-; Checks to see if the event index is correctly decoded in ULEB128. If it is
+; Checks to see if the tag index is correctly decoded in ULEB128. If it is
 ; decoded with LEB128, 64 will not be correctly decoded. 64 is the smallest
 ; number with which its LEB128 and ULEB128 encodings are 
diff erent, because its
 ; 7th least significant bit is not 0.
-; CHECK:      - Type:            EVENT
-; CHECK-NEXT:   Events:
+; CHECK:      - Type:            TAG
+; CHECK-NEXT:   Tags:
 ; CHECK-NEXT:     - Index:           0
 ; CHECK-NEXT:       Attribute:       0
 ; CHECK-NEXT:       SigIndex:        64

diff  --git a/llvm/test/MC/WebAssembly/event-section.ll b/llvm/test/MC/WebAssembly/tag-section.ll
similarity index 84%
rename from llvm/test/MC/WebAssembly/event-section.ll
rename to llvm/test/MC/WebAssembly/tag-section.ll
index 96487e88f935e..d0d7d3f8ed81f 100644
--- a/llvm/test/MC/WebAssembly/event-section.ll
+++ b/llvm/test/MC/WebAssembly/tag-section.ll
@@ -28,18 +28,18 @@ define i32 @test_throw1(i8* %p) {
 ; CHECK-NEXT:           - I32
 ; CHECK-NEXT:         ReturnTypes:      []
 
-; CHECK:        - Type:            EVENT
-; CHECK-NEXT:     Events:
+; CHECK:        - Type:            TAG
+; CHECK-NEXT:     Tags:
 ; CHECK-NEXT:       - Index:           0
 ; CHECK-NEXT:         Attribute:       0
 ; CHECK-NEXT:         SigIndex:        1
 
 ; CHECK-NEXT:   - Type:            CODE
 ; CHECK-NEXT:     Relocations:
-; CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
+; CHECK-NEXT:       - Type:            R_WASM_TAG_INDEX_LEB
 ; CHECK-NEXT:         Index:           1
 ; CHECK-NEXT:         Offset:          0x6
-; CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
+; CHECK-NEXT:       - Type:            R_WASM_TAG_INDEX_LEB
 ; CHECK-NEXT:         Index:           1
 ; CHECK-NEXT:         Offset:          0x11
 
@@ -49,11 +49,11 @@ define i32 @test_throw1(i8* %p) {
 ; CHECK-NEXT:     SymbolTable:
 
 ; CHECK:            - Index:           1
-; CHECK-NEXT:         Kind:            EVENT
+; CHECK-NEXT:         Kind:            TAG
 ; CHECK-NEXT:         Name:            __cpp_exception
 ; CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
-; CHECK-NEXT:         Event:           0
+; CHECK-NEXT:         Tag:             0
 
-; SEC:          Type: EVENT (0xD)
+; SEC:          Type: TAG (0xD)
 ; SEC-NEXT:     Size: 3
 ; SEC-NEXT:     Offset: 63

diff  --git a/llvm/test/ObjectYAML/wasm/event_section.yaml b/llvm/test/ObjectYAML/wasm/event_section.yaml
index 54f27d6c045b0..2eeaa73a27724 100644
--- a/llvm/test/ObjectYAML/wasm/event_section.yaml
+++ b/llvm/test/ObjectYAML/wasm/event_section.yaml
@@ -17,14 +17,14 @@ Sections:
         ReturnTypes:      []
   - Type:            FUNCTION
     FunctionTypes:   [ 0 ]
-  - Type:            EVENT
-    Events:
+  - Type:            TAG
+    Tags:
       - Index:           0
         Attribute:       0
         SigIndex:        1
   - Type:            CODE
     Relocations:
-      - Type:            R_WASM_EVENT_INDEX_LEB
+      - Type:            R_WASM_TAG_INDEX_LEB
         Index:           1
         Offset:          0x00000006
       - Type:            10
@@ -44,10 +44,10 @@ Sections:
         Flags:           [  ]
         Function:        0
       - Index:           1
-        Kind:            EVENT
+        Kind:            TAG
         Name:            __cpp_exception
         Flags:           [ BINDING_WEAK ]
-        Event:           0
+        Tag:             0
 ...
 
 # CHECK:      --- !WASM
@@ -67,17 +67,17 @@ Sections:
 # CHECK-NEXT:         ReturnTypes:     []
 # CHECK-NEXT:   - Type:            FUNCTION
 # CHECK-NEXT:     FunctionTypes:   [ 0 ]
-# CHECK-NEXT:   - Type:            EVENT
-# CHECK-NEXT:     Events:
+# CHECK-NEXT:   - Type:            TAG
+# CHECK-NEXT:     Tags:
 # CHECK-NEXT:       - Index:           0
 # CHECK-NEXT:         Attribute:       0
 # CHECK-NEXT:         SigIndex:        1
 # CHECK-NEXT:   - Type:            CODE
 # CHECK-NEXT:     Relocations:
-# CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
+# CHECK-NEXT:       - Type:            R_WASM_TAG_INDEX_LEB
 # CHECK-NEXT:         Index:           1
 # CHECK-NEXT:         Offset:          0x6
-# CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
+# CHECK-NEXT:       - Type:            R_WASM_TAG_INDEX_LEB
 # CHECK-NEXT:         Index:           1
 # CHECK-NEXT:         Offset:          0x6
 # CHECK-NEXT:     Functions:
@@ -94,7 +94,7 @@ Sections:
 # CHECK-NEXT:         Flags:           [  ]
 # CHECK-NEXT:         Function:        0
 # CHECK-NEXT:       - Index:           1
-# CHECK-NEXT:         Kind:            EVENT
+# CHECK-NEXT:         Kind:            TAG
 # CHECK-NEXT:         Name:            __cpp_exception
 # CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
-# CHECK-NEXT:         Event:           0
+# CHECK-NEXT:         Tag:             0

diff  --git a/llvm/tools/llvm-readobj/WasmDumper.cpp b/llvm/tools/llvm-readobj/WasmDumper.cpp
index 0ee8c69122e98..f7dcaa35656f1 100644
--- a/llvm/tools/llvm-readobj/WasmDumper.cpp
+++ b/llvm/tools/llvm-readobj/WasmDumper.cpp
@@ -23,8 +23,8 @@ namespace {
 static const EnumEntry<unsigned> WasmSymbolTypes[] = {
 #define ENUM_ENTRY(X)                                                          \
   { #X, wasm::WASM_SYMBOL_TYPE_##X }
-    ENUM_ENTRY(FUNCTION), ENUM_ENTRY(DATA),  ENUM_ENTRY(GLOBAL),
-    ENUM_ENTRY(SECTION),  ENUM_ENTRY(EVENT), ENUM_ENTRY(TABLE),
+    ENUM_ENTRY(FUNCTION), ENUM_ENTRY(DATA), ENUM_ENTRY(GLOBAL),
+    ENUM_ENTRY(SECTION),  ENUM_ENTRY(TAG),  ENUM_ENTRY(TABLE),
 #undef ENUM_ENTRY
 };
 
@@ -33,7 +33,7 @@ static const EnumEntry<uint32_t> WasmSectionTypes[] = {
   { #X, wasm::WASM_SEC_##X }
     ENUM_ENTRY(CUSTOM),   ENUM_ENTRY(TYPE),      ENUM_ENTRY(IMPORT),
     ENUM_ENTRY(FUNCTION), ENUM_ENTRY(TABLE),     ENUM_ENTRY(MEMORY),
-    ENUM_ENTRY(GLOBAL),   ENUM_ENTRY(EVENT),     ENUM_ENTRY(EXPORT),
+    ENUM_ENTRY(GLOBAL),   ENUM_ENTRY(TAG),       ENUM_ENTRY(EXPORT),
     ENUM_ENTRY(START),    ENUM_ENTRY(ELEM),      ENUM_ENTRY(CODE),
     ENUM_ENTRY(DATA),     ENUM_ENTRY(DATACOUNT),
 #undef ENUM_ENTRY

diff  --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index ff36711c44d15..5b4f672dd4d45 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -132,7 +132,7 @@ WasmDumper::dumpCustomSection(const WasmSection &WasmSec) {
       case wasm::WASM_SYMBOL_TYPE_FUNCTION:
       case wasm::WASM_SYMBOL_TYPE_GLOBAL:
       case wasm::WASM_SYMBOL_TYPE_TABLE:
-      case wasm::WASM_SYMBOL_TYPE_EVENT:
+      case wasm::WASM_SYMBOL_TYPE_TAG:
         Info.ElementIndex = Symbol.ElementIndex;
         break;
       case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -238,9 +238,9 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
           Im.GlobalImport.Type = Import.Global.Type;
           Im.GlobalImport.Mutable = Import.Global.Mutable;
           break;
-        case wasm::WASM_EXTERNAL_EVENT:
-          Im.EventImport.Attribute = Import.Event.Attribute;
-          Im.EventImport.SigIndex = Import.Event.SigIndex;
+        case wasm::WASM_EXTERNAL_TAG:
+          Im.TagImport.Attribute = Import.Tag.Attribute;
+          Im.TagImport.SigIndex = Import.Tag.SigIndex;
           break;
         case wasm::WASM_EXTERNAL_TABLE:
           // FIXME: Currently we always output an index of 0 for any imported
@@ -280,16 +280,16 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
       S = std::move(MemorySec);
       break;
     }
-    case wasm::WASM_SEC_EVENT: {
-      auto EventSec = std::make_unique<WasmYAML::EventSection>();
-      for (auto &Event : Obj.events()) {
-        WasmYAML::Event E;
-        E.Index = Event.Index;
-        E.Attribute = Event.Type.Attribute;
-        E.SigIndex = Event.Type.SigIndex;
-        EventSec->Events.push_back(E);
+    case wasm::WASM_SEC_TAG: {
+      auto TagSec = std::make_unique<WasmYAML::TagSection>();
+      for (auto &Tag : Obj.tags()) {
+        WasmYAML::Tag T;
+        T.Index = Tag.Index;
+        T.Attribute = Tag.Type.Attribute;
+        T.SigIndex = Tag.Type.SigIndex;
+        TagSec->Tags.push_back(T);
       }
-      S = std::move(EventSec);
+      S = std::move(TagSec);
       break;
     }
     case wasm::WASM_SEC_GLOBAL: {


        


More information about the llvm-commits mailing list