File indexing completed on 2026-05-10 08:44:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_MC_MCSECTIONWASM_H
0014 #define LLVM_MC_MCSECTIONWASM_H
0015
0016 #include "llvm/MC/MCSection.h"
0017
0018 namespace llvm {
0019
0020 class MCSymbol;
0021 class MCSymbolWasm;
0022 class StringRef;
0023 class raw_ostream;
0024
0025
0026 class MCSectionWasm final : public MCSection {
0027 unsigned UniqueID;
0028
0029 const MCSymbolWasm *Group;
0030
0031
0032
0033
0034 uint64_t SectionOffset = 0;
0035
0036
0037
0038 uint32_t SegmentIndex = 0;
0039
0040
0041 bool IsPassive = false;
0042
0043 bool IsWasmData;
0044
0045 bool IsMetadata;
0046
0047
0048 unsigned SegmentFlags;
0049
0050
0051 friend class MCContext;
0052 MCSectionWasm(StringRef Name, SectionKind K, unsigned SegmentFlags,
0053 const MCSymbolWasm *Group, unsigned UniqueID, MCSymbol *Begin)
0054 : MCSection(SV_Wasm, Name, K.isText(), false, Begin),
0055 UniqueID(UniqueID), Group(Group),
0056 IsWasmData(K.isReadOnly() || K.isWriteable()),
0057 IsMetadata(K.isMetadata()), SegmentFlags(SegmentFlags) {}
0058
0059 public:
0060
0061
0062 bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
0063
0064 const MCSymbolWasm *getGroup() const { return Group; }
0065 unsigned getSegmentFlags() const { return SegmentFlags; }
0066
0067 void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
0068 raw_ostream &OS,
0069 uint32_t Subsection) const override;
0070 bool useCodeAlign() const override;
0071
0072 bool isWasmData() const { return IsWasmData; }
0073 bool isMetadata() const { return IsMetadata; }
0074
0075 bool isUnique() const { return UniqueID != ~0U; }
0076 unsigned getUniqueID() const { return UniqueID; }
0077
0078 uint64_t getSectionOffset() const { return SectionOffset; }
0079 void setSectionOffset(uint64_t Offset) { SectionOffset = Offset; }
0080
0081 uint32_t getSegmentIndex() const { return SegmentIndex; }
0082 void setSegmentIndex(uint32_t Index) { SegmentIndex = Index; }
0083
0084 bool getPassive() const {
0085 assert(isWasmData());
0086 return IsPassive;
0087 }
0088 void setPassive(bool V = true) {
0089 assert(isWasmData());
0090 IsPassive = V;
0091 }
0092 static bool classof(const MCSection *S) { return S->getVariant() == SV_Wasm; }
0093 };
0094
0095 }
0096
0097 #endif