summaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCSectionWasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCSectionWasm.h')
-rw-r--r--include/llvm/MC/MCSectionWasm.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/include/llvm/MC/MCSectionWasm.h b/include/llvm/MC/MCSectionWasm.h
index 29d62a7a6f82..cc467ed9837a 100644
--- a/include/llvm/MC/MCSectionWasm.h
+++ b/include/llvm/MC/MCSectionWasm.h
@@ -27,16 +27,11 @@ class MCSymbol;
/// This represents a section on wasm.
class MCSectionWasm final : public MCSection {
private:
+
/// This is the name of the section. The referenced memory is owned by
/// TargetLoweringObjectFileWasm's WasmUniqueMap.
StringRef SectionName;
- /// This is the sh_type field of a section, drawn from the enums below.
- unsigned Type;
-
- /// This is the sh_flags field of a section, drawn from the enums below.
- unsigned Flags;
-
unsigned UniqueID;
const MCSymbolWasm *Group;
@@ -46,12 +41,15 @@ private:
// itself and does not include the size of the section header.
uint64_t SectionOffset;
+ // For data sections, this is the offset of the corresponding wasm data
+ // segment
+ uint64_t MemoryOffset;
+
friend class MCContext;
- MCSectionWasm(StringRef Section, unsigned type, unsigned flags, SectionKind K,
- const MCSymbolWasm *group, unsigned UniqueID, MCSymbol *Begin)
- : MCSection(SV_Wasm, K, Begin), SectionName(Section), Type(type),
- Flags(flags), UniqueID(UniqueID), Group(group), SectionOffset(0) {
- }
+ MCSectionWasm(StringRef Section, SectionKind K, const MCSymbolWasm *group,
+ unsigned UniqueID, MCSymbol *Begin)
+ : MCSection(SV_Wasm, K, Begin), SectionName(Section), UniqueID(UniqueID),
+ Group(group), SectionOffset(0) {}
void setSectionName(StringRef Name) { SectionName = Name; }
@@ -63,9 +61,6 @@ public:
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
StringRef getSectionName() const { return SectionName; }
- unsigned getType() const { return Type; }
- unsigned getFlags() const { return Flags; }
- void setFlags(unsigned F) { Flags = F; }
const MCSymbolWasm *getGroup() const { return Group; }
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
@@ -74,12 +69,19 @@ public:
bool UseCodeAlign() const override;
bool isVirtualSection() const override;
+ bool isWasmData() const {
+ return Kind.isGlobalWriteableData() || Kind.isReadOnly();
+ }
+
bool isUnique() const { return UniqueID != ~0U; }
unsigned getUniqueID() const { return UniqueID; }
uint64_t getSectionOffset() const { return SectionOffset; }
void setSectionOffset(uint64_t Offset) { SectionOffset = Offset; }
+ uint32_t getMemoryOffset() const { return MemoryOffset; }
+ void setMemoryOffset(uint32_t Offset) { MemoryOffset = Offset; }
+
static bool classof(const MCSection *S) { return S->getVariant() == SV_Wasm; }
};