Lines Matching defs:IO
33 IO &IO, WasmYAML::FileHeader &FileHdr) {
34 IO.mapRequired("Version", FileHdr.Version);
37 void MappingTraits<WasmYAML::Object>::mapping(IO &IO,
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);
46 static void commonSectionMapping(IO &IO, WasmYAML::Section &Section) {
47 IO.mapRequired("Type", Section.Type);
48 IO.mapOptional("Relocations", Section.Relocations);
49 IO.mapOptional("HeaderSecSizeEncodingLen", Section.HeaderSecSizeEncodingLen);
52 static void sectionMapping(IO &IO, WasmYAML::DylinkSection &Section) {
53 commonSectionMapping(IO, Section);
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);
64 static void sectionMapping(IO &IO, WasmYAML::NameSection &Section) {
65 commonSectionMapping(IO, Section);
66 IO.mapRequired("Name", Section.Name);
67 IO.mapOptional("FunctionNames", Section.FunctionNames);
68 IO.mapOptional("GlobalNames", Section.GlobalNames);
69 IO.mapOptional("DataSegmentNames", Section.DataSegmentNames);
72 static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) {
73 commonSectionMapping(IO, Section);
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);
82 static void sectionMapping(IO &IO, WasmYAML::ProducersSection &Section) {
83 commonSectionMapping(IO, Section);
84 IO.mapRequired("Name", Section.Name);
85 IO.mapOptional("Languages", Section.Languages);
86 IO.mapOptional("Tools", Section.Tools);
87 IO.mapOptional("SDKs", Section.SDKs);
90 static void sectionMapping(IO &IO, WasmYAML::TargetFeaturesSection &Section) {
91 commonSectionMapping(IO, Section);
92 IO.mapRequired("Name", Section.Name);
93 IO.mapRequired("Features", Section.Features);
96 static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) {
97 commonSectionMapping(IO, Section);
98 IO.mapRequired("Name", Section.Name);
99 IO.mapRequired("Payload", Section.Payload);
102 static void sectionMapping(IO &IO, WasmYAML::TypeSection &Section) {
103 commonSectionMapping(IO, Section);
104 IO.mapOptional("Signatures", Section.Signatures);
107 static void sectionMapping(IO &IO, WasmYAML::ImportSection &Section) {
108 commonSectionMapping(IO, Section);
109 IO.mapOptional("Imports", Section.Imports);
112 static void sectionMapping(IO &IO, WasmYAML::FunctionSection &Section) {
113 commonSectionMapping(IO, Section);
114 IO.mapOptional("FunctionTypes", Section.FunctionTypes);
117 static void sectionMapping(IO &IO, WasmYAML::TableSection &Section) {
118 commonSectionMapping(IO, Section);
119 IO.mapOptional("Tables", Section.Tables);
122 static void sectionMapping(IO &IO, WasmYAML::MemorySection &Section) {
123 commonSectionMapping(IO, Section);
124 IO.mapOptional("Memories", Section.Memories);
127 static void sectionMapping(IO &IO, WasmYAML::TagSection &Section) {
128 commonSectionMapping(IO, Section);
129 IO.mapOptional("TagTypes", Section.TagTypes);
132 static void sectionMapping(IO &IO, WasmYAML::GlobalSection &Section) {
133 commonSectionMapping(IO, Section);
134 IO.mapOptional("Globals", Section.Globals);
137 static void sectionMapping(IO &IO, WasmYAML::ExportSection &Section) {
138 commonSectionMapping(IO, Section);
139 IO.mapOptional("Exports", Section.Exports);
142 static void sectionMapping(IO &IO, WasmYAML::StartSection &Section) {
143 commonSectionMapping(IO, Section);
144 IO.mapOptional("StartFunction", Section.StartFunction);
147 static void sectionMapping(IO &IO, WasmYAML::ElemSection &Section) {
148 commonSectionMapping(IO, Section);
149 IO.mapOptional("Segments", Section.Segments);
152 static void sectionMapping(IO &IO, WasmYAML::CodeSection &Section) {
153 commonSectionMapping(IO, Section);
154 IO.mapRequired("Functions", Section.Functions);
157 static void sectionMapping(IO &IO, WasmYAML::DataSection &Section) {
158 commonSectionMapping(IO, Section);
159 IO.mapRequired("Segments", Section.Segments);
162 static void sectionMapping(IO &IO, WasmYAML::DataCountSection &Section) {
163 commonSectionMapping(IO, Section);
164 IO.mapRequired("Count", Section.Count);
168 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
170 if (IO.outputting())
173 IO.mapRequired("Type", SectionType);
178 if (IO.outputting()) {
182 IO.mapRequired("Name", SectionName);
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())
195 sectionMapping(IO, *cast<WasmYAML::NameSection>(Section.get()));
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())
214 sectionMapping(IO, *cast<WasmYAML::TypeSection>(Section.get()));
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())
229 sectionMapping(IO, *cast<WasmYAML::TableSection>(Section.get()));
232 if (!IO.outputting())
234 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
237 if (!IO.outputting())
239 sectionMapping(IO, *cast<WasmYAML::TagSection>(Section.get()));
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())
254 sectionMapping(IO, *cast<WasmYAML::StartSection>(Section.get()));
257 if (!IO.outputting())
259 sectionMapping(IO, *cast<WasmYAML::ElemSection>(Section.get()));
262 if (!IO.outputting())
264 sectionMapping(IO, *cast<WasmYAML::CodeSection>(Section.get()));
267 if (!IO.outputting())
269 sectionMapping(IO, *cast<WasmYAML::DataSection>(Section.get()));
272 if (!IO.outputting())
274 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
282 IO &IO, WasmYAML::SectionType &Type) {
283 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
302 IO &IO, WasmYAML::Signature &Signature) {
303 IO.mapRequired("Index", Signature.Index);
304 IO.mapRequired("ParamTypes", Signature.ParamTypes);
305 IO.mapRequired("ReturnTypes", Signature.ReturnTypes);
308 void MappingTraits<WasmYAML::Table>::mapping(IO &IO, WasmYAML::Table &Table) {
309 IO.mapRequired("Index", Table.Index);
310 IO.mapRequired("ElemType", Table.ElemType);
311 IO.mapRequired("Limits", Table.TableLimits);
314 void MappingTraits<WasmYAML::Function>::mapping(IO &IO,
316 IO.mapRequired("Index", Function.Index);
317 IO.mapRequired("Locals", Function.Locals);
318 IO.mapRequired("Body", Function.Body);
322 IO &IO, WasmYAML::Relocation &Relocation) {
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);
330 IO &IO, WasmYAML::NameEntry &NameEntry) {
331 IO.mapRequired("Index", NameEntry.Index);
332 IO.mapRequired("Name", NameEntry.Name);
336 IO &IO, WasmYAML::ProducerEntry &ProducerEntry) {
337 IO.mapRequired("Name", ProducerEntry.Name);
338 IO.mapRequired("Version", ProducerEntry.Version);
342 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
343 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
350 IO &IO, WasmYAML::FeatureEntry &FeatureEntry) {
351 IO.mapRequired("Prefix", FeatureEntry.Prefix);
352 IO.mapRequired("Name", FeatureEntry.Name);
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);
364 IO &IO, WasmYAML::LocalDecl &LocalDecl) {
365 IO.mapRequired("Type", LocalDecl.Type);
366 IO.mapRequired("Count", LocalDecl.Count);
369 void MappingTraits<WasmYAML::Limits>::mapping(IO &IO,
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);
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);
388 IO.mapRequired("Offset", Segment.Offset);
389 IO.mapRequired("Functions", Segment.Functions);
392 void MappingTraits<WasmYAML::Import>::mapping(IO &IO,
394 IO.mapRequired("Module", Import.Module);
395 IO.mapRequired("Field", Import.Field);
396 IO.mapRequired("Kind", Import.Kind);
399 IO.mapRequired("SigIndex", Import.SigIndex);
401 IO.mapRequired("GlobalType", Import.GlobalImport.Type);
402 IO.mapRequired("GlobalMutable", Import.GlobalImport.Mutable);
404 IO.mapRequired("Table", Import.TableImport);
406 IO.mapRequired("Memory", Import.Memory);
412 void MappingTraits<WasmYAML::Export>::mapping(IO &IO,
414 IO.mapRequired("Name", Export.Name);
415 IO.mapRequired("Kind", Export.Kind);
416 IO.mapRequired("Index", Export.Index);
419 void MappingTraits<WasmYAML::Global>::mapping(IO &IO,
421 IO.mapRequired("Index", Global.Index);
422 IO.mapRequired("Type", Global.Type);
423 IO.mapRequired("Mutable", Global.Mutable);
424 IO.mapRequired("InitExpr", Global.Init);
427 void MappingTraits<WasmYAML::InitExpr>::mapping(IO &IO,
429 IO.mapOptional("Extended", Expr.Extended, false);
431 IO.mapRequired("Body", Expr.Body);
434 IO.mapRequired("Opcode", Op);
438 IO.mapRequired("Value", Expr.Inst.Value.Int32);
441 IO.mapRequired("Value", Expr.Inst.Value.Int64);
444 IO.mapRequired("Value", Expr.Inst.Value.Float32);
447 IO.mapRequired("Value", Expr.Inst.Value.Float64);
450 IO.mapRequired("Index", Expr.Inst.Value.Global);
454 IO.mapRequired("Type", Ty);
462 IO &IO, WasmYAML::DataSegment &Segment) {
463 IO.mapOptional("SectionOffset", Segment.SectionOffset);
464 IO.mapRequired("InitFlags", Segment.InitFlags);
466 IO.mapRequired("MemoryIndex", Segment.MemoryIndex);
471 IO.mapRequired("Offset", Segment.Offset);
476 IO.mapRequired("Content", Segment.Content);
480 IO &IO, WasmYAML::InitFunction &Init) {
481 IO.mapRequired("Priority", Init.Priority);
482 IO.mapRequired("Symbol", Init.Symbol);
486 IO &IO, WasmYAML::ComdatKind &Kind) {
487 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
495 IO &IO, WasmYAML::ComdatEntry &ComdatEntry) {
496 IO.mapRequired("Kind", ComdatEntry.Kind);
497 IO.mapRequired("Index", ComdatEntry.Index);
500 void MappingTraits<WasmYAML::Comdat>::mapping(IO &IO,
502 IO.mapRequired("Name", Comdat.Name);
503 IO.mapRequired("Entries", Comdat.Entries);
506 void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
508 IO.mapRequired("Index", Info.Index);
509 IO.mapRequired("Kind", Info.Kind);
511 IO.mapRequired("Name", Info.Name);
512 IO.mapRequired("Flags", Info.Flags);
514 IO.mapRequired("Function", Info.ElementIndex);
516 IO.mapRequired("Global", Info.ElementIndex);
518 IO.mapRequired("Table", Info.ElementIndex);
520 IO.mapRequired("Tag", Info.ElementIndex);
524 IO.mapRequired("Segment", Info.DataRef.Segment);
526 IO.mapOptional("Offset", Info.DataRef.Offset, 0u);
527 IO.mapRequired("Size", Info.DataRef.Size);
530 IO.mapRequired("Section", Info.ElementIndex);
537 IO &IO, WasmYAML::DylinkImportInfo &Info) {
538 IO.mapRequired("Module", Info.Module);
539 IO.mapRequired("Field", Info.Field);
540 IO.mapRequired("Flags", Info.Flags);
544 IO &IO, WasmYAML::DylinkExportInfo &Info) {
545 IO.mapRequired("Name", Info.Name);
546 IO.mapRequired("Flags", Info.Flags);
550 IO &IO, WasmYAML::LimitFlags &Value) {
551 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
559 IO &IO, WasmYAML::SegmentFlags &Value) {
560 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
568 IO &IO, WasmYAML::SymbolFlags &Value) {
570 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
586 IO &IO, WasmYAML::SymbolKind &Kind) {
587 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
598 IO &IO, WasmYAML::ValueType &Type) {
600 #define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
614 IO &IO, WasmYAML::ExportKind &Kind) {
615 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
625 IO &IO, WasmYAML::Opcode &Code) {
626 #define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
638 IO &IO, WasmYAML::TableType &Type) {
640 #define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
649 IO &IO, WasmYAML::RelocType &Type) {
650 #define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
653 IO.enumFallback<Hex32>(Type);