aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/ObjectYAML/WasmYAML.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r--contrib/llvm/lib/ObjectYAML/WasmYAML.cpp43
1 files changed, 40 insertions, 3 deletions
diff --git a/contrib/llvm/lib/ObjectYAML/WasmYAML.cpp b/contrib/llvm/lib/ObjectYAML/WasmYAML.cpp
index 6a68cd265ad8..b2411395dc0f 100644
--- a/contrib/llvm/lib/ObjectYAML/WasmYAML.cpp
+++ b/contrib/llvm/lib/ObjectYAML/WasmYAML.cpp
@@ -58,8 +58,9 @@ static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) {
commonSectionMapping(IO, Section);
IO.mapRequired("Name", Section.Name);
IO.mapRequired("DataSize", Section.DataSize);
- IO.mapRequired("DataAlignment", Section.DataAlignment);
- IO.mapRequired("SymbolInfo", Section.SymbolInfos);
+ IO.mapOptional("SymbolInfo", Section.SymbolInfos);
+ IO.mapOptional("SegmentInfo", Section.SegmentInfos);
+ IO.mapOptional("InitFunctions", Section.InitFunctions);
}
static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) {
@@ -265,6 +266,14 @@ void MappingTraits<WasmYAML::NameEntry>::mapping(
IO.mapRequired("Name", NameEntry.Name);
}
+void MappingTraits<WasmYAML::SegmentInfo>::mapping(
+ IO &IO, WasmYAML::SegmentInfo &SegmentInfo) {
+ IO.mapRequired("Index", SegmentInfo.Index);
+ IO.mapRequired("Name", SegmentInfo.Name);
+ IO.mapRequired("Alignment", SegmentInfo.Alignment);
+ IO.mapRequired("Flags", SegmentInfo.Flags);
+}
+
void MappingTraits<WasmYAML::LocalDecl>::mapping(
IO &IO, WasmYAML::LocalDecl &LocalDecl) {
IO.mapRequired("Type", LocalDecl.Type);
@@ -351,12 +360,40 @@ void MappingTraits<WasmYAML::DataSegment>::mapping(
IO.mapRequired("Content", Segment.Content);
}
+void MappingTraits<WasmYAML::InitFunction>::mapping(
+ IO &IO, WasmYAML::InitFunction &Init) {
+ IO.mapRequired("Priority", Init.Priority);
+ IO.mapRequired("FunctionIndex", Init.FunctionIndex);
+}
+
void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
WasmYAML::SymbolInfo &Info) {
IO.mapRequired("Name", Info.Name);
IO.mapRequired("Flags", Info.Flags);
}
+void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset(
+ IO &IO, WasmYAML::LimitFlags &Value) {
+#define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
+ BCase(HAS_MAX);
+#undef BCase
+}
+
+void ScalarBitSetTraits<WasmYAML::SegmentFlags>::bitset(
+ IO &IO, WasmYAML::SegmentFlags &Value) {
+}
+
+void ScalarBitSetTraits<WasmYAML::SymbolFlags>::bitset(
+ IO &IO, WasmYAML::SymbolFlags &Value) {
+#define BCaseMask(M, X) IO.maskedBitSetCase(Value, #X, wasm::WASM_SYMBOL_##X, wasm::WASM_SYMBOL_##M)
+ //BCaseMask(BINDING_MASK, BINDING_GLOBAL);
+ BCaseMask(BINDING_MASK, BINDING_WEAK);
+ BCaseMask(BINDING_MASK, BINDING_LOCAL);
+ //BCaseMask(VISIBILITY_MASK, VISIBILITY_DEFAULT);
+ BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
+#undef BCaseMask
+}
+
void ScalarEnumerationTraits<WasmYAML::ValueType>::enumeration(
IO &IO, WasmYAML::ValueType &Type) {
#define ECase(X) IO.enumCase(Type, #X, wasm::WASM_TYPE_##X);
@@ -402,7 +439,7 @@ void ScalarEnumerationTraits<WasmYAML::TableType>::enumeration(
void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
IO &IO, WasmYAML::RelocType &Type) {
#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
-#include "llvm/BinaryFormat/WasmRelocs/WebAssembly.def"
+#include "llvm/BinaryFormat/WasmRelocs.def"
#undef WASM_RELOC
}