34 IO.mapRequired(
"Version", FileHdr.
Version);
39 IO.setContext(&Object);
40 IO.mapTag(
"!WASM",
true);
41 IO.mapRequired(
"FileHeader", Object.Header);
42 IO.mapOptional(
"Sections", Object.Sections);
43 IO.setContext(
nullptr);
47 IO.mapRequired(
"Type", Section.Type);
48 IO.mapOptional(
"Relocations", Section.Relocations);
49 IO.mapOptional(
"HeaderSecSizeEncodingLen", Section.HeaderSecSizeEncodingLen);
54 IO.mapRequired(
"Name", Section.Name);
55 IO.mapRequired(
"MemorySize", Section.MemorySize);
56 IO.mapRequired(
"MemoryAlignment", Section.MemoryAlignment);
57 IO.mapRequired(
"TableSize", Section.TableSize);
58 IO.mapRequired(
"TableAlignment", Section.TableAlignment);
59 IO.mapRequired(
"Needed", Section.Needed);
60 IO.mapOptional(
"ImportInfo", Section.ImportInfo);
61 IO.mapOptional(
"ExportInfo", Section.ExportInfo);
66 IO.mapRequired(
"Name", Section.Name);
67 IO.mapOptional(
"FunctionNames", Section.FunctionNames);
68 IO.mapOptional(
"GlobalNames", Section.GlobalNames);
69 IO.mapOptional(
"DataSegmentNames", Section.DataSegmentNames);
74 IO.mapRequired(
"Name", Section.Name);
75 IO.mapRequired(
"Version", Section.Version);
76 IO.mapOptional(
"SymbolTable", Section.SymbolTable);
77 IO.mapOptional(
"SegmentInfo", Section.SegmentInfos);
78 IO.mapOptional(
"InitFunctions", Section.InitFunctions);
79 IO.mapOptional(
"Comdats", Section.Comdats);
84 IO.mapRequired(
"Name", Section.Name);
85 IO.mapOptional(
"Languages", Section.Languages);
86 IO.mapOptional(
"Tools", Section.Tools);
87 IO.mapOptional(
"SDKs", Section.SDKs);
92 IO.mapRequired(
"Name", Section.Name);
93 IO.mapRequired(
"Features", Section.Features);
98 IO.mapRequired(
"Name", Section.Name);
99 IO.mapRequired(
"Payload", Section.Payload);
104 IO.mapOptional(
"Signatures", Section.Signatures);
109 IO.mapOptional(
"Imports", Section.Imports);
114 IO.mapOptional(
"FunctionTypes", Section.FunctionTypes);
119 IO.mapOptional(
"Tables", Section.Tables);
124 IO.mapOptional(
"Memories", Section.Memories);
129 IO.mapOptional(
"TagTypes", Section.TagTypes);
134 IO.mapOptional(
"Globals", Section.Globals);
139 IO.mapOptional(
"Exports", Section.Exports);
144 IO.mapOptional(
"StartFunction", Section.StartFunction);
149 IO.mapOptional(
"Segments", Section.Segments);
154 IO.mapRequired(
"Functions", Section.Functions);
159 IO.mapRequired(
"Segments", Section.Segments);
164 IO.mapRequired(
"Count", Section.Count);
168 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
169 WasmYAML::SectionType SectionType;
171 SectionType = Section->Type;
173 IO.mapRequired(
"Type", SectionType);
175 switch (SectionType) {
178 if (IO.outputting()) {
179 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
185 if (!IO.outputting())
187 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
189 if (!IO.outputting())
191 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
193 if (!IO.outputting())
197 if (!IO.outputting())
199 sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
201 if (!IO.outputting())
203 sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
205 if (!IO.outputting())
207 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
212 if (!IO.outputting())
217 if (!IO.outputting())
219 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
222 if (!IO.outputting())
224 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
227 if (!IO.outputting())
232 if (!IO.outputting())
234 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
237 if (!IO.outputting())
242 if (!IO.outputting())
244 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
247 if (!IO.outputting())
249 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
252 if (!IO.outputting())
257 if (!IO.outputting())
262 if (!IO.outputting())
267 if (!IO.outputting())
272 if (!IO.outputting())
274 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
281void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
282 IO &IO, WasmYAML::SectionType &
Type) {
283#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
303 IO.mapRequired(
"Index", Signature.
Index);
304 IO.mapRequired(
"ParamTypes", Signature.
ParamTypes);
305 IO.mapRequired(
"ReturnTypes", Signature.
ReturnTypes);
309 IO.mapRequired(
"Index", Table.
Index);
310 IO.mapRequired(
"ElemType", Table.
ElemType);
316 IO.mapRequired(
"Index",
Function.Index);
317 IO.mapRequired(
"Locals",
Function.Locals);
318 IO.mapRequired(
"Body",
Function.Body);
323 IO.mapRequired(
"Type", Relocation.
Type);
324 IO.mapRequired(
"Index", Relocation.
Index);
325 IO.mapRequired(
"Offset", Relocation.
Offset);
326 IO.mapOptional(
"Addend", Relocation.
Addend, 0);
331 IO.mapRequired(
"Index", NameEntry.
Index);
332 IO.mapRequired(
"Name", NameEntry.
Name);
337 IO.mapRequired(
"Name", ProducerEntry.
Name);
338 IO.mapRequired(
"Version", ProducerEntry.
Version);
341void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
342 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
343#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
352 IO.mapRequired(
"Prefix", FeatureEntry.
Prefix);
353 IO.mapRequired(
"Name", FeatureEntry.
Name);
358 IO.mapRequired(
"Index", SegmentInfo.
Index);
359 IO.mapRequired(
"Name", SegmentInfo.
Name);
360 IO.mapRequired(
"Alignment", SegmentInfo.
Alignment);
361 IO.mapRequired(
"Flags", SegmentInfo.
Flags);
366 IO.mapRequired(
"Type", LocalDecl.
Type);
367 IO.mapRequired(
"Count", LocalDecl.
Count);
372 IO.mapOptional(
"Flags", Limits.
Flags, 0);
373 IO.mapRequired(
"Minimum", Limits.
Minimum);
375 IO.mapOptional(
"Maximum", Limits.
Maximum);
380 IO.mapOptional(
"Flags", Segment.
Flags, 0);
381 if (!IO.outputting() ||
383 IO.mapOptional(
"TableNumber", Segment.
TableNumber);
384 if (!IO.outputting() ||
386 IO.mapOptional(
"ElemKind", Segment.
ElemKind);
389 IO.mapRequired(
"Offset", Segment.
Offset);
390 IO.mapRequired(
"Functions", Segment.
Functions);
395 IO.mapRequired(
"Module",
Import.Module);
396 IO.mapRequired(
"Field",
Import.Field);
397 IO.mapRequired(
"Kind",
Import.Kind);
400 IO.mapRequired(
"SigIndex",
Import.SigIndex);
402 IO.mapRequired(
"GlobalType",
Import.GlobalImport.Type);
403 IO.mapRequired(
"GlobalMutable",
Import.GlobalImport.Mutable);
405 IO.mapRequired(
"Table",
Import.TableImport);
407 IO.mapRequired(
"Memory",
Import.Memory);
415 IO.mapRequired(
"Name",
Export.Name);
416 IO.mapRequired(
"Kind",
Export.Kind);
417 IO.mapRequired(
"Index",
Export.Index);
422 IO.mapRequired(
"Index",
Global.Index);
423 IO.mapRequired(
"Type",
Global.Type);
424 IO.mapRequired(
"Mutable",
Global.Mutable);
425 IO.mapRequired(
"InitExpr",
Global.Init);
430 IO.mapOptional(
"Extended", Expr.
Extended,
false);
432 IO.mapRequired(
"Body", Expr.
Body);
435 IO.mapRequired(
"Opcode",
Op);
455 IO.mapRequired(
"Type", Ty);
465 IO.mapRequired(
"InitFlags", Segment.
InitFlags);
467 IO.mapRequired(
"MemoryIndex", Segment.
MemoryIndex);
472 IO.mapRequired(
"Offset", Segment.
Offset);
477 IO.mapRequired(
"Content", Segment.
Content);
482 IO.mapRequired(
"Priority",
Init.Priority);
483 IO.mapRequired(
"Symbol",
Init.Symbol);
486void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
487 IO &IO, WasmYAML::ComdatKind &Kind) {
488#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
497 IO.mapRequired(
"Kind", ComdatEntry.
Kind);
498 IO.mapRequired(
"Index", ComdatEntry.
Index);
503 IO.mapRequired(
"Name",
Comdat.Name);
504 IO.mapRequired(
"Entries",
Comdat.Entries);
509 IO.mapRequired(
"Index",
Info.Index);
510 IO.mapRequired(
"Kind",
Info.Kind);
512 IO.mapRequired(
"Name",
Info.Name);
513 IO.mapRequired(
"Flags",
Info.Flags);
515 IO.mapRequired(
"Function",
Info.ElementIndex);
517 IO.mapRequired(
"Global",
Info.ElementIndex);
519 IO.mapRequired(
"Table",
Info.ElementIndex);
521 IO.mapRequired(
"Tag",
Info.ElementIndex);
525 IO.mapRequired(
"Segment",
Info.DataRef.Segment);
527 IO.mapOptional(
"Offset",
Info.DataRef.Offset, 0u);
528 IO.mapRequired(
"Size",
Info.DataRef.Size);
531 IO.mapRequired(
"Section",
Info.ElementIndex);
539 IO.mapRequired(
"Module",
Info.Module);
540 IO.mapRequired(
"Field",
Info.Field);
541 IO.mapRequired(
"Flags",
Info.Flags);
546 IO.mapRequired(
"Name",
Info.Name);
547 IO.mapRequired(
"Flags",
Info.Flags);
550void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
551 IO &IO, WasmYAML::LimitFlags &
Value) {
552#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
559void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
560 IO &IO, WasmYAML::SegmentFlags &
Value) {
561#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
568void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
569 IO &IO, WasmYAML::SymbolFlags &
Value) {
570#define BCaseMask(M, X) \
571 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
586void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
587 IO &IO, WasmYAML::SymbolKind &Kind) {
588#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
598void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
599 IO &IO, WasmYAML::ValueType &
Type) {
600#define CONCAT(X) (uint32_t) wasm::ValType::X
601#define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
614void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
615 IO &IO, WasmYAML::ExportKind &Kind) {
616#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
625void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
626 IO &IO, WasmYAML::Opcode &Code) {
627#define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
638void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
639 IO &IO, WasmYAML::TableType &
Type) {
640#define CONCAT(X) (uint32_t) wasm::ValType::X
641#define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
649void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
650 IO &IO, WasmYAML::RelocType &
Type) {
651#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
652#include "llvm/BinaryFormat/WasmRelocs.def"
654 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_ELEM_SEGMENT_HAS_TABLE_NUMBER
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
@ WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_FUNCTION
@ WASM_LIMITS_FLAG_HAS_MAX
@ WASM_DATA_SEGMENT_IS_PASSIVE
@ WASM_DATA_SEGMENT_HAS_MEMINDEX
const unsigned WASM_SYMBOL_ABSOLUTE
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::@187 Value