aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ObjectYAML/WasmYAML.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ObjectYAML/WasmYAML.h')
-rw-r--r--include/llvm/ObjectYAML/WasmYAML.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/include/llvm/ObjectYAML/WasmYAML.h b/include/llvm/ObjectYAML/WasmYAML.h
index 74f5664c43ac..6bf08d340eeb 100644
--- a/include/llvm/ObjectYAML/WasmYAML.h
+++ b/include/llvm/ObjectYAML/WasmYAML.h
@@ -16,8 +16,13 @@
#ifndef LLVM_OBJECTYAML_WASMYAML_H
#define LLVM_OBJECTYAML_WASMYAML_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/ObjectYAML/YAML.h"
+#include "llvm/Support/Casting.h"
+#include <cstdint>
+#include <memory>
+#include <vector>
namespace llvm {
namespace WasmYAML {
@@ -104,10 +109,8 @@ struct NameEntry {
};
struct Signature {
- Signature() : Form(wasm::WASM_TYPE_FUNC) {}
-
uint32_t Index;
- SignatureForm Form;
+ SignatureForm Form = wasm::WASM_TYPE_FUNC;
std::vector<ValueType> ParamTypes;
ValueType ReturnType;
};
@@ -128,6 +131,7 @@ struct Section {
struct CustomSection : Section {
explicit CustomSection(StringRef Name)
: Section(wasm::WASM_SEC_CUSTOM), Name(Name) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_CUSTOM;
}
@@ -138,6 +142,7 @@ struct CustomSection : Section {
struct NameSection : CustomSection {
NameSection() : CustomSection("name") {}
+
static bool classof(const Section *S) {
auto C = dyn_cast<CustomSection>(S);
return C && C->Name == "name";
@@ -148,16 +153,20 @@ struct NameSection : CustomSection {
struct LinkingSection : CustomSection {
LinkingSection() : CustomSection("linking") {}
+
static bool classof(const Section *S) {
auto C = dyn_cast<CustomSection>(S);
return C && C->Name == "linking";
}
std::vector<SymbolInfo> SymbolInfos;
+ uint32_t DataSize;
+ uint32_t DataAlignment;
};
struct TypeSection : Section {
TypeSection() : Section(wasm::WASM_SEC_TYPE) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_TYPE;
}
@@ -167,6 +176,7 @@ struct TypeSection : Section {
struct ImportSection : Section {
ImportSection() : Section(wasm::WASM_SEC_IMPORT) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_IMPORT;
}
@@ -176,6 +186,7 @@ struct ImportSection : Section {
struct FunctionSection : Section {
FunctionSection() : Section(wasm::WASM_SEC_FUNCTION) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_FUNCTION;
}
@@ -185,6 +196,7 @@ struct FunctionSection : Section {
struct TableSection : Section {
TableSection() : Section(wasm::WASM_SEC_TABLE) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_TABLE;
}
@@ -194,6 +206,7 @@ struct TableSection : Section {
struct MemorySection : Section {
MemorySection() : Section(wasm::WASM_SEC_MEMORY) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_MEMORY;
}
@@ -203,6 +216,7 @@ struct MemorySection : Section {
struct GlobalSection : Section {
GlobalSection() : Section(wasm::WASM_SEC_GLOBAL) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_GLOBAL;
}
@@ -212,6 +226,7 @@ struct GlobalSection : Section {
struct ExportSection : Section {
ExportSection() : Section(wasm::WASM_SEC_EXPORT) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_EXPORT;
}
@@ -221,6 +236,7 @@ struct ExportSection : Section {
struct StartSection : Section {
StartSection() : Section(wasm::WASM_SEC_START) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_START;
}
@@ -230,6 +246,7 @@ struct StartSection : Section {
struct ElemSection : Section {
ElemSection() : Section(wasm::WASM_SEC_ELEM) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_ELEM;
}
@@ -239,6 +256,7 @@ struct ElemSection : Section {
struct CodeSection : Section {
CodeSection() : Section(wasm::WASM_SEC_CODE) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_CODE;
}
@@ -248,6 +266,7 @@ struct CodeSection : Section {
struct DataSection : Section {
DataSection() : Section(wasm::WASM_SEC_DATA) {}
+
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_DATA;
}
@@ -278,7 +297,6 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::LocalDecl)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Relocation)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo)
-LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
namespace llvm {
namespace yaml {
@@ -378,4 +396,4 @@ template <> struct ScalarEnumerationTraits<WasmYAML::RelocType> {
} // end namespace yaml
} // end namespace llvm
-#endif
+#endif // LLVM_OBJECTYAML_WASMYAML_H