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);
53 IO.mapRequired(
"Name", Section.
Name);
54 IO.mapRequired(
"MemorySize", Section.
MemorySize);
56 IO.mapRequired(
"TableSize", Section.
TableSize);
58 IO.mapRequired(
"Needed", Section.
Needed);
63 IO.mapRequired(
"Name", Section.
Name);
69 IO.mapRequired(
"Name", Section.
Name);
70 IO.mapRequired(
"Version", Section.
Version);
74 IO.mapOptional(
"Comdats", Section.
Comdats);
79 IO.mapRequired(
"Name", Section.
Name);
80 IO.mapRequired(
"Payload", Section.
Payload);
85 IO.mapOptional(
"Signatures", Section.
Signatures);
90 IO.mapOptional(
"Imports", Section.
Imports);
100 IO.mapOptional(
"Tables", Section.
Tables);
105 IO.mapOptional(
"Memories", Section.
Memories);
110 IO.mapOptional(
"Globals", Section.
Globals);
115 IO.mapOptional(
"Events", Section.
Events);
120 IO.mapOptional(
"Exports", Section.
Exports);
130 IO.mapOptional(
"Segments", Section.
Segments);
135 IO.mapRequired(
"Functions", Section.
Functions);
140 IO.mapRequired(
"Segments", Section.
Segments);
144 IO &IO, std::unique_ptr<WasmYAML::Section> &
Section) {
147 SectionType = Section->Type;
149 IO.mapRequired(
"Type", SectionType);
151 switch (SectionType) {
154 if (IO.outputting()) {
155 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
156 SectionName = CustomSection->Name;
158 IO.mapRequired(
"Name", SectionName);
160 if (SectionName ==
"dylink") {
161 if (!IO.outputting())
163 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
164 }
else if (SectionName ==
"linking") {
165 if (!IO.outputting())
167 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
168 }
else if (SectionName ==
"name") {
169 if (!IO.outputting())
173 if (!IO.outputting())
175 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
180 if (!IO.outputting())
185 if (!IO.outputting())
187 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
190 if (!IO.outputting())
192 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
195 if (!IO.outputting())
200 if (!IO.outputting())
202 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
205 if (!IO.outputting())
207 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
210 if (!IO.outputting())
215 if (!IO.outputting())
217 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
220 if (!IO.outputting())
225 if (!IO.outputting())
230 if (!IO.outputting())
235 if (!IO.outputting())
244 void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
246 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X); 265 IO.mapRequired(
"Index", Signature.
Index);
266 IO.mapRequired(
"ReturnType", Signature.
ReturnType);
267 IO.mapRequired(
"ParamTypes", Signature.
ParamTypes);
271 IO.mapRequired(
"ElemType", Table.
ElemType);
277 IO.mapRequired(
"Index", Function.
Index);
278 IO.mapRequired(
"Locals", Function.
Locals);
279 IO.mapRequired(
"Body", Function.
Body);
284 IO.mapRequired(
"Type", Relocation.
Type);
285 IO.mapRequired(
"Index", Relocation.
Index);
286 IO.mapRequired(
"Offset", Relocation.
Offset);
287 IO.mapOptional(
"Addend", Relocation.
Addend, 0);
292 IO.mapRequired(
"Index", NameEntry.
Index);
293 IO.mapRequired(
"Name", NameEntry.
Name);
298 IO.mapRequired(
"Index", SegmentInfo.
Index);
299 IO.mapRequired(
"Name", SegmentInfo.
Name);
300 IO.mapRequired(
"Alignment", SegmentInfo.
Alignment);
301 IO.mapRequired(
"Flags", SegmentInfo.
Flags);
306 IO.mapRequired(
"Type", LocalDecl.
Type);
307 IO.mapRequired(
"Count", LocalDecl.
Count);
312 if (!IO.outputting() || Limits.
Flags)
313 IO.mapOptional(
"Flags", Limits.
Flags);
314 IO.mapRequired(
"Initial", Limits.
Initial);
316 IO.mapOptional(
"Maximum", Limits.
Maximum);
321 IO.mapRequired(
"Offset", Segment.
Offset);
322 IO.mapRequired(
"Functions", Segment.
Functions);
327 IO.mapRequired(
"Module", Import.
Module);
328 IO.mapRequired(
"Field", Import.
Field);
329 IO.mapRequired(
"Kind", Import.
Kind);
331 IO.mapRequired(
"SigIndex", Import.
SigIndex);
341 IO.mapRequired(
"Memory", Import.
Memory);
349 IO.mapRequired(
"Name", Export.
Name);
350 IO.mapRequired(
"Kind", Export.
Kind);
351 IO.mapRequired(
"Index", Export.
Index);
356 IO.mapRequired(
"Index", Global.
Index);
357 IO.mapRequired(
"Type", Global.
Type);
358 IO.mapRequired(
"Mutable", Global.
Mutable);
359 IO.mapRequired(
"InitExpr", Global.
InitExpr);
365 IO.mapRequired(
"Opcode", Op);
389 IO.mapRequired(
"MemoryIndex", Segment.
MemoryIndex);
390 IO.mapRequired(
"Offset", Segment.
Offset);
391 IO.mapRequired(
"Content", Segment.
Content);
396 IO.mapRequired(
"Priority", Init.
Priority);
397 IO.mapRequired(
"Symbol", Init.
Symbol);
400 void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
401 IO &IO, WasmYAML::ComdatKind &
Kind) {
402 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X); 410 IO.mapRequired(
"Kind", ComdatEntry.
Kind);
411 IO.mapRequired(
"Index", ComdatEntry.
Index);
416 IO.mapRequired(
"Name", Comdat.
Name);
417 IO.mapRequired(
"Entries", Comdat.
Entries);
422 IO.mapRequired(
"Index", Info.
Index);
423 IO.mapRequired(
"Kind", Info.
Kind);
424 IO.mapRequired(
"Name", Info.
Name);
425 IO.mapRequired(
"Flags", Info.
Flags);
446 IO.mapRequired(
"Index", Event.
Index);
447 IO.mapRequired(
"Attribute", Event.
Attribute);
448 IO.mapRequired(
"SigIndex", Event.
SigIndex);
451 void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
452 IO &IO, WasmYAML::LimitFlags &
Value) {
453 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X) 459 void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
460 IO &IO, WasmYAML::SegmentFlags &
Value) {}
462 void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
463 IO &IO, WasmYAML::SymbolFlags &
Value) {
464 #define BCaseMask(M, X) \ 465 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M) 470 BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
475 void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
477 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X); 486 void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
488 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X); 500 void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
501 IO &IO, WasmYAML::ExportKind &
Kind) {
502 #define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X); 511 void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
512 IO &IO, WasmYAML::Opcode &Code) {
513 #define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X); 523 void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
524 IO &IO, WasmYAML::TableType &
Type) {
525 #define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X); 530 void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
531 IO &IO, WasmYAML::RelocType &
Type) {
532 #define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name); 533 #include "llvm/BinaryFormat/WasmRelocs.def" std::vector< InitFunction > InitFunctions
std::vector< Comdat > Comdats
std::vector< Relocation > Relocations
std::vector< Limits > Memories
std::vector< Signature > Signatures
This class represents lattice values for constants.
std::vector< std::unique_ptr< Section > > Sections
wasm::WasmInitExpr InitExpr
std::vector< Import > Imports
wasm::WasmInitExpr Offset
const unsigned WASM_SYMBOL_UNDEFINED
std::vector< SegmentInfo > SegmentInfos
std::vector< SymbolInfo > SymbolTable
union llvm::wasm::WasmInitExpr::@143 Value
std::vector< Function > Functions
Analysis containing CSE Info
std::vector< ComdatEntry > Entries
This file declares classes for handling the YAML representation of wasm binaries. ...
The instances of the Type class are immutable: once they are created, they are never changed...
std::vector< Export > Exports
static void sectionMapping(IO &IO, WasmYAML::DataSection &Section)
std::vector< uint32_t > FunctionTypes
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::vector< Table > Tables
std::vector< ElemSegment > Segments
std::vector< Event > Events
std::vector< uint32_t > Functions
std::vector< StringRef > Needed
std::vector< DataSegment > Segments
wasm::WasmDataReference DataRef
std::vector< ValueType > ParamTypes
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
std::vector< LocalDecl > Locals
std::vector< NameEntry > FunctionNames
std::vector< Global > Globals
LLVM Value Representation.
wasm::WasmInitExpr Offset
static void commonSectionMapping(IO &IO, WasmYAML::Section &Section)
StringRef - Represent a constant reference to a string, i.e.
SectionType
These are the section type and attributes fields.