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);
62 IO.mapOptional(
"RuntimePath", Section.RuntimePath);
67 IO.mapRequired(
"Name", Section.Name);
68 IO.mapOptional(
"FunctionNames", Section.FunctionNames);
69 IO.mapOptional(
"GlobalNames", Section.GlobalNames);
70 IO.mapOptional(
"DataSegmentNames", Section.DataSegmentNames);
75 IO.mapRequired(
"Name", Section.Name);
76 IO.mapRequired(
"Version", Section.Version);
77 IO.mapOptional(
"SymbolTable", Section.SymbolTable);
78 IO.mapOptional(
"SegmentInfo", Section.SegmentInfos);
79 IO.mapOptional(
"InitFunctions", Section.InitFunctions);
80 IO.mapOptional(
"Comdats", Section.Comdats);
85 IO.mapRequired(
"Name", Section.Name);
86 IO.mapOptional(
"Languages", Section.Languages);
87 IO.mapOptional(
"Tools", Section.Tools);
88 IO.mapOptional(
"SDKs", Section.SDKs);
93 IO.mapRequired(
"Name", Section.Name);
94 IO.mapRequired(
"Features", Section.Features);
99 IO.mapRequired(
"Name", Section.Name);
100 IO.mapRequired(
"Payload", Section.Payload);
105 IO.mapOptional(
"Signatures", Section.Signatures);
110 IO.mapOptional(
"Imports", Section.Imports);
115 IO.mapOptional(
"FunctionTypes", Section.FunctionTypes);
120 IO.mapOptional(
"Tables", Section.Tables);
125 IO.mapOptional(
"Memories", Section.Memories);
130 IO.mapOptional(
"TagTypes", Section.TagTypes);
135 IO.mapOptional(
"Globals", Section.Globals);
140 IO.mapOptional(
"Exports", Section.Exports);
145 IO.mapOptional(
"StartFunction", Section.StartFunction);
150 IO.mapOptional(
"Segments", Section.Segments);
155 IO.mapRequired(
"Functions", Section.Functions);
160 IO.mapRequired(
"Segments", Section.Segments);
165 IO.mapRequired(
"Count", Section.Count);
169 IO &IO, std::unique_ptr<WasmYAML::Section> &Section) {
170 WasmYAML::SectionType SectionType;
172 SectionType = Section->Type;
174 IO.mapRequired(
"Type", SectionType);
176 switch (SectionType) {
179 if (IO.outputting()) {
180 auto CustomSection = cast<WasmYAML::CustomSection>(Section.get());
186 if (!IO.outputting())
188 sectionMapping(IO, *cast<WasmYAML::DylinkSection>(Section.get()));
190 if (!IO.outputting())
192 sectionMapping(IO, *cast<WasmYAML::LinkingSection>(Section.get()));
194 if (!IO.outputting())
198 if (!IO.outputting())
200 sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get()));
202 if (!IO.outputting())
204 sectionMapping(IO, *cast<WasmYAML::TargetFeaturesSection>(Section.get()));
206 if (!IO.outputting())
208 sectionMapping(IO, *cast<WasmYAML::CustomSection>(Section.get()));
213 if (!IO.outputting())
218 if (!IO.outputting())
220 sectionMapping(IO, *cast<WasmYAML::ImportSection>(Section.get()));
223 if (!IO.outputting())
225 sectionMapping(IO, *cast<WasmYAML::FunctionSection>(Section.get()));
228 if (!IO.outputting())
233 if (!IO.outputting())
235 sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get()));
238 if (!IO.outputting())
243 if (!IO.outputting())
245 sectionMapping(IO, *cast<WasmYAML::GlobalSection>(Section.get()));
248 if (!IO.outputting())
250 sectionMapping(IO, *cast<WasmYAML::ExportSection>(Section.get()));
253 if (!IO.outputting())
258 if (!IO.outputting())
263 if (!IO.outputting())
268 if (!IO.outputting())
273 if (!IO.outputting())
275 sectionMapping(IO, *cast<WasmYAML::DataCountSection>(Section.get()));
282void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
283 IO &IO, WasmYAML::SectionType &
Type) {
284#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_SEC_##X);
304 IO.mapRequired(
"Index", Signature.
Index);
305 IO.mapRequired(
"ParamTypes", Signature.
ParamTypes);
306 IO.mapRequired(
"ReturnTypes", Signature.
ReturnTypes);
310 IO.mapRequired(
"Index", Table.
Index);
311 IO.mapRequired(
"ElemType", Table.
ElemType);
317 IO.mapRequired(
"Index",
Function.Index);
318 IO.mapRequired(
"Locals",
Function.Locals);
319 IO.mapRequired(
"Body",
Function.Body);
324 IO.mapRequired(
"Type", Relocation.
Type);
325 IO.mapRequired(
"Index", Relocation.
Index);
326 IO.mapRequired(
"Offset", Relocation.
Offset);
327 IO.mapOptional(
"Addend", Relocation.
Addend, 0);
332 IO.mapRequired(
"Index", NameEntry.
Index);
333 IO.mapRequired(
"Name", NameEntry.
Name);
338 IO.mapRequired(
"Name", ProducerEntry.
Name);
339 IO.mapRequired(
"Version", ProducerEntry.
Version);
342void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
343 IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
344#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);
377 IO.mapOptional(
"PageSize", Limits.
PageSize);
382 IO.mapOptional(
"Flags", Segment.
Flags, 0);
383 if (!IO.outputting() ||
385 IO.mapOptional(
"TableNumber", Segment.
TableNumber);
386 if (!IO.outputting() ||
388 IO.mapOptional(
"ElemKind", Segment.
ElemKind);
391 IO.mapRequired(
"Offset", Segment.
Offset);
392 IO.mapRequired(
"Functions", Segment.
Functions);
397 IO.mapRequired(
"Module",
Import.Module);
398 IO.mapRequired(
"Field",
Import.Field);
399 IO.mapRequired(
"Kind",
Import.Kind);
402 IO.mapRequired(
"SigIndex",
Import.SigIndex);
404 IO.mapRequired(
"GlobalType",
Import.GlobalImport.Type);
405 IO.mapRequired(
"GlobalMutable",
Import.GlobalImport.Mutable);
407 IO.mapRequired(
"Table",
Import.TableImport);
409 IO.mapRequired(
"Memory",
Import.Memory);
417 IO.mapRequired(
"Name",
Export.Name);
418 IO.mapRequired(
"Kind",
Export.Kind);
419 IO.mapRequired(
"Index",
Export.Index);
424 IO.mapRequired(
"Index",
Global.Index);
425 IO.mapRequired(
"Type",
Global.Type);
426 IO.mapRequired(
"Mutable",
Global.Mutable);
427 IO.mapRequired(
"InitExpr",
Global.Init);
432 IO.mapOptional(
"Extended", Expr.
Extended,
false);
434 IO.mapRequired(
"Body", Expr.
Body);
437 IO.mapRequired(
"Opcode",
Op);
457 IO.mapRequired(
"Type", Ty);
467 IO.mapRequired(
"InitFlags", Segment.
InitFlags);
469 IO.mapRequired(
"MemoryIndex", Segment.
MemoryIndex);
474 IO.mapRequired(
"Offset", Segment.
Offset);
479 IO.mapRequired(
"Content", Segment.
Content);
484 IO.mapRequired(
"Priority",
Init.Priority);
485 IO.mapRequired(
"Symbol",
Init.Symbol);
488void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
489 IO &IO, WasmYAML::ComdatKind &Kind) {
490#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
499 IO.mapRequired(
"Kind", ComdatEntry.
Kind);
500 IO.mapRequired(
"Index", ComdatEntry.
Index);
505 IO.mapRequired(
"Name",
Comdat.Name);
506 IO.mapRequired(
"Entries",
Comdat.Entries);
511 IO.mapRequired(
"Index",
Info.Index);
512 IO.mapRequired(
"Kind",
Info.Kind);
514 IO.mapRequired(
"Name",
Info.Name);
515 IO.mapRequired(
"Flags",
Info.Flags);
517 IO.mapRequired(
"Function",
Info.ElementIndex);
519 IO.mapRequired(
"Global",
Info.ElementIndex);
521 IO.mapRequired(
"Table",
Info.ElementIndex);
523 IO.mapRequired(
"Tag",
Info.ElementIndex);
527 IO.mapRequired(
"Segment",
Info.DataRef.Segment);
529 IO.mapOptional(
"Offset",
Info.DataRef.Offset, 0u);
530 IO.mapRequired(
"Size",
Info.DataRef.Size);
533 IO.mapRequired(
"Section",
Info.ElementIndex);
541 IO.mapRequired(
"Module",
Info.Module);
542 IO.mapRequired(
"Field",
Info.Field);
543 IO.mapRequired(
"Flags",
Info.Flags);
548 IO.mapRequired(
"Name",
Info.Name);
549 IO.mapRequired(
"Flags",
Info.Flags);
552void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
553 IO &IO, WasmYAML::LimitFlags &
Value) {
554#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
558 BCase(HAS_PAGE_SIZE);
562void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
563 IO &IO, WasmYAML::SegmentFlags &
Value) {
564#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_SEG_FLAG_##X)
571void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
572 IO &IO, WasmYAML::SymbolFlags &
Value) {
573#define BCaseMask(M, X) \
574 IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
589void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration(
590 IO &IO, WasmYAML::SymbolKind &Kind) {
591#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_SYMBOL_TYPE_##X);
601void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
602 IO &IO, WasmYAML::ValueType &
Type) {
603#define CONCAT(X) (uint32_t) wasm::ValType::X
604#define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
617void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration(
618 IO &IO, WasmYAML::ExportKind &Kind) {
619#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_EXTERNAL_##X);
628void ScalarEnumerationTraits<WasmYAML::Opcode>::enumeration(
629 IO &IO, WasmYAML::Opcode &Code) {
630#define ECase(X) IO.enumCase(Code, #X, wasm::WASM_OPCODE_##X);
641void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
642 IO &IO, WasmYAML::TableType &
Type) {
643#define CONCAT(X) (uint32_t) wasm::ValType::X
644#define ECase(X) IO.enumCase(Type, #X, CONCAT(X));
652void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
653 IO &IO, WasmYAML::RelocType &
Type) {
654#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
655#include "llvm/BinaryFormat/WasmRelocs.def"
657 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
@ WASM_LIMITS_FLAG_HAS_MAX
@ WASM_LIMITS_FLAG_HAS_PAGE_SIZE
@ WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER
@ WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_FUNCTION
const unsigned WASM_SYMBOL_ABSOLUTE
const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_DESC
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
std::vector< uint32_t > Functions
FeaturePolicyPrefix Prefix
wasm::WasmInitExprMVP Inst
std::vector< ValueType > ReturnTypes
std::vector< ValueType > ParamTypes
union llvm::wasm::WasmInitExprMVP::@188 Value