47 DF->getContents().size());
56 auto *Symbol = cast<MCSymbolWasm>(S);
67 auto *Symbol = cast<MCSymbolWasm>(S);
85 const MCExpr *Subsection) {
87 auto *SectionWasm = cast<MCSectionWasm>(Section);
88 const MCSymbol *Grp = SectionWasm->getGroup();
90 Asm.registerSymbol(*Grp);
93 Asm.registerSymbol(*Section->getBeginSymbol());
107 auto *Symbol = cast<MCSymbolWasm>(S);
128 Symbol->setHidden(
true);
133 Symbol->setWeak(
true);
134 Symbol->setExternal(
true);
138 Symbol->setExternal(
true);
154 Symbol->setNoStrip();
167 Align ByteAlignment) {
172 cast<MCSymbolWasm>(Symbol)->setSize(
Value);
176 Align ByteAlignment) {
185void MCWasmStreamer::emitInstToFragment(
const MCInst &Inst,
190 for (
auto &
Fixup :
F.getFixups())
191 fixSymbolsInTLSFixups(
Fixup.getValue());
194void MCWasmStreamer::emitInstToData(
const MCInst &Inst,
201 for (
auto &
Fixup : Fixups)
202 fixSymbolsInTLSFixups(
Fixup.getValue());
209 for (
unsigned I = 0,
E = Fixups.size();
I !=
E; ++
I) {
210 Fixups[
I].setOffset(Fixups[
I].
getOffset() +
DF->getContents().size());
211 DF->getFixups().push_back(Fixups[
I]);
213 DF->setHasInstructions(STI);
214 DF->getContents().append(
Code.begin(),
Code.end());
223void MCWasmStreamer::fixSymbolsInTLSFixups(
const MCExpr *expr) {
231 fixSymbolsInTLSFixups(be->
getLHS());
232 fixSymbolsInTLSFixups(be->
getRHS());
242 cast<MCSymbolWasm>(symRef.
getSymbol()).setTLS();
251 fixSymbolsInTLSFixups(cast<MCUnaryExpr>(expr)->getSubExpr());
276 std::unique_ptr<MCAsmBackend> &&MAB,
277 std::unique_ptr<MCObjectWriter> &&OW,
278 std::unique_ptr<MCCodeEmitter> &&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)
void setRelaxAll(bool Value)
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, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
Context object for machine code objects.
Fragment for data and encoded instructions.
SmallVectorImpl< char > & getContents()
SmallVectorImpl< MCFixup > & getFixups()
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
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()
void flushPendingLabels()
Create a data fragment for any pending labels across all Sections and Subsections.
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset)
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.
MCFragment * getCurrentFragment() const
void emitFrames(MCAsmBackend *MAB)
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
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.
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 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 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 emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset) override
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.
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
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.
@ 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, bool RelaxAll)
@ 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.