LLVM  14.0.0git
WasmYAML.cpp
Go to the documentation of this file.
1 //===- WasmYAML.cpp - Wasm YAMLIO implementation --------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines classes for handling the YAML representation of wasm.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/Casting.h"
18 
19 namespace llvm {
20 
21 namespace WasmYAML {
22 
23 // Declared here rather than in the header to comply with:
24 // http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
25 Section::~Section() = default;
26 
27 } // end namespace WasmYAML
28 
29 namespace yaml {
30 
32  IO &IO, WasmYAML::FileHeader &FileHdr) {
33  IO.mapRequired("Version", FileHdr.Version);
34 }
35 
37  WasmYAML::Object &Object) {
38  IO.setContext(&Object);
39  IO.mapTag("!WASM", true);
40  IO.mapRequired("FileHeader", Object.Header);
41  IO.mapOptional("Sections", Object.Sections);
42  IO.setContext(nullptr);
43 }
44 
46  IO.mapRequired("Type", Section.Type);
47  IO.mapOptional("Relocations", Section.Relocations);
48 }
49 
52  IO.mapRequired("Name", Section.Name);
53  IO.mapRequired("MemorySize", Section.MemorySize);
54  IO.mapRequired("MemoryAlignment", Section.MemoryAlignment);
55  IO.mapRequired("TableSize", Section.TableSize);
56  IO.mapRequired("TableAlignment", Section.TableAlignment);
57  IO.mapRequired("Needed", Section.Needed);
58  IO.mapOptional("ExportInfo", Section.ExportInfo);
59 }
60 
63  IO.mapRequired("Name", Section.Name);
64  IO.mapOptional("FunctionNames", Section.FunctionNames);
65  IO.mapOptional("GlobalNames", Section.GlobalNames);
66  IO.mapOptional("DataSegmentNames", Section.DataSegmentNames);
67 }
68 
71  IO.mapRequired("Name", Section.Name);
72  IO.mapRequired("Version", Section.Version);
73  IO.mapOptional("SymbolTable", Section.SymbolTable);
74  IO.mapOptional("SegmentInfo", Section.SegmentInfos);
75  IO.mapOptional("InitFunctions", Section.InitFunctions);
76  IO.mapOptional("Comdats", Section.Comdats);
77 }
78 
81  IO.mapRequired("Name", Section.Name);
82  IO.mapOptional("Languages", Section.Languages);
83  IO.mapOptional("Tools", Section.Tools);
84  IO.mapOptional("SDKs", Section.SDKs);
85 }
86 
89  IO.mapRequired("Name", Section.Name);
90  IO.mapRequired("Features", Section.Features);
91 }
92 
95  IO.mapRequired("Name", Section.Name);
96  IO.mapRequired("Payload", Section.Payload);
97 }
98 
101  IO.mapOptional("Signatures", Section.Signatures);
102 }
103 
106  IO.mapOptional("Imports", Section.Imports);
107 }
108 
111  IO.mapOptional("FunctionTypes", Section.FunctionTypes);
112 }
113 
116  IO.mapOptional("Tables", Section.Tables);
117 }
118 
121  IO.mapOptional("Memories", Section.Memories);
122 }
123 
126  IO.mapOptional("Tags", Section.Tags);
127 }
128 
131  IO.mapOptional("Globals", Section.Globals);
132 }
133 
136  IO.mapOptional("Exports", Section.Exports);
137 }
138 
141  IO.mapOptional("StartFunction", Section.StartFunction);
142 }
143 
146  IO.mapOptional("Segments", Section.Segments);
147 }
148 
151  IO.mapRequired("Functions", Section.Functions);
152 }
153 
156  IO.mapRequired("Segments", Section.Segments);
157 }
158 
161  IO.mapRequired("Count", Section.Count);
162 }
163 
165  IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
167  if (IO.outputting())
168  SectionType = Section->Type;
169  else
170  IO.mapRequired("Type", SectionType);
171 
172  switch (SectionType) {
173  case wasm::WASM_SEC_CUSTOM: {
175  if (IO.outputting()) {
176  auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
177  SectionName = CustomSection->Name;
178  } else {
179  IO.mapRequired("Name", SectionName);
180  }
181  if (SectionName == "dylink" || SectionName == "dylink.0") {
182  if (!IO.outputting())
183  Section.reset(new WasmYAML::DylinkSection());
184  sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
185  } else if (SectionName == "linking") {
186  if (!IO.outputting())
187  Section.reset(new WasmYAML::LinkingSection());
188  sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
189  } else if (SectionName == "name") {
190  if (!IO.outputting())
191  Section.reset(new WasmYAML::NameSection());
192  sectionMapping(IO, *cast<WasmYAML::NameSection>(Section.get()));
193  } else if (SectionName == "producers") {
194  if (!IO.outputting())
195  Section.reset(new WasmYAML::ProducersSection());
196  sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
197  } else if (SectionName == "target_features") {
198  if (!IO.outputting())
200  sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
201  } else {
202  if (!IO.outputting())
204  sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
205  }
206  break;
207  }
208  case wasm::WASM_SEC_TYPE:
209  if (!IO.outputting())
210  Section.reset(new WasmYAML::TypeSection());
211  sectionMapping(IO, *cast<WasmYAML::TypeSection>(Section.get()));
212  break;
214  if (!IO.outputting())
215  Section.reset(new WasmYAML::ImportSection());
216  sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
217  break;
219  if (!IO.outputting())
220  Section.reset(new WasmYAML::FunctionSection());
221  sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
222  break;
224  if (!IO.outputting())
225  Section.reset(new WasmYAML::TableSection());
226  sectionMapping(IO, *cast<WasmYAML::TableSection>(Section.get()));
227  break;
229  if (!IO.outputting())
230  Section.reset(new WasmYAML::MemorySection());
231  sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
232  break;
233  case wasm::WASM_SEC_TAG:
234  if (!IO.outputting())
235  Section.reset(new WasmYAML::TagSection());
236  sectionMapping(IO, *cast<WasmYAML::TagSection>(Section.get()));
237  break;
239  if (!IO.outputting())
240  Section.reset(new WasmYAML::GlobalSection());
241  sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
242  break;
244  if (!IO.outputting())
245  Section.reset(new WasmYAML::ExportSection());
246  sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
247  break;
249  if (!IO.outputting())
250  Section.reset(new WasmYAML::StartSection());
251  sectionMapping(IO, *cast<WasmYAML::StartSection>(Section.get()));
252  break;
253  case wasm::WASM_SEC_ELEM:
254  if (!IO.outputting())
255  Section.reset(new WasmYAML::ElemSection());
256  sectionMapping(IO, *cast<WasmYAML::ElemSection>(Section.get()));
257  break;
258  case wasm::WASM_SEC_CODE:
259  if (!IO.outputting())
260  Section.reset(new WasmYAML::CodeSection());
261  sectionMapping(IO, *cast<WasmYAML::CodeSection>(Section.get()));
262  break;
263  case wasm::WASM_SEC_DATA:
264  if (!IO.outputting())
265  Section.reset(new WasmYAML::DataSection());
266  sectionMapping(IO, *cast<WasmYAML::DataSection>(Section.get()));
267  break;
269  if (!IO.outputting())
270  Section.reset(new WasmYAML::DataCountSection());
271  sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
272  break;
273  default:
274  llvm_unreachable("Unknown section type");
275  }
276 }
277 
279  IO &IO, WasmYAML::SectionType &Type) {
280 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
281  ECase(CUSTOM);
282  ECase(TYPE);
283  ECase(IMPORT);
284  ECase(FUNCTION);
285  ECase(TABLE);
286  ECase(MEMORY);
287  ECase(GLOBAL);
288  ECase(TAG);
289  ECase(EXPORT);
290  ECase(START);
291  ECase(ELEM);
292  ECase(CODE);
293  ECase(DATA);
294  ECase(DATACOUNT);
295 #undef ECase
296 }
297 
299  IO &IO, WasmYAML::Signature &Signature) {
300  IO.mapRequired("Index", Signature.Index);
301  IO.mapRequired("ParamTypes", Signature.ParamTypes);
302  IO.mapRequired("ReturnTypes", Signature.ReturnTypes);
303 }
304 
306  IO.mapRequired("Index", Table.Index);
307  IO.mapRequired("ElemType", Table.ElemType);
308  IO.mapRequired("Limits", Table.TableLimits);
309 }
310 
313  IO.mapRequired("Index", Function.Index);
314  IO.mapRequired("Locals", Function.Locals);
315  IO.mapRequired("Body", Function.Body);
316 }
317 
319  IO &IO, WasmYAML::Relocation &Relocation) {
320  IO.mapRequired("Type", Relocation.Type);
321  IO.mapRequired("Index", Relocation.Index);
322  IO.mapRequired("Offset", Relocation.Offset);
323  IO.mapOptional("Addend", Relocation.Addend, 0);
324 }
325 
327  IO &IO, WasmYAML::NameEntry &NameEntry) {
328  IO.mapRequired("Index", NameEntry.Index);
329  IO.mapRequired("Name", NameEntry.Name);
330 }
331 
333  IO &IO, WasmYAML::ProducerEntry &ProducerEntry) {
334  IO.mapRequired("Name", ProducerEntry.Name);
335  IO.mapRequired("Version", ProducerEntry.Version);
336 }
337 
339  IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
340 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
341  ECase(USED);
342  ECase(REQUIRED);
343  ECase(DISALLOWED);
344 #undef ECase
345 }
346 
348  IO &IO, WasmYAML::FeatureEntry &FeatureEntry) {
349  IO.mapRequired("Prefix", FeatureEntry.Prefix);
350  IO.mapRequired("Name", FeatureEntry.Name);
351 }
352 
354  IO &IO, WasmYAML::SegmentInfo &SegmentInfo) {
355  IO.mapRequired("Index", SegmentInfo.Index);
356  IO.mapRequired("Name", SegmentInfo.Name);
357  IO.mapRequired("Alignment", SegmentInfo.Alignment);
358  IO.mapRequired("Flags", SegmentInfo.Flags);
359 }
360 
362  IO &IO, WasmYAML::LocalDecl &LocalDecl) {
363  IO.mapRequired("Type", LocalDecl.Type);
364  IO.mapRequired("Count", LocalDecl.Count);
365 }
366 
368  WasmYAML::Limits &Limits) {
369  if (!IO.outputting() || Limits.Flags)
370  IO.mapOptional("Flags", Limits.Flags);
371  IO.mapRequired("Minimum", Limits.Minimum);
372  if (!IO.outputting() || Limits.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
373  IO.mapOptional("Maximum", Limits.Maximum);
374 }
375 
377  IO &IO, WasmYAML::ElemSegment &Segment) {
378  if (!IO.outputting() || Segment.Flags)
379  IO.mapOptional("Flags", Segment.Flags);
380  if (!IO.outputting() ||
382  IO.mapOptional("TableNumber", Segment.TableNumber);
383  if (!IO.outputting() ||
385  IO.mapOptional("ElemKind", Segment.ElemKind);
386  IO.mapRequired("Offset", Segment.Offset);
387  IO.mapRequired("Functions", Segment.Functions);
388 }
389 
391  WasmYAML::Import &Import) {
392  IO.mapRequired("Module", Import.Module);
393  IO.mapRequired("Field", Import.Field);
394  IO.mapRequired("Kind", Import.Kind);
395  if (Import.Kind == wasm::WASM_EXTERNAL_FUNCTION) {
396  IO.mapRequired("SigIndex", Import.SigIndex);
397  } else if (Import.Kind == wasm::WASM_EXTERNAL_GLOBAL) {
398  IO.mapRequired("GlobalType", Import.GlobalImport.Type);
399  IO.mapRequired("GlobalMutable", Import.GlobalImport.Mutable);
400  } else if (Import.Kind == wasm::WASM_EXTERNAL_TAG) {
401  IO.mapRequired("TagAttribute", Import.TagImport.Attribute);
402  IO.mapRequired("TagSigIndex", Import.TagImport.SigIndex);
403  } else if (Import.Kind == wasm::WASM_EXTERNAL_TABLE) {
404  IO.mapRequired("Table", Import.TableImport);
405  } else if (Import.Kind == wasm::WASM_EXTERNAL_MEMORY) {
406  IO.mapRequired("Memory", Import.Memory);
407  } else {
408  llvm_unreachable("unhandled import type");
409  }
410 }
411 
413  WasmYAML::Export &Export) {
414  IO.mapRequired("Name", Export.Name);
415  IO.mapRequired("Kind", Export.Kind);
416  IO.mapRequired("Index", Export.Index);
417 }
418 
420  WasmYAML::Global &Global) {
421  IO.mapRequired("Index", Global.Index);
422  IO.mapRequired("Type", Global.Type);
423  IO.mapRequired("Mutable", Global.Mutable);
424  IO.mapRequired("InitExpr", Global.InitExpr);
425 }
426 
428  wasm::WasmInitExpr &Expr) {
429  WasmYAML::Opcode Op = Expr.Opcode;
430  IO.mapRequired("Opcode", Op);
431  Expr.Opcode = Op;
432  switch (Expr.Opcode) {
434  IO.mapRequired("Value", Expr.Value.Int32);
435  break;
437  IO.mapRequired("Value", Expr.Value.Int64);
438  break;
440  IO.mapRequired("Value", Expr.Value.Float32);
441  break;
443  IO.mapRequired("Value", Expr.Value.Float64);
444  break;
446  IO.mapRequired("Index", Expr.Value.Global);
447  break;
450  IO.mapRequired("Type", Ty);
451  break;
452  }
453  }
454 }
455 
457  IO &IO, WasmYAML::DataSegment &Segment) {
458  IO.mapOptional("SectionOffset", Segment.SectionOffset);
459  IO.mapRequired("InitFlags", Segment.InitFlags);
461  IO.mapRequired("MemoryIndex", Segment.MemoryIndex);
462  } else {
463  Segment.MemoryIndex = 0;
464  }
465  if ((Segment.InitFlags & wasm::WASM_DATA_SEGMENT_IS_PASSIVE) == 0) {
466  IO.mapRequired("Offset", Segment.Offset);
467  } else {
469  Segment.Offset.Value.Int32 = 0;
470  }
471  IO.mapRequired("Content", Segment.Content);
472 }
473 
475  IO &IO, WasmYAML::InitFunction &Init) {
476  IO.mapRequired("Priority", Init.Priority);
477  IO.mapRequired("Symbol", Init.Symbol);
478 }
479 
481  IO &IO, WasmYAML::ComdatKind &Kind) {
482 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
483  ECase(FUNCTION);
484  ECase(DATA);
485  ECase(SECTION);
486 #undef ECase
487 }
488 
490  IO &IO, WasmYAML::ComdatEntry &ComdatEntry) {
491  IO.mapRequired("Kind", ComdatEntry.Kind);
492  IO.mapRequired("Index", ComdatEntry.Index);
493 }
494 
497  IO.mapRequired("Name", Comdat.Name);
498  IO.mapRequired("Entries", Comdat.Entries);
499 }
500 
503  IO.mapRequired("Index", Info.Index);
504  IO.mapRequired("Kind", Info.Kind);
506  IO.mapRequired("Name", Info.Name);
507  IO.mapRequired("Flags", Info.Flags);
509  IO.mapRequired("Function", Info.ElementIndex);
510  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_GLOBAL) {
511  IO.mapRequired("Global", Info.ElementIndex);
512  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TABLE) {
513  IO.mapRequired("Table", Info.ElementIndex);
514  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG) {
515  IO.mapRequired("Tag", Info.ElementIndex);
516  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_DATA) {
517  if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) {
518  IO.mapRequired("Segment", Info.DataRef.Segment);
519  IO.mapOptional("Offset", Info.DataRef.Offset, 0u);
520  IO.mapRequired("Size", Info.DataRef.Size);
521  }
522  } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_SECTION) {
523  IO.mapRequired("Section", Info.ElementIndex);
524  } else {
525  llvm_unreachable("unsupported symbol kind");
526  }
527 }
528 
530  IO.mapRequired("Index", Tag.Index);
531  IO.mapRequired("Attribute", Tag.Attribute);
532  IO.mapRequired("SigIndex", Tag.SigIndex);
533 }
534 
536  IO &IO, WasmYAML::DylinkExport &Export) {
537  IO.mapRequired("Name", Export.Name);
538  IO.mapRequired("Flags", Export.Flags);
539 }
540 
542  IO &IO, WasmYAML::LimitFlags &Value) {
543 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
544  BCase(HAS_MAX);
545  BCase(IS_SHARED);
546  BCase(IS_64);
547 #undef BCase
548 }
549 
551  IO &IO, WasmYAML::SegmentFlags &Value) {
552 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
553  BCase(STRINGS);
554  BCase(TLS);
555 #undef BCase
556 }
557 
559  IO &IO, WasmYAML::SymbolFlags &Value) {
560 #define BCaseMask(M, X) \
561  IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
562  // BCaseMask(BINDING_MASK, BINDING_GLOBAL);
563  BCaseMask(BINDING_MASK, BINDING_WEAK);
564  BCaseMask(BINDING_MASK, BINDING_LOCAL);
565  // BCaseMask(VISIBILITY_MASK, VISIBILITY_DEFAULT);
566  BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
567  BCaseMask(UNDEFINED, UNDEFINED);
568  BCaseMask(EXPORTED, EXPORTED);
569  BCaseMask(EXPLICIT_NAME, EXPLICIT_NAME);
570  BCaseMask(NO_STRIP, NO_STRIP);
571  BCaseMask(TLS, TLS);
572 #undef BCaseMask
573 }
574 
576  IO &IO, WasmYAML::SymbolKind &Kind) {
577 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
578  ECase(FUNCTION);
579  ECase(DATA);
580  ECase(GLOBAL);
581  ECase(TABLE);
582  ECase(SECTION);
583  ECase(TAG);
584 #undef ECase
585 }
586 
588  IO &IO, WasmYAML::ValueType &Type) {
589 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
590  ECase(I32);
591  ECase(I64);
592  ECase(F32);
593  ECase(F64);
594  ECase(V128);
595  ECase(FUNCREF);
596  ECase(EXTERNREF);
597  ECase(FUNC);
598 #undef ECase
599 }
600 
602  IO &IO, WasmYAML::ExportKind &Kind) {
603 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
604  ECase(FUNCTION);
605  ECase(TABLE);
606  ECase(MEMORY);
607  ECase(GLOBAL);
608  ECase(TAG);
609 #undef ECase
610 }
611 
613  IO &IO, WasmYAML::Opcode &Code) {
614 #define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
615  ECase(END);
616  ECase(I32_CONST);
617  ECase(I64_CONST);
618  ECase(F64_CONST);
619  ECase(F32_CONST);
620  ECase(GLOBAL_GET);
621  ECase(REF_NULL);
622 #undef ECase
623 }
624 
626  IO &IO, WasmYAML::TableType &Type) {
627 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
628  ECase(FUNCREF);
629  ECase(EXTERNREF);
630 #undef ECase
631 }
632 
634  IO &IO, WasmYAML::RelocType &Type) {
635 #define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
636 #include "llvm/BinaryFormat/WasmRelocs.def"
637 #undef WASM_RELOC
638  IO.enumFallback<Hex32>(Type);
639 }
640 
641 } // end namespace yaml
642 
643 } // end namespace llvm
llvm::wasm::WASM_SEC_EXPORT
@ WASM_SEC_EXPORT
Definition: Wasm.h:241
llvm::wasm::WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_SECTION
Definition: Wasm.h:370
llvm::WasmYAML::GlobalSection
Definition: WasmYAML.h:335
llvm::WasmYAML::FileHeader
Definition: WasmYAML.h:43
llvm::WasmYAML::ProducerEntry::Name
std::string Name
Definition: WasmYAML.h:133
llvm::WasmYAML::FeatureEntry::Name
std::string Name
Definition: WasmYAML.h:139
llvm::WasmYAML::InitFunction
Definition: WasmYAML.h:167
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::WasmYAML::Section::~Section
virtual ~Section()
llvm::yaml::ScalarEnumerationTraits< WasmYAML::FeaturePolicyPrefix >::enumeration
static void enumeration(IO &IO, WasmYAML::FeaturePolicyPrefix &Prefix)
Definition: WasmYAML.cpp:338
llvm::WasmYAML::ProducersSection
Definition: WasmYAML.h:251
llvm::wasm::WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
Definition: Wasm.h:325
llvm::WasmYAML::NameEntry::Index
uint32_t Index
Definition: WasmYAML.h:128
llvm::wasm::WASM_EXTERNAL_TABLE
@ WASM_EXTERNAL_TABLE
Definition: Wasm.h:266
llvm::wasm::WASM_SEC_START
@ WASM_SEC_START
Definition: Wasm.h:242
llvm::WasmYAML::FileHeader::Version
yaml::Hex32 Version
Definition: WasmYAML.h:44
llvm::yaml::ScalarEnumerationTraits< WasmYAML::TableType >::enumeration
static void enumeration(IO &IO, WasmYAML::TableType &Type)
Definition: WasmYAML.cpp:625
llvm::WasmYAML::LocalDecl
Definition: WasmYAML.h:99
llvm::yaml::ScalarEnumerationTraits< WasmYAML::ValueType >::enumeration
static void enumeration(IO &IO, WasmYAML::ValueType &Type)
Definition: WasmYAML.cpp:587
llvm::Function
Definition: Function.h:61
StringRef.h
llvm::yaml::ScalarEnumerationTraits< WasmYAML::Opcode >::enumeration
static void enumeration(IO &IO, WasmYAML::Opcode &Opcode)
Definition: WasmYAML.cpp:612
llvm::WasmYAML::Comdat
Definition: WasmYAML.h:177
llvm::codeview::SymbolKind
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:47
TAG
static constexpr auto TAG
Definition: OpenMPOpt.cpp:143
llvm::yaml::ScalarEnumerationTraits< WasmYAML::SectionType >::enumeration
static void enumeration(IO &IO, WasmYAML::SectionType &Type)
Definition: WasmYAML.cpp:278
ErrorHandling.h
llvm::wasm::WASM_SYMBOL_TYPE_TABLE
@ WASM_SYMBOL_TYPE_TABLE
Definition: Wasm.h:372
llvm::wasm::WASM_SEC_CODE
@ WASM_SEC_CODE
Definition: Wasm.h:244
llvm::wasm::WASM_EXTERNAL_MEMORY
@ WASM_EXTERNAL_MEMORY
Definition: Wasm.h:267
llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_GLOBAL
Definition: Wasm.h:369
llvm::WasmYAML::DataSection
Definition: WasmYAML.h:385
llvm::WasmYAML::DataSegment::Offset
wasm::WasmInitExpr Offset
Definition: WasmYAML.h:123
llvm::yaml::ScalarEnumerationTraits< WasmYAML::ExportKind >::enumeration
static void enumeration(IO &IO, WasmYAML::ExportKind &Kind)
Definition: WasmYAML.cpp:601
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::WasmYAML::TableSection
Definition: WasmYAML.h:305
llvm::WasmYAML::ElemSection
Definition: WasmYAML.h:365
llvm::WasmYAML::SegmentInfo::Name
StringRef Name
Definition: WasmYAML.h:144
llvm::wasm::WASM_OPCODE_GLOBAL_GET
@ WASM_OPCODE_GLOBAL_GET
Definition: Wasm.h:278
llvm::wasm::WASM_SYMBOL_UNDEFINED
const unsigned WASM_SYMBOL_UNDEFINED
Definition: Wasm.h:393
llvm::WasmYAML::ElemSegment
Definition: WasmYAML.h:65
llvm::WasmYAML::Relocation::Offset
yaml::Hex32 Offset
Definition: WasmYAML.h:115
llvm::WasmYAML::MemorySection
Definition: WasmYAML.h:315
llvm::wasm::WASM_SEC_GLOBAL
@ WASM_SEC_GLOBAL
Definition: Wasm.h:240
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:52
llvm::WasmYAML::ProducerEntry
Definition: WasmYAML.h:132
llvm::wasm::WASM_TYPE_EXTERNREF
@ WASM_TYPE_EXTERNREF
Definition: Wasm.h:258
llvm::MachO::SymbolFlags
SymbolFlags
Symbol flags.
Definition: Symbol.h:25
llvm::wasm::WASM_SEC_MEMORY
@ WASM_SEC_MEMORY
Definition: Wasm.h:239
llvm::WasmYAML::Import
Definition: WasmYAML.h:86
llvm::WasmYAML::CustomSection
Definition: WasmYAML.h:190
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::WasmYAML::ProducerEntry::Version
std::string Version
Definition: WasmYAML.h:134
llvm::WasmYAML::ComdatEntry::Index
uint32_t Index
Definition: WasmYAML.h:174
llvm::WasmYAML::SegmentInfo::Index
uint32_t Index
Definition: WasmYAML.h:143
llvm::wasm::WasmInitExpr::Global
uint32_t Global
Definition: Wasm.h:94
llvm::WasmYAML::NameSection
Definition: WasmYAML.h:223
llvm::WasmYAML::DataSegment::Content
yaml::BinaryRef Content
Definition: WasmYAML.h:124
llvm::WasmYAML::Section
Definition: WasmYAML.h:182
llvm::WasmYAML::Relocation::Type
RelocType Type
Definition: WasmYAML.h:111
llvm::wasm::WASM_SEC_TYPE
@ WASM_SEC_TYPE
Definition: Wasm.h:235
llvm::WasmYAML::FunctionSection
Definition: WasmYAML.h:295
llvm::wasm::WasmInitExpr::Float64
uint64_t Float64
Definition: Wasm.h:93
llvm::wasm::WASM_SEC_DATACOUNT
@ WASM_SEC_DATACOUNT
Definition: Wasm.h:246
llvm::wasm::WasmInitExpr::Value
union llvm::wasm::WasmInitExpr::@163 Value
llvm::WasmYAML::Limits::Maximum
yaml::Hex32 Maximum
Definition: WasmYAML.h:50
llvm::wasm::WasmInitExpr::Int64
int64_t Int64
Definition: Wasm.h:91
llvm::yaml::ScalarBitSetTraits< WasmYAML::SymbolFlags >::bitset
static void bitset(IO &IO, WasmYAML::SymbolFlags &Value)
Definition: WasmYAML.cpp:558
llvm::wasm::WASM_SEC_ELEM
@ WASM_SEC_ELEM
Definition: Wasm.h:243
llvm::WasmYAML::ComdatEntry
Definition: WasmYAML.h:172
llvm::WasmYAML::Signature::ReturnTypes
std::vector< ValueType > ReturnTypes
Definition: WasmYAML.h:153
llvm::WasmYAML::CodeSection
Definition: WasmYAML.h:375
llvm::WasmYAML::NameEntry
Definition: WasmYAML.h:127
llvm::WasmYAML::Table::TableLimits
Limits TableLimits
Definition: WasmYAML.h:55
llvm::wasm::WASM_DATA_SEGMENT_HAS_MEMINDEX
@ WASM_DATA_SEGMENT_HAS_MEMINDEX
Definition: Wasm.h:317
llvm::AMDGPU::ElfNote::SectionName
const char SectionName[]
Definition: AMDGPUPTNote.h:24
llvm::WasmYAML::SegmentInfo::Flags
SegmentFlags Flags
Definition: WasmYAML.h:146
llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION
@ WASM_SYMBOL_TYPE_FUNCTION
Definition: Wasm.h:367
llvm::WasmYAML::SymbolInfo
Definition: WasmYAML.h:156
llvm::WasmYAML::Function
Definition: WasmYAML.h:104
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::WasmYAML::Limits
Definition: WasmYAML.h:47
llvm::wasm::WASM_SEC_DATA
@ WASM_SEC_DATA
Definition: Wasm.h:245
llvm::Comdat
Definition: Comdat.h:31
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::PassSummaryAction::Import
@ Import
Import information from summary.
llvm::WasmYAML::ExportSection
Definition: WasmYAML.h:345
llvm::wasm::WasmInitExpr::Float32
uint32_t Float32
Definition: Wasm.h:92
llvm::WasmYAML::Signature::Index
uint32_t Index
Definition: WasmYAML.h:150
llvm::WasmYAML::ElemSegment::Functions
std::vector< uint32_t > Functions
Definition: WasmYAML.h:70
llvm::WasmYAML::ElemSegment::Flags
uint32_t Flags
Definition: WasmYAML.h:66
llvm::WasmYAML::SegmentInfo
Definition: WasmYAML.h:142
llvm::OutputFileType::Object
@ Object
WasmYAML.h
llvm::WasmYAML::Relocation::Index
uint32_t Index
Definition: WasmYAML.h:112
ECase
#define ECase(X)
llvm::wasm::WASM_OPCODE_F64_CONST
@ WASM_OPCODE_F64_CONST
Definition: Wasm.h:285
llvm::WasmYAML::DylinkExport
Definition: WasmYAML.h:202
llvm::wasm::WASM_EXTERNAL_TAG
@ WASM_EXTERNAL_TAG
Definition: Wasm.h:269
llvm::wasm::WASM_SEC_IMPORT
@ WASM_SEC_IMPORT
Definition: Wasm.h:236
llvm::DepClassTy::REQUIRED
@ REQUIRED
The target cannot be valid if the source is not.
llvm::WasmYAML::Table::Index
uint32_t Index
Definition: WasmYAML.h:56
llvm::wasm::WASM_OPCODE_F32_CONST
@ WASM_OPCODE_F32_CONST
Definition: Wasm.h:284
llvm::WasmYAML::Table
Definition: WasmYAML.h:53
llvm::WasmYAML::StartSection
Definition: WasmYAML.h:355
llvm::SectionName::Name
StringRef Name
Definition: DWARFSection.h:22
llvm::WasmYAML::TargetFeaturesSection
Definition: WasmYAML.h:264
llvm::WasmYAML::ElemSegment::Offset
wasm::WasmInitExpr Offset
Definition: WasmYAML.h:69
llvm::yaml::ScalarBitSetTraits< WasmYAML::SegmentFlags >::bitset
static void bitset(IO &IO, WasmYAML::SegmentFlags &Value)
Definition: WasmYAML.cpp:550
llvm::wasm::WASM_SYMBOL_TYPE_TAG
@ WASM_SYMBOL_TYPE_TAG
Definition: Wasm.h:371
llvm::AMDGPU::HSAMD::ValueType
ValueType
Value types.
Definition: AMDGPUMetadata.h:95
llvm::WasmYAML::FeatureEntry
Definition: WasmYAML.h:137
llvm::WasmYAML::Table::ElemType
TableType ElemType
Definition: WasmYAML.h:54
llvm::WasmYAML::FeatureEntry::Prefix
FeaturePolicyPrefix Prefix
Definition: WasmYAML.h:138
llvm::wasm::WASM_OPCODE_I32_CONST
@ WASM_OPCODE_I32_CONST
Definition: Wasm.h:282
llvm::yaml::ScalarEnumerationTraits< WasmYAML::ComdatKind >::enumeration
static void enumeration(IO &IO, WasmYAML::ComdatKind &Kind)
Definition: WasmYAML.cpp:480
llvm::yaml::sectionMapping
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section)
Definition: ELFYAML.cpp:1264
BCase
#define BCase(X)
YAMLTraits.h
llvm::WasmYAML::ElemSegment::TableNumber
uint32_t TableNumber
Definition: WasmYAML.h:67
llvm::wasm::WasmInitExpr::Int32
int32_t Int32
Definition: Wasm.h:90
llvm::WasmYAML::Signature
Definition: WasmYAML.h:149
llvm::WasmYAML::ComdatEntry::Kind
ComdatKind Kind
Definition: WasmYAML.h:173
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::WasmYAML::Relocation::Addend
int64_t Addend
Definition: WasmYAML.h:116
llvm::yaml::commonSectionMapping
static void commonSectionMapping(IO &IO, ELFYAML::Section &Section)
Definition: ELFYAML.cpp:1237
llvm::WasmYAML::LocalDecl::Count
uint32_t Count
Definition: WasmYAML.h:101
llvm::WasmYAML::Relocation
Definition: WasmYAML.h:110
llvm::wasm::WASM_SEC_FUNCTION
@ WASM_SEC_FUNCTION
Definition: Wasm.h:237
llvm::Init
Definition: Record.h:271
llvm::WasmYAML::Object
Definition: WasmYAML.h:405
llvm::WasmYAML::DataCountSection
Definition: WasmYAML.h:395
llvm::WasmYAML::DataSegment::InitFlags
uint32_t InitFlags
Definition: WasmYAML.h:121
llvm::WasmYAML::TagSection
Definition: WasmYAML.h:325
llvm::wasm::WASM_DATA_SEGMENT_IS_PASSIVE
@ WASM_DATA_SEGMENT_IS_PASSIVE
Definition: Wasm.h:316
llvm::WasmYAML::DataSegment
Definition: WasmYAML.h:119
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:321
llvm::WasmYAML::DataSegment::MemoryIndex
uint32_t MemoryIndex
Definition: WasmYAML.h:122
llvm::WasmYAML::Limits::Flags
LimitFlags Flags
Definition: WasmYAML.h:48
llvm::WasmYAML::SegmentInfo::Alignment
uint32_t Alignment
Definition: WasmYAML.h:145
llvm::SectionName
Definition: DWARFSection.h:21
llvm::wasm::WASM_SEC_TAG
@ WASM_SEC_TAG
Definition: Wasm.h:247
Casting.h
llvm::WasmYAML::LinkingSection
Definition: WasmYAML.h:236
llvm::WasmYAML::Global
Definition: WasmYAML.h:73
llvm::wasm::WASM_EXTERNAL_FUNCTION
@ WASM_EXTERNAL_FUNCTION
Definition: Wasm.h:265
llvm::yaml::ScalarEnumerationTraits< WasmYAML::RelocType >::enumeration
static void enumeration(IO &IO, WasmYAML::RelocType &Kind)
Definition: WasmYAML.cpp:633
llvm::wasm::WasmInitExpr
Definition: Wasm.h:87
llvm::yaml::ScalarBitSetTraits< WasmYAML::LimitFlags >::bitset
static void bitset(IO &IO, WasmYAML::LimitFlags &Value)
Definition: WasmYAML.cpp:541
llvm::WasmYAML::NameEntry::Name
StringRef Name
Definition: WasmYAML.h:129
llvm::WasmYAML::Limits::Minimum
yaml::Hex32 Minimum
Definition: WasmYAML.h:49
llvm::WasmYAML::Export
Definition: WasmYAML.h:59
BCaseMask
#define BCaseMask(M, X)
llvm::WasmYAML::TypeSection
Definition: WasmYAML.h:275
llvm::wasm::WASM_LIMITS_FLAG_HAS_MAX
@ WASM_LIMITS_FLAG_HAS_MAX
Definition: Wasm.h:310
llvm::yaml::ScalarEnumerationTraits< WasmYAML::SymbolKind >::enumeration
static void enumeration(IO &IO, WasmYAML::SymbolKind &Kind)
Definition: WasmYAML.cpp:575
llvm::WasmYAML::Signature::ParamTypes
std::vector< ValueType > ParamTypes
Definition: WasmYAML.h:152
llvm::wasm::WASM_EXTERNAL_GLOBAL
@ WASM_EXTERNAL_GLOBAL
Definition: Wasm.h:268
llvm::wasm::WASM_SEC_TABLE
@ WASM_SEC_TABLE
Definition: Wasm.h:238
llvm::wasm::WASM_OPCODE_REF_NULL
@ WASM_OPCODE_REF_NULL
Definition: Wasm.h:288
llvm::WasmYAML::ElemSegment::ElemKind
ValueType ElemKind
Definition: WasmYAML.h:68
llvm::wasm::WasmInitExpr::Opcode
uint8_t Opcode
Definition: Wasm.h:88
llvm::wasm::WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
@ WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
Definition: Wasm.h:322
llvm::WasmYAML::LocalDecl::Type
ValueType Type
Definition: WasmYAML.h:100
llvm::WasmYAML::DataSegment::SectionOffset
uint32_t SectionOffset
Definition: WasmYAML.h:120
llvm::WasmYAML::ImportSection
Definition: WasmYAML.h:285
llvm::WasmYAML::Tag
Definition: WasmYAML.h:80
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::wasm::WASM_SYMBOL_TYPE_DATA
@ WASM_SYMBOL_TYPE_DATA
Definition: Wasm.h:368
llvm::MachO::SectionType
SectionType
These are the section type and attributes fields.
Definition: MachO.h:120
llvm::wasm::WASM_SEC_CUSTOM
@ WASM_SEC_CUSTOM
Definition: Wasm.h:234
llvm::wasm::WASM_OPCODE_I64_CONST
@ WASM_OPCODE_I64_CONST
Definition: Wasm.h:283