Index: include/llvm/BinaryFormat/WasmRelocs.def =================================================================== --- include/llvm/BinaryFormat/WasmRelocs.def +++ include/llvm/BinaryFormat/WasmRelocs.def @@ -8,7 +8,7 @@ WASM_RELOC(R_WEBASSEMBLY_MEMORY_ADDR_LEB, 3) WASM_RELOC(R_WEBASSEMBLY_MEMORY_ADDR_SLEB, 4) WASM_RELOC(R_WEBASSEMBLY_MEMORY_ADDR_I32, 5) -WASM_RELOC(R_WEBASSEMBLY_TYPE_INDEX_LEB, 6) +WASM_RELOC(R_WEBASSEMBLY_SIGNATURE_INDEX_LEB, 6) WASM_RELOC(R_WEBASSEMBLY_GLOBAL_INDEX_LEB, 7) WASM_RELOC(R_WEBASSEMBLY_FUNCTION_OFFSET_I32, 8) WASM_RELOC(R_WEBASSEMBLY_SECTION_OFFSET_I32, 9) Index: include/llvm/Object/RelocVisitor.h =================================================================== --- include/llvm/Object/RelocVisitor.h +++ include/llvm/Object/RelocVisitor.h @@ -329,7 +329,7 @@ case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB: case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB: case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32: - case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB: + case wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB: case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB: case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32: case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32: Index: include/llvm/Object/Wasm.h =================================================================== --- include/llvm/Object/Wasm.h +++ include/llvm/Object/Wasm.h @@ -37,14 +37,14 @@ class WasmSymbol { public: WasmSymbol(const wasm::WasmSymbolInfo &Info, - const wasm::WasmSignature *FunctionType, + const wasm::WasmSignature *FunctionSig, const wasm::WasmGlobalType *GlobalType, const wasm::WasmEventType *EventType) - : Info(Info), FunctionType(FunctionType), GlobalType(GlobalType), + : Info(Info), FunctionSig(FunctionSig), GlobalType(GlobalType), EventType(EventType) {} const wasm::WasmSymbolInfo &Info; - const wasm::WasmSignature *FunctionType; + const wasm::WasmSignature *FunctionSig; const wasm::WasmGlobalType *GlobalType; const wasm::WasmEventType *EventType; @@ -130,8 +130,8 @@ static bool classof(const Binary *v) { return v->isWasm(); } const wasm::WasmDylinkInfo &dylinkInfo() const { return DylinkInfo; } - ArrayRef types() const { return Signatures; } - ArrayRef functionTypes() const { return FunctionTypes; } + ArrayRef signatures() const { return Signatures; } + ArrayRef functionSigIndices() const { return FunctionSigIndices; } ArrayRef imports() const { return Imports; } ArrayRef tables() const { return Tables; } ArrayRef memories() const { return Memories; } @@ -257,7 +257,7 @@ std::vector Sections; wasm::WasmDylinkInfo DylinkInfo; std::vector Signatures; - std::vector FunctionTypes; + std::vector FunctionSigIndices; std::vector Tables; std::vector Memories; std::vector Globals; Index: include/llvm/ObjectYAML/WasmYAML.h =================================================================== --- include/llvm/ObjectYAML/WasmYAML.h +++ include/llvm/ObjectYAML/WasmYAML.h @@ -250,7 +250,7 @@ return S->Type == wasm::WASM_SEC_FUNCTION; } - std::vector FunctionTypes; + std::vector FunctionSigIndices; }; struct TableSection : Section { Index: lib/MC/WasmObjectWriter.cpp =================================================================== --- lib/MC/WasmObjectWriter.cpp +++ lib/MC/WasmObjectWriter.cpp @@ -209,9 +209,9 @@ std::vector DataRelocations; uint32_t DataSectionIndex; - // Index values to use for fixing up call_indirect type indices. - // Maps function symbols to the index of the type of the function - DenseMap TypeIndices; + // Index values to use for fixing up call_indirect signature indices. + // Maps function symbols to the index of the signature of the function + DenseMap SignatureIndices; // Maps function symbols to the table element index space. Used // for TABLE_INDEX relocation types (i.e. address taken functions). DenseMap TableIndices; @@ -231,7 +231,8 @@ // Map from section to defining function symbol. DenseMap SectionFunctions; - DenseMap SignatureIndices; + DenseMap + SignatureIndexMap; SmallVector Signatures; SmallVector Globals; SmallVector DataSegments; @@ -261,12 +262,12 @@ void reset() override { CodeRelocations.clear(); DataRelocations.clear(); - TypeIndices.clear(); + SignatureIndices.clear(); WasmIndices.clear(); TableIndices.clear(); DataLocations.clear(); CustomSectionsRelocations.clear(); - SignatureIndices.clear(); + SignatureIndexMap.clear(); Signatures.clear(); Globals.clear(); DataSegments.clear(); @@ -322,10 +323,10 @@ uint64_t ContentsOffset); uint32_t getRelocationIndexValue(const WasmRelocationEntry &RelEntry); - uint32_t getFunctionType(const MCSymbolWasm &Symbol); - uint32_t getEventType(const MCSymbolWasm &Symbol); - void registerFunctionType(const MCSymbolWasm &Symbol); - void registerEventType(const MCSymbolWasm &Symbol); + uint32_t getFunctionSigIndex(const MCSymbolWasm &Symbol); + uint32_t getEventSigIndex(const MCSymbolWasm &Symbol); + void registerFunctionSignature(const MCSymbolWasm &Symbol); + void registerEventSignature(const MCSymbolWasm &Symbol); }; } // end anonymous namespace @@ -505,9 +506,9 @@ SymA = cast(SectionSymbol); } - // Relocation other than R_WEBASSEMBLY_TYPE_INDEX_LEB are required to be + // Relocation other than R_WEBASSEMBLY_SIGNATURE_INDEX_LEB are required to be // against a named symbol. - if (Type != wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) { + if (Type != wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB) { if (SymA->getName().empty()) report_fatal_error("relocations against un-named temporaries are not yet " "supported by wasm"); @@ -579,7 +580,7 @@ assert(Sym->isFunction()); return TableIndices[Sym]; } - case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB: + case wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB: // Provisional value is same as the index return getRelocationIndexValue(RelEntry); case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB: @@ -654,11 +655,11 @@ uint32_t WasmObjectWriter::getRelocationIndexValue(const WasmRelocationEntry &RelEntry) { - if (RelEntry.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) { - if (!TypeIndices.count(RelEntry.Symbol)) + if (RelEntry.Type == wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB) { + if (!SignatureIndices.count(RelEntry.Symbol)) report_fatal_error("symbol not found in type index space: " + RelEntry.Symbol->getName()); - return TypeIndices[RelEntry.Symbol]; + return SignatureIndices[RelEntry.Symbol]; } return RelEntry.Symbol->getIndex(); @@ -679,7 +680,7 @@ switch (RelEntry.Type) { case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB: - case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB: + case wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB: case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB: case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB: case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB: @@ -1066,19 +1067,19 @@ } } -uint32_t WasmObjectWriter::getFunctionType(const MCSymbolWasm &Symbol) { +uint32_t WasmObjectWriter::getFunctionSigIndex(const MCSymbolWasm &Symbol) { assert(Symbol.isFunction()); - assert(TypeIndices.count(&Symbol)); - return TypeIndices[&Symbol]; + assert(SignatureIndices.count(&Symbol)); + return SignatureIndices[&Symbol]; } -uint32_t WasmObjectWriter::getEventType(const MCSymbolWasm &Symbol) { +uint32_t WasmObjectWriter::getEventSigIndex(const MCSymbolWasm &Symbol) { assert(Symbol.isEvent()); - assert(TypeIndices.count(&Symbol)); - return TypeIndices[&Symbol]; + assert(SignatureIndices.count(&Symbol)); + return SignatureIndices[&Symbol]; } -void WasmObjectWriter::registerFunctionType(const MCSymbolWasm &Symbol) { +void WasmObjectWriter::registerFunctionSignature(const MCSymbolWasm &Symbol) { assert(Symbol.isFunction()); WasmSignature S; @@ -1088,17 +1089,17 @@ S.Params = Sig->Params; } - auto Pair = SignatureIndices.insert(std::make_pair(S, Signatures.size())); + auto Pair = SignatureIndexMap.insert(std::make_pair(S, Signatures.size())); if (Pair.second) Signatures.push_back(S); - TypeIndices[&Symbol] = Pair.first->second; + SignatureIndices[&Symbol] = Pair.first->second; - LLVM_DEBUG(dbgs() << "registerFunctionType: " << Symbol + LLVM_DEBUG(dbgs() << "registerFunctionSignature: " << Symbol << " new:" << Pair.second << "\n"); LLVM_DEBUG(dbgs() << " -> type index: " << Pair.first->second << "\n"); } -void WasmObjectWriter::registerEventType(const MCSymbolWasm &Symbol) { +void WasmObjectWriter::registerEventSignature(const MCSymbolWasm &Symbol) { assert(Symbol.isEvent()); // TODO Currently we don't generate imported exceptions, but if we do, we @@ -1109,13 +1110,13 @@ S.Params = Sig->Params; } - auto Pair = SignatureIndices.insert(std::make_pair(S, Signatures.size())); + auto Pair = SignatureIndexMap.insert(std::make_pair(S, Signatures.size())); if (Pair.second) Signatures.push_back(S); - TypeIndices[&Symbol] = Pair.first->second; + SignatureIndices[&Symbol] = Pair.first->second; - LLVM_DEBUG(dbgs() << "registerEventType: " << Symbol << " new:" << Pair.second - << "\n"); + LLVM_DEBUG(dbgs() << "registerEventSignature: " << Symbol + << " new:" << Pair.second << "\n"); LLVM_DEBUG(dbgs() << " -> type index: " << Pair.first->second << "\n"); } @@ -1179,7 +1180,7 @@ TableImport.Table.ElemType = wasm::WASM_TYPE_ANYFUNC; Imports.push_back(TableImport); - // Populate SignatureIndices, and Imports and WasmIndices for undefined + // Populate SignatureIndexMap, and Imports and WasmIndices for undefined // symbols. This must be done before populating WasmIndices for defined // symbols. for (const MCSymbol &S : Asm.symbols()) { @@ -1188,10 +1189,10 @@ // Register types for all functions, including those with private linkage // (because wasm always needs a type signature). if (WS.isFunction()) - registerFunctionType(WS); + registerFunctionSignature(WS); if (WS.isEvent()) - registerEventType(WS); + registerEventSignature(WS); if (WS.isTemporary()) continue; @@ -1203,7 +1204,7 @@ Import.Module = WS.getModuleName(); Import.Field = WS.getName(); Import.Kind = wasm::WASM_EXTERNAL_FUNCTION; - Import.SigIndex = getFunctionType(WS); + Import.SigIndex = getFunctionSigIndex(WS); Imports.push_back(Import); WasmIndices[&WS] = NumFunctionImports++; } else if (WS.isGlobal()) { @@ -1226,7 +1227,7 @@ Import.Field = WS.getName(); Import.Kind = wasm::WASM_EXTERNAL_EVENT; Import.Event.Attribute = wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION; - Import.Event.SigIndex = getEventType(WS); + Import.Event.SigIndex = getEventSigIndex(WS); Imports.push_back(Import); WasmIndices[&WS] = NumEventImports++; } @@ -1320,7 +1321,7 @@ // A definition. Write out the function body. Index = NumFunctionImports + Functions.size(); WasmFunction Func; - Func.SigIndex = getFunctionType(WS); + Func.SigIndex = getFunctionSigIndex(WS); Func.Sym = &WS; WasmIndices[&WS] = Index; Functions.push_back(Func); @@ -1382,7 +1383,7 @@ if (WS.isDefined()) { Index = NumEventImports + Events.size(); wasm::WasmEventType Event; - Event.SigIndex = getEventType(WS); + Event.SigIndex = getEventSigIndex(WS); Event.Attribute = wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION; WasmIndices[&WS] = Index; Events.push_back(Event); @@ -1480,7 +1481,7 @@ LLVM_DEBUG(dbgs() << " -> adding " << WS.getName() << " to table: " << TableIndex << "\n"); TableElems.push_back(FunctionIndex); - registerFunctionType(WS); + registerFunctionSignature(WS); } }; Index: lib/Object/WasmObjectFile.cpp =================================================================== --- lib/Object/WasmObjectFile.cpp +++ lib/Object/WasmObjectFile.cpp @@ -327,7 +327,7 @@ Error WasmObjectFile::parseNameSection(ReadContext &Ctx) { llvm::DenseSet Seen; - if (Functions.size() != FunctionTypes.size()) { + if (Functions.size() != FunctionSigIndices.size()) { return make_error("Names must come after code section", object_error::parse_failed); } @@ -373,7 +373,7 @@ Error WasmObjectFile::parseLinkingSection(ReadContext &Ctx) { HasLinkingSection = true; - if (Functions.size() != FunctionTypes.size()) { + if (Functions.size() != FunctionSigIndices.size()) { return make_error( "Linking data must come after code section", object_error::parse_failed); @@ -468,7 +468,7 @@ while (Count--) { wasm::WasmSymbolInfo Info; - const wasm::WasmSignature *FunctionType = nullptr; + const wasm::WasmSignature *FunctionSig = nullptr; const wasm::WasmGlobalType *GlobalType = nullptr; const wasm::WasmEventType *EventType = nullptr; @@ -486,13 +486,13 @@ if (IsDefined) { Info.Name = readString(Ctx); unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions; - FunctionType = &Signatures[FunctionTypes[FuncIndex]]; + FunctionSig = &Signatures[FunctionSigIndices[FuncIndex]]; wasm::WasmFunction &Function = Functions[FuncIndex]; if (Function.SymbolName.empty()) Function.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; - FunctionType = &Signatures[Import.SigIndex]; + FunctionSig = &Signatures[Import.SigIndex]; Info.Name = Import.Field; Info.Module = Import.Module; } @@ -589,7 +589,7 @@ Twine(Info.Name), object_error::parse_failed); LinkingData.SymbolTable.emplace_back(Info); - Symbols.emplace_back(LinkingData.SymbolTable.back(), FunctionType, + Symbols.emplace_back(LinkingData.SymbolTable.back(), FunctionSig, GlobalType, EventType); LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n"); } @@ -670,7 +670,7 @@ return make_error("Bad relocation function index", object_error::parse_failed); break; - case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB: + case wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB: if (Reloc.Index >= Signatures.size()) return make_error("Bad relocation type index", object_error::parse_failed); @@ -827,14 +827,14 @@ Error WasmObjectFile::parseFunctionSection(ReadContext &Ctx) { uint32_t Count = readVaruint32(Ctx); - FunctionTypes.reserve(Count); - uint32_t NumTypes = Signatures.size(); + FunctionSigIndices.reserve(Count); + uint32_t NumSigs = Signatures.size(); while (Count--) { - uint32_t Type = readVaruint32(Ctx); - if (Type >= NumTypes) + uint32_t SigIndex = readVaruint32(Ctx); + if (SigIndex >= NumSigs) return make_error("Invalid function type", object_error::parse_failed); - FunctionTypes.push_back(Type); + FunctionSigIndices.push_back(SigIndex); } if (Ctx.Ptr != Ctx.End) return make_error("Function section ended prematurely", @@ -947,7 +947,7 @@ } bool WasmObjectFile::isValidFunctionIndex(uint32_t Index) const { - return Index < NumImportedFunctions + FunctionTypes.size(); + return Index < NumImportedFunctions + FunctionSigIndices.size(); } bool WasmObjectFile::isDefinedFunctionIndex(uint32_t Index) const { @@ -1016,7 +1016,7 @@ Error WasmObjectFile::parseCodeSection(ReadContext &Ctx) { CodeSection = Sections.size(); uint32_t FunctionCount = readVaruint32(Ctx); - if (FunctionCount != FunctionTypes.size()) { + if (FunctionCount != FunctionSigIndices.size()) { return make_error("Invalid function count", object_error::parse_failed); } @@ -1347,7 +1347,7 @@ symbol_iterator WasmObjectFile::getRelocationSymbol(DataRefImpl Ref) const { const wasm::WasmRelocation &Rel = getWasmRelocation(Ref); - if (Rel.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) + if (Rel.Type == wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB) return symbol_end(); DataRefImpl Sym; Sym.d.a = Rel.Index; Index: lib/ObjectYAML/WasmYAML.cpp =================================================================== --- lib/ObjectYAML/WasmYAML.cpp +++ lib/ObjectYAML/WasmYAML.cpp @@ -91,7 +91,7 @@ static void sectionMapping(IO &IO, WasmYAML::FunctionSection &Section) { commonSectionMapping(IO, Section); - IO.mapOptional("FunctionTypes", Section.FunctionTypes); + IO.mapOptional("FunctionSignatures", Section.FunctionSigIndices); } static void sectionMapping(IO &IO, WasmYAML::TableSection &Section) { Index: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp =================================================================== --- lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp +++ lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp @@ -108,7 +108,7 @@ if (IsGlobalType(Target)) return wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB; if (IsFunctionType(Target)) - return wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB; + return wasm::R_WEBASSEMBLY_SIGNATURE_INDEX_LEB; if (IsFunction) return wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB; if (IsEventType(Target)) Index: test/MC/WebAssembly/comdat.ll =================================================================== --- test/MC/WebAssembly/comdat.ll +++ test/MC/WebAssembly/comdat.ll @@ -49,7 +49,7 @@ ; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: SigIndex: 0 ; CHECK-NEXT: - Type: FUNCTION -; CHECK-NEXT: FunctionTypes: [ 0, 0, 0 ] +; CHECK-NEXT: FunctionSignatures: [ 0, 0, 0 ] ; CHECK-NEXT: - Type: CODE ; CHECK-NEXT: Relocations: ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB Index: test/MC/WebAssembly/global-ctor-dtor.ll =================================================================== --- test/MC/WebAssembly/global-ctor-dtor.ll +++ test/MC/WebAssembly/global-ctor-dtor.ll @@ -54,7 +54,7 @@ ; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: SigIndex: 1 ; CHECK-NEXT: - Type: FUNCTION -; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 1 ] +; CHECK-NEXT: FunctionSignatures: [ 0, 1, 0, 1 ] ; CHECK-NEXT: - Type: ELEM ; CHECK-NEXT: Segments: ; CHECK-NEXT: - Offset: Index: test/MC/WebAssembly/reloc-code.ll =================================================================== --- test/MC/WebAssembly/reloc-code.ll +++ test/MC/WebAssembly/reloc-code.ll @@ -38,12 +38,12 @@ ; CHECK-NEXT: Addend: 0 ; CHECK-NEXT: } ; CHECK-NEXT: Relocation { -; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6) +; CHECK-NEXT: Type: R_WEBASSEMBLY_SIGNATURE_INDEX_LEB (6) ; CHECK-NEXT: Offset: 0x1A ; CHECK-NEXT: Index: 0x1 ; CHECK-NEXT: } ; CHECK-NEXT: Relocation { -; CHECK-NEXT: Type: R_WEBASSEMBLY_TYPE_INDEX_LEB (6) +; CHECK-NEXT: Type: R_WEBASSEMBLY_SIGNATURE_INDEX_LEB (6) ; CHECK-NEXT: Offset: 0x24 ; CHECK-NEXT: Index: 0x0 ; CHECK-NEXT: } Index: test/MC/WebAssembly/weak-alias.ll =================================================================== --- test/MC/WebAssembly/weak-alias.ll +++ test/MC/WebAssembly/weak-alias.ll @@ -66,7 +66,7 @@ ; CHECK-NEXT: Limits: ; CHECK-NEXT: Initial: 0x00000001 ; CHECK-NEXT: - Type: FUNCTION -; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0 ] +; CHECK-NEXT: FunctionSignatures: [ 0, 0, 0, 0, 0 ] ; CHECK-NEXT: - Type: ELEM ; CHECK-NEXT: Segments: ; CHECK-NEXT: - Offset: @@ -84,13 +84,13 @@ ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB ; CHECK-NEXT: Index: 5 ; CHECK-NEXT: Offset: 0x0000001E -; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB +; CHECK-NEXT: - Type: R_WEBASSEMBLY_SIGNATURE_INDEX_LEB ; CHECK-NEXT: Index: 0 ; CHECK-NEXT: Offset: 0x00000024 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB ; CHECK-NEXT: Index: 7 ; CHECK-NEXT: Offset: 0x00000031 -; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB +; CHECK-NEXT: - Type: R_WEBASSEMBLY_SIGNATURE_INDEX_LEB ; CHECK-NEXT: Index: 0 ; CHECK-NEXT: Offset: 0x00000037 ; CHECK-NEXT: Functions: Index: test/ObjectYAML/wasm/code_section.yaml =================================================================== --- test/ObjectYAML/wasm/code_section.yaml +++ test/ObjectYAML/wasm/code_section.yaml @@ -15,7 +15,7 @@ - I32 - I64 - Type: FUNCTION - FunctionTypes: + FunctionSignatures: - 0 - 1 - Type: CODE Index: test/ObjectYAML/wasm/event_section.yaml =================================================================== --- test/ObjectYAML/wasm/event_section.yaml +++ test/ObjectYAML/wasm/event_section.yaml @@ -15,7 +15,7 @@ ParamTypes: - I32 - Type: FUNCTION - FunctionTypes: [ 0 ] + FunctionSignatures: [ 0 ] - Type: EVENT Events: - Index: 0 @@ -61,7 +61,7 @@ # CHECK-NEXT: ParamTypes: # CHECK-NEXT: - I32 # CHECK-NEXT: - Type: FUNCTION -# CHECK-NEXT: FunctionTypes: [ 0 ] +# CHECK-NEXT: FunctionSignatures: [ 0 ] # CHECK-NEXT: - Type: EVENT # CHECK-NEXT: Events: # CHECK-NEXT: - Index: 0 Index: test/ObjectYAML/wasm/export_section.yaml =================================================================== --- test/ObjectYAML/wasm/export_section.yaml +++ test/ObjectYAML/wasm/export_section.yaml @@ -9,7 +9,7 @@ ReturnType: NORESULT ParamTypes: - Type: FUNCTION - FunctionTypes: [ 0, 0 ] + FunctionSignatures: [ 0, 0 ] - Type: GLOBAL Globals: - Index: 0 Index: test/ObjectYAML/wasm/function_section.yaml =================================================================== --- test/ObjectYAML/wasm/function_section.yaml +++ test/ObjectYAML/wasm/function_section.yaml @@ -13,7 +13,7 @@ ParamTypes: - I32 - Type: FUNCTION - FunctionTypes: [ 1, 0 ] + FunctionSignatures: [ 1, 0 ] - Type: CODE Functions: - Index: 0 @@ -28,5 +28,5 @@ # CHECK: Version: 0x00000001 # CHECK: Sections: # CHECK: - Type: FUNCTION -# CHECK: FunctionTypes: [ 1, 0 ] +# CHECK: FunctionSignatures: [ 1, 0 ] # CHECK: ... Index: test/ObjectYAML/wasm/start_section.yaml =================================================================== --- test/ObjectYAML/wasm/start_section.yaml +++ test/ObjectYAML/wasm/start_section.yaml @@ -10,7 +10,7 @@ ReturnType: NORESULT ParamTypes: - Type: FUNCTION - FunctionTypes: [ 0, 0, 0 ] + FunctionSignatures: [ 0, 0, 0 ] - Type: START StartFunction: 1 - Type: CODE Index: test/ObjectYAML/wasm/weak_symbols.yaml =================================================================== --- test/ObjectYAML/wasm/weak_symbols.yaml +++ test/ObjectYAML/wasm/weak_symbols.yaml @@ -9,7 +9,7 @@ ReturnType: I32 ParamTypes: - Type: FUNCTION - FunctionTypes: [ 0, 0 ] + FunctionSignatures: [ 0, 0 ] - Type: GLOBAL Globals: - Index: 0 Index: test/tools/llvm-nm/wasm/exports.yaml =================================================================== --- test/tools/llvm-nm/wasm/exports.yaml +++ test/tools/llvm-nm/wasm/exports.yaml @@ -13,7 +13,7 @@ ParamTypes: - I32 - Type: FUNCTION - FunctionTypes: [ 0 ] + FunctionSignatures: [ 0 ] - Type: GLOBAL Globals: - Index: 0 Index: test/tools/llvm-nm/wasm/weak-symbols.yaml =================================================================== --- test/tools/llvm-nm/wasm/weak-symbols.yaml +++ test/tools/llvm-nm/wasm/weak-symbols.yaml @@ -19,7 +19,7 @@ Kind: FUNCTION SigIndex: 0 - Type: FUNCTION - FunctionTypes: [ 0 ] + FunctionSignatures: [ 0 ] - Type: GLOBAL Globals: - Index: 0 Index: test/tools/llvm-objdump/WebAssembly/relocations.test =================================================================== --- test/tools/llvm-objdump/WebAssembly/relocations.test +++ test/tools/llvm-objdump/WebAssembly/relocations.test @@ -10,7 +10,7 @@ } ; CHECK: RELOCATION RECORDS FOR [CODE]: -; CHECK-NEXT: 00000006 R_WEBASSEMBLY_TYPE_INDEX_LEB 1+0 +; CHECK-NEXT: 00000006 R_WEBASSEMBLY_SIGNATURE_INDEX_LEB 1+0 ; CHECK: RELOCATION RECORDS FOR [DATA]: ; CHECK-NEXT: 00000006 R_WEBASSEMBLY_MEMORY_ADDR_I32 foo+0 Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -652,7 +652,7 @@ raw_string_ostream fmt(fmtbuf); if (SI == Obj->symbol_end()) { // Not all wasm relocations have symbols associated with them. - // In particular R_WEBASSEMBLY_TYPE_INDEX_LEB. + // In particular R_WEBASSEMBLY_SIGNATURE_INDEX_LEB. fmt << Rel.Index; } else { Expected SymNameOrErr = SI->getName(); Index: tools/obj2yaml/wasm2yaml.cpp =================================================================== --- tools/obj2yaml/wasm2yaml.cpp +++ tools/obj2yaml/wasm2yaml.cpp @@ -162,15 +162,15 @@ case wasm::WASM_SEC_TYPE: { auto TypeSec = make_unique(); uint32_t Index = 0; - for (const auto &FunctionSig : Obj.types()) { + for (const auto &Signature : Obj.signatures()) { WasmYAML::Signature Sig; Sig.Index = Index++; Sig.ReturnType = wasm::WASM_TYPE_NORESULT; - assert(FunctionSig.Returns.size() <= 1 && + assert(Signature.Returns.size() <= 1 && "Functions with multiple returns are not supported"); - if (FunctionSig.Returns.size()) - Sig.ReturnType = static_cast(FunctionSig.Returns[0]); - for (const auto &ParamType : FunctionSig.Params) + if (Signature.Returns.size()) + Sig.ReturnType = static_cast(Signature.Returns[0]); + for (const auto &ParamType : Signature.Params) Sig.ParamTypes.push_back(static_cast(ParamType)); TypeSec->Signatures.push_back(Sig); } @@ -210,8 +210,8 @@ } case wasm::WASM_SEC_FUNCTION: { auto FuncSec = make_unique(); - for (const auto &Func : Obj.functionTypes()) { - FuncSec->FunctionTypes.push_back(Func); + for (const auto &Func : Obj.functionSigIndices()) { + FuncSec->FunctionSigIndices.push_back(Func); } S = std::move(FuncSec); break; Index: tools/yaml2obj/yaml2wasm.cpp =================================================================== --- tools/yaml2obj/yaml2wasm.cpp +++ tools/yaml2obj/yaml2wasm.cpp @@ -331,9 +331,9 @@ int WasmWriter::writeSectionContent(raw_ostream &OS, WasmYAML::FunctionSection &Section) { - encodeULEB128(Section.FunctionTypes.size(), OS); - for (uint32_t FuncType : Section.FunctionTypes) { - encodeULEB128(FuncType, OS); + encodeULEB128(Section.FunctionSigIndices.size(), OS); + for (uint32_t FuncSigIndex : Section.FunctionSigIndices) { + encodeULEB128(FuncSigIndex, OS); } return 0; }