diff options
author | Thomas Lively <tlively@google.com> | 2019-02-19 22:56:19 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-02-19 22:56:19 +0000 |
commit | 2e1504091e2b6e949290b4792224c4b833acda99 (patch) | |
tree | b579df67b6a3b560a5520fea45f235e069588e3b /llvm/include | |
parent | 8eade092497e17ad1cfbb1a7c3d9156686b229cc (diff) | |
download | bcm5719-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/include')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/Wasm.h | 12 | ||||
-rw-r--r-- | llvm/include/llvm/MC/MCSectionWasm.h | 11 | ||||
-rw-r--r-- | llvm/include/llvm/ObjectYAML/WasmYAML.h | 3 |
3 files changed, 22 insertions, 4 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index 51f6ab2594b..7848be1cbfa 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -131,12 +131,13 @@ struct WasmFunction { }; struct WasmDataSegment { - uint32_t MemoryIndex; - WasmInitExpr Offset; + uint32_t InitFlags; + uint32_t MemoryIndex; // present if InitFlags & WASM_SEGMENT_HAS_MEMINDEX + WasmInitExpr Offset; // present if InitFlags & WASM_SEGMENT_IS_PASSIVE == 0 ArrayRef<uint8_t> Content; StringRef Name; // from the "segment info" section uint32_t Alignment; - uint32_t Flags; + uint32_t LinkerFlags; uint32_t Comdat; // from the "comdat info" section }; @@ -247,6 +248,11 @@ enum : unsigned { WASM_LIMITS_FLAG_IS_SHARED = 0x2, }; +enum : unsigned { + WASM_SEGMENT_IS_PASSIVE = 0x01, + WASM_SEGMENT_HAS_MEMINDEX = 0x02, +}; + // Kind codes used in the custom "name" section enum : unsigned { WASM_NAMES_FUNCTION = 0x1, diff --git a/llvm/include/llvm/MC/MCSectionWasm.h b/llvm/include/llvm/MC/MCSectionWasm.h index 0e576b7ba40..1adc8126492 100644 --- a/llvm/include/llvm/MC/MCSectionWasm.h +++ b/llvm/include/llvm/MC/MCSectionWasm.h @@ -42,6 +42,9 @@ class MCSectionWasm final : public MCSection { // segment uint32_t SegmentIndex = 0; + // Whether this data segment is passive + bool IsPassive = false; + friend class MCContext; MCSectionWasm(StringRef Section, SectionKind K, const MCSymbolWasm *group, unsigned UniqueID, MCSymbol *Begin) @@ -75,6 +78,14 @@ public: uint32_t getSegmentIndex() const { return SegmentIndex; } void setSegmentIndex(uint32_t Index) { SegmentIndex = Index; } + bool getPassive() const { + assert(isWasmData()); + return IsPassive; + } + void setPassive(bool V = true) { + assert(isWasmData()); + IsPassive = V; + } static bool classof(const MCSection *S) { return S->getVariant() == SV_Wasm; } }; diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h index f5260bbb1ed..1d69d78e613 100644 --- a/llvm/include/llvm/ObjectYAML/WasmYAML.h +++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h @@ -111,8 +111,9 @@ struct Relocation { }; struct DataSegment { - uint32_t MemoryIndex; uint32_t SectionOffset; + uint32_t InitFlags; + uint32_t MemoryIndex; wasm::WasmInitExpr Offset; yaml::BinaryRef Content; }; |