33 IO.mapRequired(
"Version", FileHdr.
Version);
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);
46 IO.mapRequired(
"Type", Section.Type);
47 IO.mapOptional(
"Relocations", Section.Relocations);
48 IO.mapOptional(
"HeaderSecSizeEncodingLen", Section.HeaderSecSizeEncodingLen);
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);
65 IO.mapRequired(
"Name", Section.Name);
66 IO.mapOptional(
"FunctionNames", Section.FunctionNames);
67 IO.mapOptional(
"GlobalNames", Section.GlobalNames);
68 IO.mapOptional(
"DataSegmentNames", Section.DataSegmentNames);
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);
83 IO.mapRequired(
"Name", Section.Name);
84 IO.mapOptional(
"Languages", Section.Languages);
85 IO.mapOptional(
"Tools", Section.Tools);
86 IO.mapOptional(
"SDKs", Section.SDKs);
91 IO.mapRequired(
"Name", Section.Name);
92 IO.mapRequired(
"Features", Section.Features);
97 IO.mapRequired(
"Name", Section.Name);
98 IO.mapRequired(
"Payload", Section.Payload);
103 IO.mapOptional(
"Signatures", Section.Signatures);
108 IO.mapOptional(
"Imports", Section.Imports);
113 IO.mapOptional(
"FunctionTypes", Section.FunctionTypes);
118 IO.mapOptional(
"Tables", Section.Tables);
123 IO.mapOptional(
"Memories", Section.Memories);
128 IO.mapOptional(
"TagTypes", Section.TagTypes);
133 IO.mapOptional(
"Globals", Section.Globals);
138 IO.mapOptional(
"Exports", Section.Exports);
143 IO.mapOptional(
"StartFunction", Section.StartFunction);
148 IO.mapOptional(
"Segments", Section.Segments);
153 IO.mapRequired(
"Functions", Section.Functions);
158 IO.mapRequired(
"Segments", Section.Segments);
163 IO.mapRequired(
"Count", Section.Count);
167 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
168 WasmYAML::SectionType SectionType;
170 SectionType = Section->Type;
172 IO.mapRequired(
"Type", SectionType);
174 switch (SectionType) {
177 if (IO.outputting()) {
178 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
184 if (!IO.outputting())
186 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
188 if (!IO.outputting())
190 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
192 if (!IO.outputting())
196 if (!IO.outputting())
198 sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
200 if (!IO.outputting())
202 sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
204 if (!IO.outputting())
206 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
211 if (!IO.outputting())
216 if (!IO.outputting())
218 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
221 if (!IO.outputting())
223 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
226 if (!IO.outputting())
231 if (!IO.outputting())
233 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
236 if (!IO.outputting())
241 if (!IO.outputting())
243 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
246 if (!IO.outputting())
248 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
251 if (!IO.outputting())
256 if (!IO.outputting())
261 if (!IO.outputting())
266 if (!IO.outputting())
271 if (!IO.outputting())
273 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
280void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
281 IO &IO, WasmYAML::SectionType &
Type) {
282#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
302 IO.mapRequired(
"Index", Signature.
Index);
303 IO.mapRequired(
"ParamTypes", Signature.
ParamTypes);
304 IO.mapRequired(
"ReturnTypes", Signature.
ReturnTypes);
308 IO.mapRequired(
"Index", Table.
Index);
309 IO.mapRequired(
"ElemType", Table.
ElemType);
315 IO.mapRequired(
"Index",
Function.Index);
316 IO.mapRequired(
"Locals",
Function.Locals);
317 IO.mapRequired(
"Body",
Function.Body);
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);
330 IO.mapRequired(
"Index", NameEntry.
Index);
331 IO.mapRequired(
"Name", NameEntry.
Name);
336 IO.mapRequired(
"Name", ProducerEntry.
Name);
337 IO.mapRequired(
"Version", ProducerEntry.
Version);
340void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
341 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
342#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
351 IO.mapRequired(
"Prefix", FeatureEntry.
Prefix);
352 IO.mapRequired(
"Name", FeatureEntry.
Name);
357 IO.mapRequired(
"Index", SegmentInfo.
Index);
358 IO.mapRequired(
"Name", SegmentInfo.
Name);
359 IO.mapRequired(
"Alignment", SegmentInfo.
Alignment);
360 IO.mapRequired(
"Flags", SegmentInfo.
Flags);
365 IO.mapRequired(
"Type", LocalDecl.
Type);
366 IO.mapRequired(
"Count", LocalDecl.
Count);
371 IO.mapOptional(
"Flags", Limits.
Flags, 0);
372 IO.mapRequired(
"Minimum", Limits.
Minimum);
374 IO.mapOptional(
"Maximum", Limits.
Maximum);
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);
392 IO.mapRequired(
"Module",
Import.Module);
393 IO.mapRequired(
"Field",
Import.Field);
394 IO.mapRequired(
"Kind",
Import.Kind);
397 IO.mapRequired(
"SigIndex",
Import.SigIndex);
399 IO.mapRequired(
"GlobalType",
Import.GlobalImport.Type);
400 IO.mapRequired(
"GlobalMutable",
Import.GlobalImport.Mutable);
402 IO.mapRequired(
"Table",
Import.TableImport);
404 IO.mapRequired(
"Memory",
Import.Memory);
412 IO.mapRequired(
"Name",
Export.Name);
413 IO.mapRequired(
"Kind",
Export.Kind);
414 IO.mapRequired(
"Index",
Export.Index);
419 IO.mapRequired(
"Index",
Global.Index);
420 IO.mapRequired(
"Type",
Global.Type);
421 IO.mapRequired(
"Mutable",
Global.Mutable);
422 IO.mapRequired(
"InitExpr",
Global.Init);
427 IO.mapOptional(
"Extended", Expr.
Extended,
false);
429 IO.mapRequired(
"Body", Expr.
Body);
432 IO.mapRequired(
"Opcode",
Op);
452 IO.mapRequired(
"Type", Ty);
462 IO.mapRequired(
"InitFlags", Segment.
InitFlags);
464 IO.mapRequired(
"MemoryIndex", Segment.
MemoryIndex);
469 IO.mapRequired(
"Offset", Segment.
Offset);
474 IO.mapRequired(
"Content", Segment.
Content);
479 IO.mapRequired(
"Priority",
Init.Priority);
480 IO.mapRequired(
"Symbol",
Init.Symbol);
483void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
484 IO &IO, WasmYAML::ComdatKind &Kind) {
485#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
494 IO.mapRequired(
"Kind", ComdatEntry.
Kind);
495 IO.mapRequired(
"Index", ComdatEntry.
Index);
500 IO.mapRequired(
"Name",
Comdat.Name);
501 IO.mapRequired(
"Entries",
Comdat.Entries);
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);
514 IO.mapRequired(
"Global",
Info.ElementIndex);
516 IO.mapRequired(
"Table",
Info.ElementIndex);
518 IO.mapRequired(
"Tag",
Info.ElementIndex);
521 IO.mapRequired(
"Segment",
Info.DataRef.Segment);
522 IO.mapOptional(
"Offset",
Info.DataRef.Offset, 0u);
523 IO.mapRequired(
"Size",
Info.DataRef.Size);
526 IO.mapRequired(
"Section",
Info.ElementIndex);
534 IO.mapRequired(
"Module",
Info.Module);
535 IO.mapRequired(
"Field",
Info.Field);
536 IO.mapRequired(
"Flags",
Info.Flags);
541 IO.mapRequired(
"Name",
Info.Name);
542 IO.mapRequired(
"Flags",
Info.Flags);
545void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
546 IO &IO, WasmYAML::LimitFlags &
Value) {
547#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
554void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
555 IO &IO, WasmYAML::SegmentFlags &
Value) {
556#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
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)
579void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
580 IO &IO, WasmYAML::SymbolKind &Kind) {
581#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
591void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
592 IO &IO, WasmYAML::ValueType &
Type) {
593#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
605void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
606 IO &IO, WasmYAML::ExportKind &Kind) {
607#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
616void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
617 IO &IO, WasmYAML::Opcode &Code) {
618#define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
629void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
630 IO &IO, WasmYAML::TableType &
Type) {
631#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
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"
642 IO.enumFallback<Hex32>(
Type);
Analysis containing CSE Info
#define FUNCTION(NAME, NARG, ROUND_MODE, INTRINSIC)
static constexpr auto TAG
This file declares classes for handling the YAML representation of wasm binaries.
This class represents an Operation in the Expression.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr uint16_t VISIBILITY_MASK
const unsigned WASM_SYMBOL_UNDEFINED
@ WASM_DATA_SEGMENT_IS_PASSIVE
@ WASM_DATA_SEGMENT_HAS_MEMINDEX
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
@ WASM_LIMITS_FLAG_HAS_MAX
@ WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_FUNCTION
@ WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section)
static void commonSectionMapping(IO &IO, ELFYAML::Section &Section)
This is an optimization pass for GlobalISel generic memory operations.
@ 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.
std::vector< uint32_t > Functions
FeaturePolicyPrefix Prefix
wasm::WasmInitExprMVP Inst
std::vector< ValueType > ReturnTypes
std::vector< ValueType > ParamTypes
union llvm::wasm::WasmInitExprMVP::@178 Value