Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- WasmYAML.h - Wasm YAMLIO implementation ------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// \file |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 10 | /// This file declares classes for handling the YAML representation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 11 | /// of wasm binaries. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_OBJECTYAML_WASMYAML_H |
| 16 | #define LLVM_OBJECTYAML_WASMYAML_H |
| 17 | |
| 18 | #include "llvm/ADT/StringRef.h" |
| 19 | #include "llvm/BinaryFormat/Wasm.h" |
| 20 | #include "llvm/ObjectYAML/YAML.h" |
| 21 | #include "llvm/Support/Casting.h" |
| 22 | #include <cstdint> |
| 23 | #include <memory> |
| 24 | #include <vector> |
| 25 | |
| 26 | namespace llvm { |
| 27 | namespace WasmYAML { |
| 28 | |
| 29 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, SectionType) |
| 30 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, ValueType) |
| 31 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, TableType) |
| 32 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, SignatureForm) |
| 33 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, ExportKind) |
| 34 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, Opcode) |
| 35 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, RelocType) |
| 36 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, SymbolFlags) |
| 37 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, SymbolKind) |
| 38 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, SegmentFlags) |
| 39 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, LimitFlags) |
| 40 | LLVM_YAML_STRONG_TYPEDEF(uint32_t, ComdatKind) |
| 41 | |
| 42 | struct FileHeader { |
| 43 | yaml::Hex32 Version; |
| 44 | }; |
| 45 | |
| 46 | struct Limits { |
| 47 | LimitFlags Flags; |
| 48 | yaml::Hex32 Initial; |
| 49 | yaml::Hex32 Maximum; |
| 50 | }; |
| 51 | |
| 52 | struct Table { |
| 53 | TableType ElemType; |
| 54 | Limits TableLimits; |
| 55 | }; |
| 56 | |
| 57 | struct Export { |
| 58 | StringRef Name; |
| 59 | ExportKind Kind; |
| 60 | uint32_t Index; |
| 61 | }; |
| 62 | |
| 63 | struct ElemSegment { |
| 64 | uint32_t TableIndex; |
| 65 | wasm::WasmInitExpr Offset; |
| 66 | std::vector<uint32_t> Functions; |
| 67 | }; |
| 68 | |
| 69 | struct Global { |
| 70 | uint32_t Index; |
| 71 | ValueType Type; |
| 72 | bool Mutable; |
| 73 | wasm::WasmInitExpr InitExpr; |
| 74 | }; |
| 75 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 76 | struct Event { |
| 77 | uint32_t Index; |
| 78 | uint32_t Attribute; |
| 79 | uint32_t SigIndex; |
| 80 | }; |
| 81 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 82 | struct Import { |
| 83 | StringRef Module; |
| 84 | StringRef Field; |
| 85 | ExportKind Kind; |
| 86 | union { |
| 87 | uint32_t SigIndex; |
| 88 | Global GlobalImport; |
| 89 | Table TableImport; |
| 90 | Limits Memory; |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 91 | Event EventImport; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 92 | }; |
| 93 | }; |
| 94 | |
| 95 | struct LocalDecl { |
| 96 | ValueType Type; |
| 97 | uint32_t Count; |
| 98 | }; |
| 99 | |
| 100 | struct Function { |
| 101 | uint32_t Index; |
| 102 | std::vector<LocalDecl> Locals; |
| 103 | yaml::BinaryRef Body; |
| 104 | }; |
| 105 | |
| 106 | struct Relocation { |
| 107 | RelocType Type; |
| 108 | uint32_t Index; |
| 109 | yaml::Hex32 Offset; |
| 110 | int32_t Addend; |
| 111 | }; |
| 112 | |
| 113 | struct DataSegment { |
| 114 | uint32_t MemoryIndex; |
| 115 | uint32_t SectionOffset; |
| 116 | wasm::WasmInitExpr Offset; |
| 117 | yaml::BinaryRef Content; |
| 118 | }; |
| 119 | |
| 120 | struct NameEntry { |
| 121 | uint32_t Index; |
| 122 | StringRef Name; |
| 123 | }; |
| 124 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 125 | struct ProducerEntry { |
| 126 | std::string Name; |
| 127 | std::string Version; |
| 128 | }; |
| 129 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 130 | struct SegmentInfo { |
| 131 | uint32_t Index; |
| 132 | StringRef Name; |
| 133 | uint32_t Alignment; |
| 134 | SegmentFlags Flags; |
| 135 | }; |
| 136 | |
| 137 | struct Signature { |
| 138 | uint32_t Index; |
| 139 | SignatureForm Form = wasm::WASM_TYPE_FUNC; |
| 140 | std::vector<ValueType> ParamTypes; |
| 141 | ValueType ReturnType; |
| 142 | }; |
| 143 | |
| 144 | struct SymbolInfo { |
| 145 | uint32_t Index; |
| 146 | StringRef Name; |
| 147 | SymbolKind Kind; |
| 148 | SymbolFlags Flags; |
| 149 | union { |
| 150 | uint32_t ElementIndex; |
| 151 | wasm::WasmDataReference DataRef; |
| 152 | }; |
| 153 | }; |
| 154 | |
| 155 | struct InitFunction { |
| 156 | uint32_t Priority; |
| 157 | uint32_t Symbol; |
| 158 | }; |
| 159 | |
| 160 | struct ComdatEntry { |
| 161 | ComdatKind Kind; |
| 162 | uint32_t Index; |
| 163 | }; |
| 164 | |
| 165 | struct Comdat { |
| 166 | StringRef Name; |
| 167 | std::vector<ComdatEntry> Entries; |
| 168 | }; |
| 169 | |
| 170 | struct Section { |
| 171 | explicit Section(SectionType SecType) : Type(SecType) {} |
| 172 | virtual ~Section(); |
| 173 | |
| 174 | SectionType Type; |
| 175 | std::vector<Relocation> Relocations; |
| 176 | }; |
| 177 | |
| 178 | struct CustomSection : Section { |
| 179 | explicit CustomSection(StringRef Name) |
| 180 | : Section(wasm::WASM_SEC_CUSTOM), Name(Name) {} |
| 181 | |
| 182 | static bool classof(const Section *S) { |
| 183 | return S->Type == wasm::WASM_SEC_CUSTOM; |
| 184 | } |
| 185 | |
| 186 | StringRef Name; |
| 187 | yaml::BinaryRef Payload; |
| 188 | }; |
| 189 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 190 | struct DylinkSection : CustomSection { |
| 191 | DylinkSection() : CustomSection("dylink") {} |
| 192 | |
| 193 | static bool classof(const Section *S) { |
| 194 | auto C = dyn_cast<CustomSection>(S); |
| 195 | return C && C->Name == "dylink"; |
| 196 | } |
| 197 | |
| 198 | uint32_t MemorySize; |
| 199 | uint32_t MemoryAlignment; |
| 200 | uint32_t TableSize; |
| 201 | uint32_t TableAlignment; |
| 202 | std::vector<StringRef> Needed; |
| 203 | }; |
| 204 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 205 | struct NameSection : CustomSection { |
| 206 | NameSection() : CustomSection("name") {} |
| 207 | |
| 208 | static bool classof(const Section *S) { |
| 209 | auto C = dyn_cast<CustomSection>(S); |
| 210 | return C && C->Name == "name"; |
| 211 | } |
| 212 | |
| 213 | std::vector<NameEntry> FunctionNames; |
| 214 | }; |
| 215 | |
| 216 | struct LinkingSection : CustomSection { |
| 217 | LinkingSection() : CustomSection("linking") {} |
| 218 | |
| 219 | static bool classof(const Section *S) { |
| 220 | auto C = dyn_cast<CustomSection>(S); |
| 221 | return C && C->Name == "linking"; |
| 222 | } |
| 223 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 224 | uint32_t Version; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 225 | std::vector<SymbolInfo> SymbolTable; |
| 226 | std::vector<SegmentInfo> SegmentInfos; |
| 227 | std::vector<InitFunction> InitFunctions; |
| 228 | std::vector<Comdat> Comdats; |
| 229 | }; |
| 230 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 231 | struct ProducersSection : CustomSection { |
| 232 | ProducersSection() : CustomSection("producers") {} |
| 233 | |
| 234 | static bool classof(const Section *S) { |
| 235 | auto C = dyn_cast<CustomSection>(S); |
| 236 | return C && C->Name == "producers"; |
| 237 | } |
| 238 | |
| 239 | std::vector<ProducerEntry> Languages; |
| 240 | std::vector<ProducerEntry> Tools; |
| 241 | std::vector<ProducerEntry> SDKs; |
| 242 | }; |
| 243 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 244 | struct TypeSection : Section { |
| 245 | TypeSection() : Section(wasm::WASM_SEC_TYPE) {} |
| 246 | |
| 247 | static bool classof(const Section *S) { |
| 248 | return S->Type == wasm::WASM_SEC_TYPE; |
| 249 | } |
| 250 | |
| 251 | std::vector<Signature> Signatures; |
| 252 | }; |
| 253 | |
| 254 | struct ImportSection : Section { |
| 255 | ImportSection() : Section(wasm::WASM_SEC_IMPORT) {} |
| 256 | |
| 257 | static bool classof(const Section *S) { |
| 258 | return S->Type == wasm::WASM_SEC_IMPORT; |
| 259 | } |
| 260 | |
| 261 | std::vector<Import> Imports; |
| 262 | }; |
| 263 | |
| 264 | struct FunctionSection : Section { |
| 265 | FunctionSection() : Section(wasm::WASM_SEC_FUNCTION) {} |
| 266 | |
| 267 | static bool classof(const Section *S) { |
| 268 | return S->Type == wasm::WASM_SEC_FUNCTION; |
| 269 | } |
| 270 | |
| 271 | std::vector<uint32_t> FunctionTypes; |
| 272 | }; |
| 273 | |
| 274 | struct TableSection : Section { |
| 275 | TableSection() : Section(wasm::WASM_SEC_TABLE) {} |
| 276 | |
| 277 | static bool classof(const Section *S) { |
| 278 | return S->Type == wasm::WASM_SEC_TABLE; |
| 279 | } |
| 280 | |
| 281 | std::vector<Table> Tables; |
| 282 | }; |
| 283 | |
| 284 | struct MemorySection : Section { |
| 285 | MemorySection() : Section(wasm::WASM_SEC_MEMORY) {} |
| 286 | |
| 287 | static bool classof(const Section *S) { |
| 288 | return S->Type == wasm::WASM_SEC_MEMORY; |
| 289 | } |
| 290 | |
| 291 | std::vector<Limits> Memories; |
| 292 | }; |
| 293 | |
| 294 | struct GlobalSection : Section { |
| 295 | GlobalSection() : Section(wasm::WASM_SEC_GLOBAL) {} |
| 296 | |
| 297 | static bool classof(const Section *S) { |
| 298 | return S->Type == wasm::WASM_SEC_GLOBAL; |
| 299 | } |
| 300 | |
| 301 | std::vector<Global> Globals; |
| 302 | }; |
| 303 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 304 | struct EventSection : Section { |
| 305 | EventSection() : Section(wasm::WASM_SEC_EVENT) {} |
| 306 | |
| 307 | static bool classof(const Section *S) { |
| 308 | return S->Type == wasm::WASM_SEC_EVENT; |
| 309 | } |
| 310 | |
| 311 | std::vector<Event> Events; |
| 312 | }; |
| 313 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 314 | struct ExportSection : Section { |
| 315 | ExportSection() : Section(wasm::WASM_SEC_EXPORT) {} |
| 316 | |
| 317 | static bool classof(const Section *S) { |
| 318 | return S->Type == wasm::WASM_SEC_EXPORT; |
| 319 | } |
| 320 | |
| 321 | std::vector<Export> Exports; |
| 322 | }; |
| 323 | |
| 324 | struct StartSection : Section { |
| 325 | StartSection() : Section(wasm::WASM_SEC_START) {} |
| 326 | |
| 327 | static bool classof(const Section *S) { |
| 328 | return S->Type == wasm::WASM_SEC_START; |
| 329 | } |
| 330 | |
| 331 | uint32_t StartFunction; |
| 332 | }; |
| 333 | |
| 334 | struct ElemSection : Section { |
| 335 | ElemSection() : Section(wasm::WASM_SEC_ELEM) {} |
| 336 | |
| 337 | static bool classof(const Section *S) { |
| 338 | return S->Type == wasm::WASM_SEC_ELEM; |
| 339 | } |
| 340 | |
| 341 | std::vector<ElemSegment> Segments; |
| 342 | }; |
| 343 | |
| 344 | struct CodeSection : Section { |
| 345 | CodeSection() : Section(wasm::WASM_SEC_CODE) {} |
| 346 | |
| 347 | static bool classof(const Section *S) { |
| 348 | return S->Type == wasm::WASM_SEC_CODE; |
| 349 | } |
| 350 | |
| 351 | std::vector<Function> Functions; |
| 352 | }; |
| 353 | |
| 354 | struct DataSection : Section { |
| 355 | DataSection() : Section(wasm::WASM_SEC_DATA) {} |
| 356 | |
| 357 | static bool classof(const Section *S) { |
| 358 | return S->Type == wasm::WASM_SEC_DATA; |
| 359 | } |
| 360 | |
| 361 | std::vector<DataSegment> Segments; |
| 362 | }; |
| 363 | |
| 364 | struct Object { |
| 365 | FileHeader Header; |
| 366 | std::vector<std::unique_ptr<Section>> Sections; |
| 367 | }; |
| 368 | |
| 369 | } // end namespace WasmYAML |
| 370 | } // end namespace llvm |
| 371 | |
| 372 | LLVM_YAML_IS_SEQUENCE_VECTOR(std::unique_ptr<llvm::WasmYAML::Section>) |
| 373 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Signature) |
| 374 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ValueType) |
| 375 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Table) |
| 376 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Import) |
| 377 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Export) |
| 378 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ElemSegment) |
| 379 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Limits) |
| 380 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::DataSegment) |
| 381 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Global) |
| 382 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Function) |
| 383 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::LocalDecl) |
| 384 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Relocation) |
| 385 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry) |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 386 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ProducerEntry) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 387 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SegmentInfo) |
| 388 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo) |
| 389 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::InitFunction) |
| 390 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ComdatEntry) |
| 391 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Comdat) |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 392 | LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Event) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 393 | |
| 394 | namespace llvm { |
| 395 | namespace yaml { |
| 396 | |
| 397 | template <> struct MappingTraits<WasmYAML::FileHeader> { |
| 398 | static void mapping(IO &IO, WasmYAML::FileHeader &FileHdr); |
| 399 | }; |
| 400 | |
| 401 | template <> struct MappingTraits<std::unique_ptr<WasmYAML::Section>> { |
| 402 | static void mapping(IO &IO, std::unique_ptr<WasmYAML::Section> &Section); |
| 403 | }; |
| 404 | |
| 405 | template <> struct MappingTraits<WasmYAML::Object> { |
| 406 | static void mapping(IO &IO, WasmYAML::Object &Object); |
| 407 | }; |
| 408 | |
| 409 | template <> struct MappingTraits<WasmYAML::Import> { |
| 410 | static void mapping(IO &IO, WasmYAML::Import &Import); |
| 411 | }; |
| 412 | |
| 413 | template <> struct MappingTraits<WasmYAML::Export> { |
| 414 | static void mapping(IO &IO, WasmYAML::Export &Export); |
| 415 | }; |
| 416 | |
| 417 | template <> struct MappingTraits<WasmYAML::Global> { |
| 418 | static void mapping(IO &IO, WasmYAML::Global &Global); |
| 419 | }; |
| 420 | |
| 421 | template <> struct ScalarBitSetTraits<WasmYAML::LimitFlags> { |
| 422 | static void bitset(IO &IO, WasmYAML::LimitFlags &Value); |
| 423 | }; |
| 424 | |
| 425 | template <> struct ScalarBitSetTraits<WasmYAML::SymbolFlags> { |
| 426 | static void bitset(IO &IO, WasmYAML::SymbolFlags &Value); |
| 427 | }; |
| 428 | |
| 429 | template <> struct ScalarEnumerationTraits<WasmYAML::SymbolKind> { |
| 430 | static void enumeration(IO &IO, WasmYAML::SymbolKind &Kind); |
| 431 | }; |
| 432 | |
| 433 | template <> struct ScalarBitSetTraits<WasmYAML::SegmentFlags> { |
| 434 | static void bitset(IO &IO, WasmYAML::SegmentFlags &Value); |
| 435 | }; |
| 436 | |
| 437 | template <> struct ScalarEnumerationTraits<WasmYAML::SectionType> { |
| 438 | static void enumeration(IO &IO, WasmYAML::SectionType &Type); |
| 439 | }; |
| 440 | |
| 441 | template <> struct MappingTraits<WasmYAML::Signature> { |
| 442 | static void mapping(IO &IO, WasmYAML::Signature &Signature); |
| 443 | }; |
| 444 | |
| 445 | template <> struct MappingTraits<WasmYAML::Table> { |
| 446 | static void mapping(IO &IO, WasmYAML::Table &Table); |
| 447 | }; |
| 448 | |
| 449 | template <> struct MappingTraits<WasmYAML::Limits> { |
| 450 | static void mapping(IO &IO, WasmYAML::Limits &Limits); |
| 451 | }; |
| 452 | |
| 453 | template <> struct MappingTraits<WasmYAML::Function> { |
| 454 | static void mapping(IO &IO, WasmYAML::Function &Function); |
| 455 | }; |
| 456 | |
| 457 | template <> struct MappingTraits<WasmYAML::Relocation> { |
| 458 | static void mapping(IO &IO, WasmYAML::Relocation &Relocation); |
| 459 | }; |
| 460 | |
| 461 | template <> struct MappingTraits<WasmYAML::NameEntry> { |
| 462 | static void mapping(IO &IO, WasmYAML::NameEntry &NameEntry); |
| 463 | }; |
| 464 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 465 | template <> struct MappingTraits<WasmYAML::ProducerEntry> { |
| 466 | static void mapping(IO &IO, WasmYAML::ProducerEntry &ProducerEntry); |
| 467 | }; |
| 468 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 469 | template <> struct MappingTraits<WasmYAML::SegmentInfo> { |
| 470 | static void mapping(IO &IO, WasmYAML::SegmentInfo &SegmentInfo); |
| 471 | }; |
| 472 | |
| 473 | template <> struct MappingTraits<WasmYAML::LocalDecl> { |
| 474 | static void mapping(IO &IO, WasmYAML::LocalDecl &LocalDecl); |
| 475 | }; |
| 476 | |
| 477 | template <> struct MappingTraits<wasm::WasmInitExpr> { |
| 478 | static void mapping(IO &IO, wasm::WasmInitExpr &Expr); |
| 479 | }; |
| 480 | |
| 481 | template <> struct MappingTraits<WasmYAML::DataSegment> { |
| 482 | static void mapping(IO &IO, WasmYAML::DataSegment &Segment); |
| 483 | }; |
| 484 | |
| 485 | template <> struct MappingTraits<WasmYAML::ElemSegment> { |
| 486 | static void mapping(IO &IO, WasmYAML::ElemSegment &Segment); |
| 487 | }; |
| 488 | |
| 489 | template <> struct MappingTraits<WasmYAML::SymbolInfo> { |
| 490 | static void mapping(IO &IO, WasmYAML::SymbolInfo &Info); |
| 491 | }; |
| 492 | |
| 493 | template <> struct MappingTraits<WasmYAML::InitFunction> { |
| 494 | static void mapping(IO &IO, WasmYAML::InitFunction &Init); |
| 495 | }; |
| 496 | |
| 497 | template <> struct ScalarEnumerationTraits<WasmYAML::ComdatKind> { |
| 498 | static void enumeration(IO &IO, WasmYAML::ComdatKind &Kind); |
| 499 | }; |
| 500 | |
| 501 | template <> struct MappingTraits<WasmYAML::ComdatEntry> { |
| 502 | static void mapping(IO &IO, WasmYAML::ComdatEntry &ComdatEntry); |
| 503 | }; |
| 504 | |
| 505 | template <> struct MappingTraits<WasmYAML::Comdat> { |
| 506 | static void mapping(IO &IO, WasmYAML::Comdat &Comdat); |
| 507 | }; |
| 508 | |
| 509 | template <> struct ScalarEnumerationTraits<WasmYAML::ValueType> { |
| 510 | static void enumeration(IO &IO, WasmYAML::ValueType &Type); |
| 511 | }; |
| 512 | |
| 513 | template <> struct ScalarEnumerationTraits<WasmYAML::ExportKind> { |
| 514 | static void enumeration(IO &IO, WasmYAML::ExportKind &Kind); |
| 515 | }; |
| 516 | |
| 517 | template <> struct ScalarEnumerationTraits<WasmYAML::TableType> { |
| 518 | static void enumeration(IO &IO, WasmYAML::TableType &Type); |
| 519 | }; |
| 520 | |
| 521 | template <> struct ScalarEnumerationTraits<WasmYAML::Opcode> { |
| 522 | static void enumeration(IO &IO, WasmYAML::Opcode &Opcode); |
| 523 | }; |
| 524 | |
| 525 | template <> struct ScalarEnumerationTraits<WasmYAML::RelocType> { |
| 526 | static void enumeration(IO &IO, WasmYAML::RelocType &Kind); |
| 527 | }; |
| 528 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 529 | template <> struct MappingTraits<WasmYAML::Event> { |
| 530 | static void mapping(IO &IO, WasmYAML::Event &Event); |
| 531 | }; |
| 532 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 533 | } // end namespace yaml |
| 534 | } // end namespace llvm |
| 535 | |
| 536 | #endif // LLVM_OBJECTYAML_WASMYAML_H |