LLVM
22.0.0git
include
llvm
MC
MCSectionWasm.h
Go to the documentation of this file.
1
//===- MCSectionWasm.h - Wasm Machine Code Sections -------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file declares the MCSectionWasm class.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_MC_MCSECTIONWASM_H
14
#define LLVM_MC_MCSECTIONWASM_H
15
16
#include "
llvm/MC/MCSection.h
"
17
18
namespace
llvm
{
19
20
class
MCSymbol
;
21
class
MCSymbolWasm;
22
class
StringRef;
23
class
raw_ostream;
24
25
/// This represents a section on wasm.
26
class
MCSectionWasm
final :
public
MCSection
{
27
unsigned
UniqueID;
28
29
const
MCSymbolWasm
*Group;
30
31
// The offset of the MC function/data section in the wasm code/data section.
32
// For data relocations the offset is relative to start of the data payload
33
// itself and does not include the size of the section header.
34
uint64_t
SectionOffset = 0;
35
36
// For data sections, this is the index of the corresponding wasm data
37
// segment
38
uint32_t
SegmentIndex = 0;
39
40
// For data sections, whether to use a passive segment
41
bool
IsPassive =
false
;
42
43
bool
IsWasmData;
44
45
bool
IsMetadata;
46
47
// For data sections, bitfield of WasmSegmentFlag
48
unsigned
SegmentFlags;
49
50
// The storage of Name is owned by MCContext's WasmUniquingMap.
51
friend
class
MCContext
;
52
friend
class
MCAsmInfoWasm
;
53
MCSectionWasm
(
StringRef
Name
,
SectionKind
K,
unsigned
SegmentFlags,
54
const
MCSymbolWasm
*Group,
unsigned
UniqueID,
MCSymbol
*Begin)
55
:
MCSection
(
Name
, K.
isText
(),
/*IsVirtual=*/
false
, Begin),
56
UniqueID(UniqueID), Group(Group),
57
IsWasmData(K.isReadOnly() || K.isWriteable()),
58
IsMetadata(K.
isMetadata
()), SegmentFlags(SegmentFlags) {}
59
60
public
:
61
const
MCSymbolWasm
*
getGroup
()
const
{
return
Group; }
62
unsigned
getSegmentFlags
()
const
{
return
SegmentFlags; }
63
64
bool
isWasmData
()
const
{
return
IsWasmData; }
65
bool
isMetadata
()
const
{
return
IsMetadata; }
66
67
bool
isUnique
()
const
{
return
UniqueID != ~0U; }
68
unsigned
getUniqueID
()
const
{
return
UniqueID; }
69
70
uint64_t
getSectionOffset
()
const
{
return
SectionOffset; }
71
void
setSectionOffset
(
uint64_t
Offset
) { SectionOffset =
Offset
; }
72
73
uint32_t
getSegmentIndex
()
const
{
return
SegmentIndex; }
74
void
setSegmentIndex
(
uint32_t
Index
) { SegmentIndex =
Index
; }
75
76
bool
getPassive
()
const
{
77
assert
(
isWasmData
());
78
return
IsPassive;
79
}
80
void
setPassive
(
bool
V =
true
) {
81
assert
(
isWasmData
());
82
IsPassive = V;
83
}
84
};
85
86
}
// end namespace llvm
87
88
#endif
assert
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Index
uint32_t Index
Definition:
ELFObjHandler.cpp:83
MCSection.h
llvm::MCAsmInfoWasm
Definition:
MCAsmInfoWasm.h:15
llvm::MCContext
Context object for machine code objects.
Definition:
MCContext.h:83
llvm::MCSectionWasm
This represents a section on wasm.
Definition:
MCSectionWasm.h:26
llvm::MCSectionWasm::getSegmentIndex
uint32_t getSegmentIndex() const
Definition:
MCSectionWasm.h:73
llvm::MCSectionWasm::setSegmentIndex
void setSegmentIndex(uint32_t Index)
Definition:
MCSectionWasm.h:74
llvm::MCSectionWasm::setPassive
void setPassive(bool V=true)
Definition:
MCSectionWasm.h:80
llvm::MCSectionWasm::isUnique
bool isUnique() const
Definition:
MCSectionWasm.h:67
llvm::MCSectionWasm::isWasmData
bool isWasmData() const
Definition:
MCSectionWasm.h:64
llvm::MCSectionWasm::getGroup
const MCSymbolWasm * getGroup() const
Definition:
MCSectionWasm.h:61
llvm::MCSectionWasm::setSectionOffset
void setSectionOffset(uint64_t Offset)
Definition:
MCSectionWasm.h:71
llvm::MCSectionWasm::getSegmentFlags
unsigned getSegmentFlags() const
Definition:
MCSectionWasm.h:62
llvm::MCSectionWasm::getSectionOffset
uint64_t getSectionOffset() const
Definition:
MCSectionWasm.h:70
llvm::MCSectionWasm::getUniqueID
unsigned getUniqueID() const
Definition:
MCSectionWasm.h:68
llvm::MCSectionWasm::isMetadata
bool isMetadata() const
Definition:
MCSectionWasm.h:65
llvm::MCSectionWasm::getPassive
bool getPassive() const
Definition:
MCSectionWasm.h:76
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition:
MCSection.h:496
llvm::MCSection::isText
bool isText() const
Definition:
MCSection.h:566
llvm::MCSection::Name
StringRef Name
Definition:
MCSection.h:557
llvm::MCSymbolWasm
Definition:
MCSymbolWasm.h:17
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:
MCSymbol.h:42
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition:
SectionKind.h:22
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:55
uint32_t
uint64_t
false
Definition:
MachinePipeliner.cpp:239
llvm::ISD::MCSymbol
@ MCSymbol
Definition:
ISDOpcodes.h:188
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::Offset
@ Offset
Definition:
DWP.cpp:477
Generated on Wed Sep 3 2025 01:32:13 for LLVM by
1.9.6