42 auto *Symbol = cast<MCSymbolWasm>(S);
53 auto *Symbol = cast<MCSymbolWasm>(S);
72 auto *SectionWasm = cast<MCSectionWasm>(Section);
73 const MCSymbol *Grp = SectionWasm->getGroup();
75 Asm.registerSymbol(*Grp);
78 Asm.registerSymbol(*Section->getBeginSymbol());
92 auto *Symbol = cast<MCSymbolWasm>(S);
113 Symbol->setHidden(
true);
118 Symbol->setWeak(
true);
119 Symbol->setExternal(
true);
123 Symbol->setExternal(
true);
139 Symbol->setNoStrip();
152 Align ByteAlignment) {
157 cast<MCSymbolWasm>(Symbol)->setSize(
Value);
161 Align ByteAlignment) {
170void MCWasmStreamer::emitInstToFragment(
const MCInst &Inst,
175 for (
auto &
Fixup :
F.getFixups())
176 fixSymbolsInTLSFixups(
Fixup.getValue());
179void MCWasmStreamer::emitInstToData(
const MCInst &Inst,
186 for (
auto &
Fixup : Fixups)
187 fixSymbolsInTLSFixups(
Fixup.getValue());
194 for (
unsigned I = 0,
E = Fixups.size();
I !=
E; ++
I) {
195 Fixups[
I].setOffset(Fixups[
I].
getOffset() +
DF->getContents().size());
196 DF->getFixups().push_back(Fixups[
I]);
198 DF->setHasInstructions(STI);
199 DF->getContents().append(
Code.begin(),
Code.end());
208void MCWasmStreamer::fixSymbolsInTLSFixups(
const MCExpr *expr) {
216 fixSymbolsInTLSFixups(be->
getLHS());
217 fixSymbolsInTLSFixups(be->
getRHS());
227 cast<MCSymbolWasm>(symRef.
getSymbol()).setTLS();
236 fixSymbolsInTLSFixups(cast<MCUnaryExpr>(expr)->getSubExpr());
261 std::unique_ptr<MCAsmBackend> &&MAB,
262 std::unique_ptr<MCObjectWriter> &&OW,
263 std::unique_ptr<MCCodeEmitter> &&CE) {
265 new MCWasmStreamer(Context, std::move(MAB), std::move(OW), std::move(CE));
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file defines the SmallVector class.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag)
Handle any target-specific assembler flags. By default, do nothing.
MCCodeEmitter & getEmitter() const
MCAsmBackend & getBackend() const
bool registerSymbol(const MCSymbol &Symbol)
Binary assembler expressions.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
Context object for machine code objects.
Fragment for data and encoded instructions.
Base class for the full range of assembler expressions which are needed for parsing.
@ Unary
Unary expressions.
@ Constant
Constant expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Target
Target specific expression.
@ Binary
Binary expressions.
Instances of this class represent a single low-level machine instruction.
MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)
Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
MCAssembler & getAssembler()
virtual void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &)
Emit an instruction to a special fragment, because this instruction can change its size during relaxa...
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.
void emitFrames(MCAsmBackend *MAB)
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset)
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
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.
MCFragment * getCurrentFragment() const
MCContext & getContext() const
MCSection * getCurrentSectionOnly() const
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
VariantKind getKind() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void setVariableValue(const MCExpr *Value)
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset) override
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a local common (.lcomm) symbol.
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
~MCWasmStreamer() override
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
void finishImpl() override
Streamer specific finalization.
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment=Align(1)) override
Emit a thread local bss (.tbss) symbol.
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override
Emit an ELF .size directive.
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void emitZerofill(MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, Align ByteAlignment=Align(1), SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
Represents a location in source code.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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.
NodeAddr< CodeNode * > Code
@ WASM_SYMBOL_TYPE_FUNCTION
This is an optimization pass for GlobalISel generic memory operations.
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
MCStreamer * createWasmStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
@ 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.