diff options
author | Thomas Lively <tlively@google.com> | 2019-01-17 02:29:55 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-01-17 02:29:55 +0000 |
commit | cbda16eb8ebf52e10a44bd6f15e2743d69e9632a (patch) | |
tree | 43a795712422a63a3f60e732ac9131ceaa0bfd32 /llvm/include | |
parent | 2a0868ff48cbf9b3b57858c0f95b89607b69aac9 (diff) | |
download | bcm5719-llvm-cbda16eb8ebf52e10a44bd6f15e2743d69e9632a.tar.gz bcm5719-llvm-cbda16eb8ebf52e10a44bd6f15e2743d69e9632a.zip |
[WebAssembly] Parse llvm.ident into producers section
llvm-svn: 351413
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/Wasm.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/Object/Wasm.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/ObjectYAML/WasmYAML.h | 23 |
3 files changed, 32 insertions, 1 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index d9f0f94b298..05439c60872 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -43,6 +43,12 @@ struct WasmDylinkInfo { std::vector<StringRef> Needed; // Shared library depenedencies }; +struct WasmProducerInfo { + std::vector<std::pair<std::string, std::string>> Languages; + std::vector<std::pair<std::string, std::string>> Tools; + std::vector<std::pair<std::string, std::string>> SDKs; +}; + struct WasmExport { StringRef Name; uint8_t Kind; diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h index ed857652a04..083fd2e9030 100644 --- a/llvm/include/llvm/Object/Wasm.h +++ b/llvm/include/llvm/Object/Wasm.h @@ -130,6 +130,7 @@ public: static bool classof(const Binary *v) { return v->isWasm(); } const wasm::WasmDylinkInfo &dylinkInfo() const { return DylinkInfo; } + const wasm::WasmProducerInfo &getProducerInfo() const { return ProducerInfo; } ArrayRef<wasm::WasmSignature> types() const { return Signatures; } ArrayRef<uint32_t> functionTypes() const { return FunctionTypes; } ArrayRef<wasm::WasmImport> imports() const { return Imports; } @@ -149,7 +150,6 @@ public: uint32_t getNumImportedGlobals() const { return NumImportedGlobals; } uint32_t getNumImportedFunctions() const { return NumImportedFunctions; } uint32_t getNumImportedEvents() const { return NumImportedEvents; } - void moveSymbolNext(DataRefImpl &Symb) const override; uint32_t getSymbolFlags(DataRefImpl Symb) const override; @@ -252,11 +252,13 @@ private: Error parseLinkingSection(ReadContext &Ctx); Error parseLinkingSectionSymtab(ReadContext &Ctx); Error parseLinkingSectionComdat(ReadContext &Ctx); + Error parseProducersSection(ReadContext &Ctx); Error parseRelocSection(StringRef Name, ReadContext &Ctx); wasm::WasmObjectHeader Header; std::vector<WasmSection> Sections; wasm::WasmDylinkInfo DylinkInfo; + wasm::WasmProducerInfo ProducerInfo; std::vector<wasm::WasmSignature> Signatures; std::vector<uint32_t> FunctionTypes; std::vector<wasm::WasmTable> Tables; diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h index 406dd7cb515..1927ff35159 100644 --- a/llvm/include/llvm/ObjectYAML/WasmYAML.h +++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h @@ -123,6 +123,11 @@ struct NameEntry { StringRef Name; }; +struct ProducerEntry { + std::string Name; + std::string Version; +}; + struct SegmentInfo { uint32_t Index; StringRef Name; @@ -224,6 +229,19 @@ struct LinkingSection : CustomSection { std::vector<Comdat> Comdats; }; +struct ProducersSection : CustomSection { + ProducersSection() : CustomSection("producers") {} + + static bool classof(const Section *S) { + auto C = dyn_cast<CustomSection>(S); + return C && C->Name == "producers"; + } + + std::vector<ProducerEntry> Languages; + std::vector<ProducerEntry> Tools; + std::vector<ProducerEntry> SDKs; +}; + struct TypeSection : Section { TypeSection() : Section(wasm::WASM_SEC_TYPE) {} @@ -366,6 +384,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Function) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::LocalDecl) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Relocation) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry) +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ProducerEntry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SegmentInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::InitFunction) @@ -444,6 +463,10 @@ template <> struct MappingTraits<WasmYAML::NameEntry> { static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry); }; +template <> struct MappingTraits<WasmYAML::ProducerEntry> { + static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry); +}; + template <> struct MappingTraits<WasmYAML::SegmentInfo> { static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo); }; |