LLVM: lib/MC/MCWasmStreamer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
26
27namespace llvm {
31}
32
33using namespace llvm;
34
36
38 auto *Symbol = static_cast<MCSymbolWasm *>(S);
40
44 Symbol->setTLS();
45}
46
49 auto *Symbol = static_cast<MCSymbolWasm *>(S);
51
55 Symbol->setTLS();
56}
57
60 auto *SectionWasm = static_cast<const MCSectionWasm *>(Section);
61 const MCSymbol *Grp = SectionWasm->getGroup();
62 if (Grp)
63 Asm.registerSymbol(*Grp);
64
66 Asm.registerSymbol(*Section->getBeginSymbol());
67}
68
71 auto *Symbol = static_cast<MCSymbolWasm *>(S);
72
73
74
75
77
89 return false;
90
92 Symbol->setHidden(true);
93 break;
94
97 Symbol->setWeak(true);
98 Symbol->setExternal(true);
99 break;
100
102 Symbol->setExternal(true);
103 break;
104
107 break;
108
110 Symbol->setTLS();
111 break;
112
115 break;
116
118 Symbol->setNoStrip();
119 break;
120
121 default:
122
124 return false;
125 }
126
127 return true;
128}
129
134
138
140 Align ByteAlignment) {
141 llvm_unreachable("Local common symbols are not yet implemented for Wasm");
142}
143
148
154
156 std::unique_ptr &&MAB,
157 std::unique_ptr &&OW,
158 std::unique_ptr &&CE) {
160 new MCWasmStreamer(Context, std::move(MAB), std::move(OW), std::move(CE));
161 return S;
162}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol)
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
MCAssembler & getAssembler()
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment &F, uint64_t Offset)
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void finishImpl() override
Streamer specific finalization.
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
This represents a section on wasm.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
MCSection * getCurrentSectionOnly() const
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
Definition MCWasmStreamer.cpp:130
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a local common (.lcomm) symbol.
Definition MCWasmStreamer.cpp:139
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment &F, uint64_t Offset) override
Definition MCWasmStreamer.cpp:47
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
Definition MCWasmStreamer.cpp:144
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Definition MCWasmStreamer.cpp:37
~MCWasmStreamer() override
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
Definition MCWasmStreamer.cpp:58
void finishImpl() override
Streamer specific finalization.
Definition MCWasmStreamer.cpp:149
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override
Emit an ELF .size directive.
Definition MCWasmStreamer.cpp:135
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
Definition MCWasmStreamer.cpp:69
Represents a location in source code.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ WASM_SYMBOL_TYPE_FUNCTION
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI MCStreamer * createWasmStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
Definition MCWasmStreamer.cpp:155
@ MCSA_WeakDefAutoPrivate
.weak_def_can_be_hidden (MachO)
@ MCSA_Protected
.protected (ELF)
@ MCSA_Exported
.globl _foo, exported (XCOFF)
@ MCSA_PrivateExtern
.private_extern (MachO)
@ MCSA_WeakReference
.weak_reference (MachO)
@ MCSA_LazyReference
.lazy_reference (MachO)
@ MCSA_Reference
.reference (MachO)
@ MCSA_SymbolResolver
.symbol_resolver (MachO)
@ MCSA_ELF_TypeTLS
.type _foo, STT_TLS # aka @tls_object
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
@ MCSA_WeakDefinition
.weak_definition (MachO)
@ MCSA_Global
.type _foo, @gnu_unique_object
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
@ MCSA_Hidden
.hidden (ELF)
@ MCSA_Invalid
Not a valid directive.
@ MCSA_NoDeadStrip
.no_dead_strip (MachO)
This struct is a compact representation of a valid (non-zero power of two) alignment.