LLVM 18.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"
18
19namespace llvm {
20
21namespace 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
25Section::~Section() = default;
26
27} // end namespace WasmYAML
28
29namespace 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
45static void commonSectionMapping(IO &IO, WasmYAML::Section &Section) {
46 IO.mapRequired("Type", Section.Type);
47 IO.mapOptional("Relocations", Section.Relocations);
48 IO.mapOptional("HeaderSecSizeEncodingLen", Section.HeaderSecSizeEncodingLen);
49}
50
51static void sectionMapping(IO &IO, WasmYAML::DylinkSection &Section) {
52 commonSectionMapping(IO, Section);
53 IO.mapRequired("Name", Section.Name);
54 IO.mapRequired("MemorySize", Section.MemorySize);
55 IO.mapRequired("MemoryAlignment", Section.MemoryAlignment);
56 IO.mapRequired("TableSize", Section.TableSize);
57 IO.mapRequired("TableAlignment", Section.TableAlignment);
58 IO.mapRequired("Needed", Section.Needed);
59 IO.mapOptional("ImportInfo", Section.ImportInfo);
60 IO.mapOptional("ExportInfo", Section.ExportInfo);
61}
62
63static void sectionMapping(IO &IO, WasmYAML::NameSection &Section) {
64 commonSectionMapping(IO, Section);
65 IO.mapRequired("Name", Section.Name);
66 IO.mapOptional("FunctionNames", Section.FunctionNames);
67 IO.mapOptional("GlobalNames", Section.GlobalNames);
68 IO.mapOptional("DataSegmentNames", Section.DataSegmentNames);
69}
70
71static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) {
72 commonSectionMapping(IO, Section);
73 IO.mapRequired("Name", Section.Name);
74 IO.mapRequired("Version", Section.Version);
75 IO.mapOptional("SymbolTable", Section.SymbolTable);
76 IO.mapOptional("SegmentInfo", Section.SegmentInfos);
77 IO.mapOptional("InitFunctions", Section.InitFunctions);
78 IO.mapOptional("Comdats", Section.Comdats);
79}
80
81static void sectionMapping(IO &IO, WasmYAML::ProducersSection &Section) {
82 commonSectionMapping(IO, Section);
83 IO.mapRequired("Name", Section.Name);
84 IO.mapOptional("Languages", Section.Languages);
85 IO.mapOptional("Tools", Section.Tools);
86 IO.mapOptional("SDKs", Section.SDKs);
87}
88
89static void sectionMapping(IO &IO, WasmYAML::TargetFeaturesSection &Section) {
90 commonSectionMapping(IO, Section);
91 IO.mapRequired("Name", Section.Name);
92 IO.mapRequired("Features", Section.Features);
93}
94
95static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) {
96 commonSectionMapping(IO, Section);
97 IO.mapRequired("Name", Section.Name);
98 IO.mapRequired("Payload", Section.Payload);
99}
100
101static void sectionMapping(IO &IO, WasmYAML::TypeSection &Section) {
102 commonSectionMapping(IO, Section);
103 IO.mapOptional("Signatures", Section.Signatures);
104}
105
106static void sectionMapping(IO &IO, WasmYAML::ImportSection &Section) {
107 commonSectionMapping(IO, Section);
108 IO.mapOptional("Imports", Section.Imports);
109}
110
111static void sectionMapping(IO &IO, WasmYAML::FunctionSection &Section) {
112 commonSectionMapping(IO, Section);
113 IO.mapOptional("FunctionTypes", Section.FunctionTypes);
114}
115
116static void sectionMapping(IO &IO, WasmYAML::TableSection &Section) {
117 commonSectionMapping(IO, Section);
118 IO.mapOptional("Tables", Section.Tables);
119}
120
121static void sectionMapping(IO &IO, WasmYAML::MemorySection &Section) {
122 commonSectionMapping(IO, Section);
123 IO.mapOptional("Memories", Section.Memories);
124}
125
126static void sectionMapping(IO &IO, WasmYAML::TagSection &Section) {
127 commonSectionMapping(IO, Section);
128 IO.mapOptional("TagTypes", Section.TagTypes);
129}
130
131static void sectionMapping(IO &IO, WasmYAML::GlobalSection &Section) {
132 commonSectionMapping(IO, Section);
133 IO.mapOptional("Globals", Section.Globals);
134}
135
136static void sectionMapping(IO &IO, WasmYAML::ExportSection &Section) {
137 commonSectionMapping(IO, Section);
138 IO.mapOptional("Exports", Section.Exports);
139}
140
141static void sectionMapping(IO &IO, WasmYAML::StartSection &Section) {
142 commonSectionMapping(IO, Section);
143 IO.mapOptional("StartFunction", Section.StartFunction);
144}
145
146static void sectionMapping(IO &IO, WasmYAML::ElemSection &Section) {
147 commonSectionMapping(IO, Section);
148 IO.mapOptional("Segments", Section.Segments);
149}
150
151static void sectionMapping(IO &IO, WasmYAML::CodeSection &Section) {
152 commonSectionMapping(IO, Section);
153 IO.mapRequired("Functions", Section.Functions);
154}
155
156static void sectionMapping(IO &IO, WasmYAML::DataSection &Section) {
157 commonSectionMapping(IO, Section);
158 IO.mapRequired("Segments", Section.Segments);
159}
160
161static void sectionMapping(IO &IO, WasmYAML::DataCountSection &Section) {
162 commonSectionMapping(IO, Section);
163 IO.mapRequired("Count", Section.Count);
164}
165
167 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
168 WasmYAML::SectionType SectionType;
169 if (IO.outputting())
170 SectionType = Section->Type;
171 else
172 IO.mapRequired("Type", SectionType);
173
174 switch (SectionType) {
177 if (IO.outputting()) {
178 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
179 SectionName = CustomSection->Name;
180 } else {
181 IO.mapRequired("Name", SectionName);
182 }
183 if (SectionName == "dylink" || SectionName == "dylink.0") {
184 if (!IO.outputting())
185 Section.reset(new WasmYAML::DylinkSection());
186 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
187 } else if (SectionName == "linking") {
188 if (!IO.outputting())
189 Section.reset(new WasmYAML::LinkingSection());
190 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
191 } else if (SectionName == "name") {
192 if (!IO.outputting())
193 Section.reset(new WasmYAML::NameSection());
194 sectionMapping(IO, *cast<WasmYAML::NameSection>(Section.get()));
195 } else if (SectionName == "producers") {
196 if (!IO.outputting())
197 Section.reset(new WasmYAML::ProducersSection());
198 sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
199 } else if (SectionName == "target_features") {
200 if (!IO.outputting())
201 Section.reset(new WasmYAML::TargetFeaturesSection());
202 sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
203 } else {
204 if (!IO.outputting())
205 Section.reset(new WasmYAML::CustomSection(SectionName));
206 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
207 }
208 break;
209 }
211 if (!IO.outputting())
212 Section.reset(new WasmYAML::TypeSection());
213 sectionMapping(IO, *cast<WasmYAML::TypeSection>(Section.get()));
214 break;
216 if (!IO.outputting())
217 Section.reset(new WasmYAML::ImportSection());
218 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
219 break;
221 if (!IO.outputting())
222 Section.reset(new WasmYAML::FunctionSection());
223 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
224 break;
226 if (!IO.outputting())
227 Section.reset(new WasmYAML::TableSection());
228 sectionMapping(IO, *cast<WasmYAML::TableSection>(Section.get()));
229 break;
231 if (!IO.outputting())
232 Section.reset(new WasmYAML::MemorySection());
233 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
234 break;
236 if (!IO.outputting())
237 Section.reset(new WasmYAML::TagSection());
238 sectionMapping(IO, *cast<WasmYAML::TagSection>(Section.get()));
239 break;
241 if (!IO.outputting())
242 Section.reset(new WasmYAML::GlobalSection());
243 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
244 break;
246 if (!IO.outputting())
247 Section.reset(new WasmYAML::ExportSection());
248 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
249 break;
251 if (!IO.outputting())
252 Section.reset(new WasmYAML::StartSection());
253 sectionMapping(IO, *cast<WasmYAML::StartSection>(Section.get()));
254 break;
256 if (!IO.outputting())
257 Section.reset(new WasmYAML::ElemSection());
258 sectionMapping(IO, *cast<WasmYAML::ElemSection>(Section.get()));
259 break;
261 if (!IO.outputting())
262 Section.reset(new WasmYAML::CodeSection());
263 sectionMapping(IO, *cast<WasmYAML::CodeSection>(Section.get()));
264 break;
266 if (!IO.outputting())
267 Section.reset(new WasmYAML::DataSection());
268 sectionMapping(IO, *cast<WasmYAML::DataSection>(Section.get()));
269 break;
271 if (!IO.outputting())
272 Section.reset(new WasmYAML::DataCountSection());
273 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
274 break;
275 default:
276 llvm_unreachable("Unknown section type");
277 }
278}
279
280void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
281 IO &IO, WasmYAML::SectionType &Type) {
282#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
283 ECase(CUSTOM);
284 ECase(TYPE);
285 ECase(IMPORT);
287 ECase(TABLE);
288 ECase(MEMORY);
289 ECase(GLOBAL);
290 ECase(TAG);
291 ECase(EXPORT);
292 ECase(START);
293 ECase(ELEM);
294 ECase(CODE);
295 ECase(DATA);
296 ECase(DATACOUNT);
297#undef ECase
298}
299
301 IO &IO, WasmYAML::Signature &Signature) {
302 IO.mapRequired("Index", Signature.Index);
303 IO.mapRequired("ParamTypes", Signature.ParamTypes);
304 IO.mapRequired("ReturnTypes", Signature.ReturnTypes);
305}
306
308 IO.mapRequired("Index", Table.Index);
309 IO.mapRequired("ElemType", Table.ElemType);
310 IO.mapRequired("Limits", Table.TableLimits);
311}
312
315 IO.mapRequired("Index", Function.Index);
316 IO.mapRequired("Locals", Function.Locals);
317 IO.mapRequired("Body", Function.Body);
318}
319
321 IO &IO, WasmYAML::Relocation &Relocation) {
322 IO.mapRequired("Type", Relocation.Type);
323 IO.mapRequired("Index", Relocation.Index);
324 IO.mapRequired("Offset", Relocation.Offset);
325 IO.mapOptional("Addend", Relocation.Addend, 0);
326}
327
329 IO &IO, WasmYAML::NameEntry &NameEntry) {
330 IO.mapRequired("Index", NameEntry.Index);
331 IO.mapRequired("Name", NameEntry.Name);
332}
333
335 IO &IO, WasmYAML::ProducerEntry &ProducerEntry) {
336 IO.mapRequired("Name", ProducerEntry.Name);
337 IO.mapRequired("Version", ProducerEntry.Version);
338}
339
340void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
341 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
342#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
343 ECase(USED);
345 ECase(DISALLOWED);
346#undef ECase
347}
348
350 IO &IO, WasmYAML::FeatureEntry &FeatureEntry) {
351 IO.mapRequired("Prefix", FeatureEntry.Prefix);
352 IO.mapRequired("Name", FeatureEntry.Name);
353}
354
356 IO &IO, WasmYAML::SegmentInfo &SegmentInfo) {
357 IO.mapRequired("Index", SegmentInfo.Index);
358 IO.mapRequired("Name", SegmentInfo.Name);
359 IO.mapRequired("Alignment", SegmentInfo.Alignment);
360 IO.mapRequired("Flags", SegmentInfo.Flags);
361}
362
364 IO &IO, WasmYAML::LocalDecl &LocalDecl) {
365 IO.mapRequired("Type", LocalDecl.Type);
366 IO.mapRequired("Count", LocalDecl.Count);
367}
368
370 WasmYAML::Limits &Limits) {
371 IO.mapOptional("Flags", Limits.Flags, 0);
372 IO.mapRequired("Minimum", Limits.Minimum);
373 if (!IO.outputting() || Limits.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
374 IO.mapOptional("Maximum", Limits.Maximum);
375}
376
378 IO &IO, WasmYAML::ElemSegment &Segment) {
379 IO.mapOptional("Flags", Segment.Flags, 0);
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
392 IO.mapRequired("Module", Import.Module);
393 IO.mapRequired("Field", Import.Field);
394 IO.mapRequired("Kind", Import.Kind);
397 IO.mapRequired("SigIndex", Import.SigIndex);
398 } else if (Import.Kind == wasm::WASM_EXTERNAL_GLOBAL) {
399 IO.mapRequired("GlobalType", Import.GlobalImport.Type);
400 IO.mapRequired("GlobalMutable", Import.GlobalImport.Mutable);
401 } else if (Import.Kind == wasm::WASM_EXTERNAL_TABLE) {
402 IO.mapRequired("Table", Import.TableImport);
403 } else if (Import.Kind == wasm::WASM_EXTERNAL_MEMORY) {
404 IO.mapRequired("Memory", Import.Memory);
405 } else {
406 llvm_unreachable("unhandled import type");
407 }
408}
409
412 IO.mapRequired("Name", Export.Name);
413 IO.mapRequired("Kind", Export.Kind);
414 IO.mapRequired("Index", Export.Index);
415}
416
419 IO.mapRequired("Index", Global.Index);
420 IO.mapRequired("Type", Global.Type);
421 IO.mapRequired("Mutable", Global.Mutable);
422 IO.mapRequired("InitExpr", Global.Init);
423}
424
426 WasmYAML::InitExpr &Expr) {
427 IO.mapOptional("Extended", Expr.Extended, false);
428 if (Expr.Extended) {
429 IO.mapRequired("Body", Expr.Body);
430 } else {
431 WasmYAML::Opcode Op = Expr.Inst.Opcode;
432 IO.mapRequired("Opcode", Op);
433 Expr.Inst.Opcode = Op;
434 switch (Expr.Inst.Opcode) {
436 IO.mapRequired("Value", Expr.Inst.Value.Int32);
437 break;
439 IO.mapRequired("Value", Expr.Inst.Value.Int64);
440 break;
442 IO.mapRequired("Value", Expr.Inst.Value.Float32);
443 break;
445 IO.mapRequired("Value", Expr.Inst.Value.Float64);
446 break;
448 IO.mapRequired("Index", Expr.Inst.Value.Global);
449 break;
451 WasmYAML::ValueType Ty = wasm::WASM_TYPE_EXTERNREF;
452 IO.mapRequired("Type", Ty);
453 break;
454 }
455 }
456 }
457}
458
460 IO &IO, WasmYAML::DataSegment &Segment) {
461 IO.mapOptional("SectionOffset", Segment.SectionOffset);
462 IO.mapRequired("InitFlags", Segment.InitFlags);
464 IO.mapRequired("MemoryIndex", Segment.MemoryIndex);
465 } else {
466 Segment.MemoryIndex = 0;
467 }
468 if ((Segment.InitFlags & wasm::WASM_DATA_SEGMENT_IS_PASSIVE) == 0) {
469 IO.mapRequired("Offset", Segment.Offset);
470 } else {
472 Segment.Offset.Inst.Value.Int32 = 0;
473 }
474 IO.mapRequired("Content", Segment.Content);
475}
476
478 IO &IO, WasmYAML::InitFunction &Init) {
479 IO.mapRequired("Priority", Init.Priority);
480 IO.mapRequired("Symbol", Init.Symbol);
481}
482
483void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
484 IO &IO, WasmYAML::ComdatKind &Kind) {
485#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
487 ECase(DATA);
488 ECase(SECTION);
489#undef ECase
490}
491
493 IO &IO, WasmYAML::ComdatEntry &ComdatEntry) {
494 IO.mapRequired("Kind", ComdatEntry.Kind);
495 IO.mapRequired("Index", ComdatEntry.Index);
496}
497
500 IO.mapRequired("Name", Comdat.Name);
501 IO.mapRequired("Entries", Comdat.Entries);
502}
503
506 IO.mapRequired("Index", Info.Index);
507 IO.mapRequired("Kind", Info.Kind);
509 IO.mapRequired("Name", Info.Name);
510 IO.mapRequired("Flags", Info.Flags);
512 IO.mapRequired("Function", Info.ElementIndex);
513 } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_GLOBAL) {
514 IO.mapRequired("Global", Info.ElementIndex);
515 } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TABLE) {
516 IO.mapRequired("Table", Info.ElementIndex);
517 } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG) {
518 IO.mapRequired("Tag", Info.ElementIndex);
519 } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_DATA) {
520 if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) {
521 IO.mapRequired("Segment", Info.DataRef.Segment);
522 IO.mapOptional("Offset", Info.DataRef.Offset, 0u);
523 IO.mapRequired("Size", Info.DataRef.Size);
524 }
525 } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_SECTION) {
526 IO.mapRequired("Section", Info.ElementIndex);
527 } else {
528 llvm_unreachable("unsupported symbol kind");
529 }
530}
531
534 IO.mapRequired("Module", Info.Module);
535 IO.mapRequired("Field", Info.Field);
536 IO.mapRequired("Flags", Info.Flags);
537}
538
541 IO.mapRequired("Name", Info.Name);
542 IO.mapRequired("Flags", Info.Flags);
543}
544
545void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
546 IO &IO, WasmYAML::LimitFlags &Value) {
547#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
548 BCase(HAS_MAX);
549 BCase(IS_SHARED);
550 BCase(IS_64);
551#undef BCase
552}
553
554void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
555 IO &IO, WasmYAML::SegmentFlags &Value) {
556#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
557 BCase(STRINGS);
558 BCase(TLS);
559#undef BCase
560}
561
562void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
563 IO &IO, WasmYAML::SymbolFlags &Value) {
564#define BCaseMask(M, X) \
565 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
566 // BCaseMask(BINDING_MASK, BINDING_GLOBAL);
567 BCaseMask(BINDING_MASK, BINDING_WEAK);
568 BCaseMask(BINDING_MASK, BINDING_LOCAL);
569 // BCaseMask(VISIBILITY_MASK, VISIBILITY_DEFAULT);
570 BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
572 BCaseMask(EXPORTED, EXPORTED);
573 BCaseMask(EXPLICIT_NAME, EXPLICIT_NAME);
574 BCaseMask(NO_STRIP, NO_STRIP);
575 BCaseMask(TLS, TLS);
576#undef BCaseMask
577}
578
579void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
580 IO &IO, WasmYAML::SymbolKind &Kind) {
581#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
583 ECase(DATA);
584 ECase(GLOBAL);
585 ECase(TABLE);
586 ECase(SECTION);
587 ECase(TAG);
588#undef ECase
589}
590
591void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
592 IO &IO, WasmYAML::ValueType &Type) {
593#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
594 ECase(I32);
595 ECase(I64);
596 ECase(F32);
597 ECase(F64);
598 ECase(V128);
599 ECase(FUNCREF);
600 ECase(EXTERNREF);
601 ECase(FUNC);
602#undef ECase
603}
604
605void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
606 IO &IO, WasmYAML::ExportKind &Kind) {
607#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
609 ECase(TABLE);
610 ECase(MEMORY);
611 ECase(GLOBAL);
612 ECase(TAG);
613#undef ECase
614}
615
616void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
617 IO &IO, WasmYAML::Opcode &Code) {
618#define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
619 ECase(END);
620 ECase(I32_CONST);
621 ECase(I64_CONST);
622 ECase(F64_CONST);
623 ECase(F32_CONST);
624 ECase(GLOBAL_GET);
625 ECase(REF_NULL);
626#undef ECase
627}
628
629void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
630 IO &IO, WasmYAML::TableType &Type) {
631#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
632 ECase(FUNCREF);
633 ECase(EXTERNREF);
634#undef ECase
635}
636
637void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
638 IO &IO, WasmYAML::RelocType &Type) {
639#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
640#include "llvm/BinaryFormat/WasmRelocs.def"
641#undef WASM_RELOC
642 IO.enumFallback<Hex32>(Type);
643}
644
645} // end namespace yaml
646
647} // end namespace llvm
#define BCase(X)
Definition: COFFYAML.cpp:248
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
#define BCaseMask(X, M)
#define FUNCTION(NAME, NARG, ROUND_MODE, INTRINSIC)
static constexpr auto TAG
Definition: OpenMPOpt.cpp:183
This file declares classes for handling the YAML representation of wasm binaries.
#define ECase(X)
@ UNDEFINED
This class represents an Operation in the Expression.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr uint16_t VISIBILITY_MASK
Definition: XCOFF.h:258
const unsigned WASM_SYMBOL_UNDEFINED
Definition: Wasm.h:410
@ WASM_DATA_SEGMENT_IS_PASSIVE
Definition: Wasm.h:331
@ WASM_DATA_SEGMENT_HAS_MEMINDEX
Definition: Wasm.h:332
@ WASM_OPCODE_F64_CONST
Definition: Wasm.h:295
@ WASM_OPCODE_REF_NULL
Definition: Wasm.h:302
@ WASM_OPCODE_F32_CONST
Definition: Wasm.h:294
@ WASM_OPCODE_GLOBAL_GET
Definition: Wasm.h:288
@ WASM_OPCODE_I64_CONST
Definition: Wasm.h:293
@ WASM_OPCODE_I32_CONST
Definition: Wasm.h:292
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
Definition: Wasm.h:340
@ WASM_LIMITS_FLAG_HAS_MAX
Definition: Wasm.h:325
@ WASM_SYMBOL_TYPE_GLOBAL
Definition: Wasm.h:386
@ WASM_SYMBOL_TYPE_DATA
Definition: Wasm.h:385
@ WASM_SYMBOL_TYPE_TAG
Definition: Wasm.h:388
@ WASM_SYMBOL_TYPE_TABLE
Definition: Wasm.h:389
@ WASM_SYMBOL_TYPE_SECTION
Definition: Wasm.h:387
@ WASM_SYMBOL_TYPE_FUNCTION
Definition: Wasm.h:384
@ WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
Definition: Wasm.h:337
@ WASM_TYPE_EXTERNREF
Definition: Wasm.h:267
@ WASM_SEC_CODE
Definition: Wasm.h:252
@ WASM_SEC_MEMORY
Definition: Wasm.h:247
@ WASM_SEC_IMPORT
Definition: Wasm.h:244
@ WASM_SEC_EXPORT
Definition: Wasm.h:249
@ WASM_SEC_DATACOUNT
Definition: Wasm.h:254
@ WASM_SEC_CUSTOM
Definition: Wasm.h:242
@ WASM_SEC_FUNCTION
Definition: Wasm.h:245
@ WASM_SEC_ELEM
Definition: Wasm.h:251
@ WASM_SEC_START
Definition: Wasm.h:250
@ WASM_SEC_TABLE
Definition: Wasm.h:246
@ WASM_SEC_TYPE
Definition: Wasm.h:243
@ WASM_SEC_TAG
Definition: Wasm.h:255
@ WASM_SEC_GLOBAL
Definition: Wasm.h:248
@ WASM_SEC_DATA
Definition: Wasm.h:253
@ WASM_EXTERNAL_TABLE
Definition: Wasm.h:275
@ WASM_EXTERNAL_FUNCTION
Definition: Wasm.h:274
@ WASM_EXTERNAL_TAG
Definition: Wasm.h:278
@ WASM_EXTERNAL_MEMORY
Definition: Wasm.h:276
@ WASM_EXTERNAL_GLOBAL
Definition: Wasm.h:277
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section)
Definition: ELFYAML.cpp:1364
static void commonSectionMapping(IO &IO, ELFYAML::Section &Section)
Definition: ELFYAML.cpp:1337
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Export
Export information to summary.
@ Import
Import information from summary.
@ Global
Append to llvm.global_dtors.
DWARFExpression::Operation Op
@ REQUIRED
The target cannot be valid if the source is not.
yaml::BinaryRef Content
Definition: WasmYAML.h:128
std::vector< uint32_t > Functions
Definition: WasmYAML.h:79
FeaturePolicyPrefix Prefix
Definition: WasmYAML.h:142
wasm::WasmInitExprMVP Inst
Definition: WasmYAML.h:69
yaml::BinaryRef Body
Definition: WasmYAML.h:70
yaml::Hex32 Minimum
Definition: WasmYAML.h:49
LimitFlags Flags
Definition: WasmYAML.h:48
yaml::Hex32 Maximum
Definition: WasmYAML.h:50
std::vector< ValueType > ReturnTypes
Definition: WasmYAML.h:157
std::vector< ValueType > ParamTypes
Definition: WasmYAML.h:156
TableType ElemType
Definition: WasmYAML.h:54
union llvm::wasm::WasmInitExprMVP::@178 Value