summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-02-19 22:56:19 +0000
committerThomas Lively <tlively@google.com>2019-02-19 22:56:19 +0000
commit2e1504091e2b6e949290b4792224c4b833acda99 (patch)
treeb579df67b6a3b560a5520fea45f235e069588e3b /llvm/lib/ObjectYAML
parent8eade092497e17ad1cfbb1a7c3d9156686b229cc (diff)
downloadbcm5719-llvm-2e1504091e2b6e949290b4792224c4b833acda99.tar.gz
bcm5719-llvm-2e1504091e2b6e949290b4792224c4b833acda99.zip
[WebAssembly] Update MC for bulk memory
Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/WasmYAML.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp
index def4d58a101..1865dcf7aa6 100644
--- a/llvm/lib/ObjectYAML/WasmYAML.cpp
+++ b/llvm/lib/ObjectYAML/WasmYAML.cpp
@@ -403,8 +403,18 @@ void MappingTraits<wasm::WasmInitExpr>::mapping(IO &IO,
void MappingTraits<WasmYAML::DataSegment>::mapping(
IO &IO, WasmYAML::DataSegment &Segment) {
IO.mapOptional("SectionOffset", Segment.SectionOffset);
- IO.mapRequired("MemoryIndex", Segment.MemoryIndex);
- IO.mapRequired("Offset", Segment.Offset);
+ IO.mapRequired("InitFlags", Segment.InitFlags);
+ if (Segment.InitFlags & wasm::WASM_SEGMENT_HAS_MEMINDEX) {
+ IO.mapRequired("MemoryIndex", Segment.MemoryIndex);
+ } else {
+ Segment.MemoryIndex = 0;
+ }
+ if ((Segment.InitFlags & wasm::WASM_SEGMENT_IS_PASSIVE) == 0) {
+ IO.mapRequired("Offset", Segment.Offset);
+ } else {
+ Segment.Offset.Opcode = wasm::WASM_OPCODE_I32_CONST;
+ Segment.Offset.Value.Int32 = 0;
+ }
IO.mapRequired("Content", Segment.Content);
}
OpenPOWER on IntegriCloud