33 IO.mapRequired(
"Version", FileHdr.
Version);
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);
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(
"ImportInfo", Section.ImportInfo);
59 IO.mapOptional(
"ExportInfo", Section.ExportInfo);
64 IO.mapRequired(
"Name", Section.Name);
65 IO.mapOptional(
"FunctionNames", Section.FunctionNames);
66 IO.mapOptional(
"GlobalNames", Section.GlobalNames);
67 IO.mapOptional(
"DataSegmentNames", Section.DataSegmentNames);
72 IO.mapRequired(
"Name", Section.Name);
73 IO.mapRequired(
"Version", Section.Version);
74 IO.mapOptional(
"SymbolTable", Section.SymbolTable);
75 IO.mapOptional(
"SegmentInfo", Section.SegmentInfos);
76 IO.mapOptional(
"InitFunctions", Section.InitFunctions);
77 IO.mapOptional(
"Comdats", Section.Comdats);
82 IO.mapRequired(
"Name", Section.Name);
83 IO.mapOptional(
"Languages", Section.Languages);
84 IO.mapOptional(
"Tools", Section.Tools);
85 IO.mapOptional(
"SDKs", Section.SDKs);
90 IO.mapRequired(
"Name", Section.Name);
91 IO.mapRequired(
"Features", Section.Features);
96 IO.mapRequired(
"Name", Section.Name);
97 IO.mapRequired(
"Payload", Section.Payload);
102 IO.mapOptional(
"Signatures", Section.Signatures);
107 IO.mapOptional(
"Imports", Section.Imports);
112 IO.mapOptional(
"FunctionTypes", Section.FunctionTypes);
117 IO.mapOptional(
"Tables", Section.Tables);
122 IO.mapOptional(
"Memories", Section.Memories);
127 IO.mapOptional(
"TagTypes", Section.TagTypes);
132 IO.mapOptional(
"Globals", Section.Globals);
137 IO.mapOptional(
"Exports", Section.Exports);
142 IO.mapOptional(
"StartFunction", Section.StartFunction);
147 IO.mapOptional(
"Segments", Section.Segments);
152 IO.mapRequired(
"Functions", Section.Functions);
157 IO.mapRequired(
"Segments", Section.Segments);
162 IO.mapRequired(
"Count", Section.Count);
166 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
167 WasmYAML::SectionType SectionType;
169 SectionType = Section->Type;
171 IO.mapRequired(
"Type", SectionType);
173 switch (SectionType) {
176 if (IO.outputting()) {
177 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
183 if (!IO.outputting())
185 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
187 if (!IO.outputting())
189 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
191 if (!IO.outputting())
195 if (!IO.outputting())
197 sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
199 if (!IO.outputting())
201 sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
203 if (!IO.outputting())
205 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
210 if (!IO.outputting())
215 if (!IO.outputting())
217 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
220 if (!IO.outputting())
222 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
225 if (!IO.outputting())
230 if (!IO.outputting())
232 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
235 if (!IO.outputting())
240 if (!IO.outputting())
242 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
245 if (!IO.outputting())
247 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
250 if (!IO.outputting())
255 if (!IO.outputting())
260 if (!IO.outputting())
265 if (!IO.outputting())
270 if (!IO.outputting())
272 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
279void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
280 IO &IO, WasmYAML::SectionType &
Type) {
281#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
301 IO.mapRequired(
"Index", Signature.
Index);
302 IO.mapRequired(
"ParamTypes", Signature.
ParamTypes);
303 IO.mapRequired(
"ReturnTypes", Signature.
ReturnTypes);
307 IO.mapRequired(
"Index", Table.
Index);
308 IO.mapRequired(
"ElemType", Table.
ElemType);
314 IO.mapRequired(
"Index",
Function.Index);
315 IO.mapRequired(
"Locals",
Function.Locals);
316 IO.mapRequired(
"Body",
Function.Body);
321 IO.mapRequired(
"Type", Relocation.
Type);
322 IO.mapRequired(
"Index", Relocation.
Index);
323 IO.mapRequired(
"Offset", Relocation.
Offset);
324 IO.mapOptional(
"Addend", Relocation.
Addend, 0);
329 IO.mapRequired(
"Index", NameEntry.
Index);
330 IO.mapRequired(
"Name", NameEntry.
Name);
335 IO.mapRequired(
"Name", ProducerEntry.
Name);
336 IO.mapRequired(
"Version", ProducerEntry.
Version);
339void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
340 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
341#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
350 IO.mapRequired(
"Prefix", FeatureEntry.
Prefix);
351 IO.mapRequired(
"Name", FeatureEntry.
Name);
356 IO.mapRequired(
"Index", SegmentInfo.
Index);
357 IO.mapRequired(
"Name", SegmentInfo.
Name);
358 IO.mapRequired(
"Alignment", SegmentInfo.
Alignment);
359 IO.mapRequired(
"Flags", SegmentInfo.
Flags);
364 IO.mapRequired(
"Type", LocalDecl.
Type);
365 IO.mapRequired(
"Count", LocalDecl.
Count);
370 IO.mapOptional(
"Flags", Limits.
Flags, 0);
371 IO.mapRequired(
"Minimum", Limits.
Minimum);
373 IO.mapOptional(
"Maximum", Limits.
Maximum);
378 IO.mapOptional(
"Flags", Segment.
Flags, 0);
379 if (!IO.outputting() ||
381 IO.mapOptional(
"TableNumber", Segment.
TableNumber);
382 if (!IO.outputting() ||
384 IO.mapOptional(
"ElemKind", Segment.
ElemKind);
385 IO.mapRequired(
"Offset", Segment.
Offset);
386 IO.mapRequired(
"Functions", Segment.
Functions);
391 IO.mapRequired(
"Module",
Import.Module);
392 IO.mapRequired(
"Field",
Import.Field);
393 IO.mapRequired(
"Kind",
Import.Kind);
396 IO.mapRequired(
"SigIndex",
Import.SigIndex);
398 IO.mapRequired(
"GlobalType",
Import.GlobalImport.Type);
399 IO.mapRequired(
"GlobalMutable",
Import.GlobalImport.Mutable);
401 IO.mapRequired(
"Table",
Import.TableImport);
403 IO.mapRequired(
"Memory",
Import.Memory);
411 IO.mapRequired(
"Name",
Export.Name);
412 IO.mapRequired(
"Kind",
Export.Kind);
413 IO.mapRequired(
"Index",
Export.Index);
418 IO.mapRequired(
"Index",
Global.Index);
419 IO.mapRequired(
"Type",
Global.Type);
420 IO.mapRequired(
"Mutable",
Global.Mutable);
421 IO.mapRequired(
"InitExpr",
Global.Init);
426 IO.mapOptional(
"Extended", Expr.
Extended,
false);
428 IO.mapRequired(
"Body", Expr.
Body);
431 IO.mapRequired(
"Opcode", Op);
451 IO.mapRequired(
"Type", Ty);
461 IO.mapRequired(
"InitFlags", Segment.
InitFlags);
463 IO.mapRequired(
"MemoryIndex", Segment.
MemoryIndex);
468 IO.mapRequired(
"Offset", Segment.
Offset);
473 IO.mapRequired(
"Content", Segment.
Content);
478 IO.mapRequired(
"Priority",
Init.Priority);
479 IO.mapRequired(
"Symbol",
Init.Symbol);
482void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
483 IO &IO, WasmYAML::ComdatKind &Kind) {
484#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
493 IO.mapRequired(
"Kind", ComdatEntry.
Kind);
494 IO.mapRequired(
"Index", ComdatEntry.
Index);
499 IO.mapRequired(
"Name",
Comdat.Name);
500 IO.mapRequired(
"Entries",
Comdat.Entries);
505 IO.mapRequired(
"Index",
Info.Index);
506 IO.mapRequired(
"Kind",
Info.Kind);
508 IO.mapRequired(
"Name",
Info.Name);
509 IO.mapRequired(
"Flags",
Info.Flags);
511 IO.mapRequired(
"Function",
Info.ElementIndex);
513 IO.mapRequired(
"Global",
Info.ElementIndex);
515 IO.mapRequired(
"Table",
Info.ElementIndex);
517 IO.mapRequired(
"Tag",
Info.ElementIndex);
520 IO.mapRequired(
"Segment",
Info.DataRef.Segment);
521 IO.mapOptional(
"Offset",
Info.DataRef.Offset, 0u);
522 IO.mapRequired(
"Size",
Info.DataRef.Size);
525 IO.mapRequired(
"Section",
Info.ElementIndex);
533 IO.mapRequired(
"Module",
Info.Module);
534 IO.mapRequired(
"Field",
Info.Field);
535 IO.mapRequired(
"Flags",
Info.Flags);
540 IO.mapRequired(
"Name",
Info.Name);
541 IO.mapRequired(
"Flags",
Info.Flags);
544void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
545 IO &IO, WasmYAML::LimitFlags &
Value) {
546#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
553void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
554 IO &IO, WasmYAML::SegmentFlags &
Value) {
555#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
561void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
562 IO &IO, WasmYAML::SymbolFlags &
Value) {
563#define BCaseMask(M, X) \
564 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
578void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
579 IO &IO, WasmYAML::SymbolKind &Kind) {
580#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
590void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
591 IO &IO, WasmYAML::ValueType &
Type) {
592#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
604void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
605 IO &IO, WasmYAML::ExportKind &Kind) {
606#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
615void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
616 IO &IO, WasmYAML::Opcode &Code) {
617#define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
628void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
629 IO &IO, WasmYAML::TableType &
Type) {
630#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
636void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
637 IO &IO, WasmYAML::RelocType &
Type) {
638#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
639#include "llvm/BinaryFormat/WasmRelocs.def"
641 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.
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
@ WASM_LIMITS_FLAG_HAS_MAX
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND
@ WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
@ WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_FUNCTION
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.
@ 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::@176 Value