Go to the documentation of this file.
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);
134 Symbol->setExternal(
true);
138 Symbol->setExternal(
true);
185 void MCWasmStreamer::emitInstToFragment(
const MCInst &Inst,
190 for (
auto &
Fixup :
F.getFixups())
191 fixSymbolsInTLSFixups(
Fixup.getValue());
194 void MCWasmStreamer::emitInstToData(
const MCInst &Inst,
203 fixSymbolsInTLSFixups(
Fixup.getValue());
210 for (
unsigned I = 0,
E =
Fixups.size();
I !=
E; ++
I) {
214 DF->setHasInstructions(STI);
215 DF->getContents().append(
Code.begin(),
Code.end());
224 void MCWasmStreamer::fixSymbolsInTLSFixups(
const MCExpr *expr) {
232 fixSymbolsInTLSFixups(
be->getLHS());
233 fixSymbolsInTLSFixups(
be->getRHS());
243 cast<MCSymbolWasm>(symRef.
getSymbol()).setTLS();
252 fixSymbolsInTLSFixups(cast<MCUnaryExpr>(expr)->getSubExpr());
277 std::unique_ptr<MCAsmBackend> &&MAB,
278 std::unique_ptr<MCObjectWriter> &&OW,
279 std::unique_ptr<MCCodeEmitter> &&CE,
284 S->getAssembler().setRelaxAll(
true);
MCAsmBackend & getBackend() const
VariantKind getKind() const
void emitZerofill(MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, unsigned ByteAlignment=0, SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
This is an optimization pass for GlobalISel generic memory operations.
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
Context object for machine code objects.
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
@ MCSA_Invalid
Not a valid directive.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag)
Handle any target-specific assembler flags. By default, do nothing.
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset)
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
Instances of this class represent a single low-level machine instruction.
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
SmallVectorImpl< MCFixup > & getFixups()
void setVariableValue(const MCExpr *Value)
Binary assembler expressions.
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override
Emit an ELF .size directive.
@ MCSA_NoDeadStrip
.no_dead_strip (MachO)
Streaming machine code generation interface.
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
Represents a location in source code.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This represents a section on wasm.
@ Target
Target specific expression.
@ MCSA_Protected
.protected (ELF)
@ MCSA_LazyReference
.lazy_reference (MachO)
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
@ MCSA_Reference
.reference (MachO)
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can be
const MCSymbol & getSymbol() const
@ WASM_SYMBOL_TYPE_FUNCTION
@ MCSA_Hidden
.hidden (ELF)
MCFragment * getCurrentFragment() const
MCSection * getCurrentSectionOnly() const
@ Binary
Binary expressions.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
@ MCSA_Exported
.globl _foo, exported (XCOFF)
@ MCSA_WeakDefAutoPrivate
.weak_def_can_be_hidden (MachO)
MCStreamer * createWasmStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a common symbol.
MCCodeEmitter & getEmitter() const
@ MCSA_WeakReference
.weak_reference (MachO)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
~MCWasmStreamer() override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
Represent a reference to a symbol from inside an expression.
MCAssembler & getAssembler()
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.
PowerPC TLS Dynamic Call Fixup
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
@ MCSA_ELF_TypeTLS
.type _foo, STT_TLS # aka @tls_object
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 emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
@ MCSA_SymbolResolver
.symbol_resolver (MachO)
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0) override
Emit a thread local bss (.tbss) symbol.
const MCSubtargetInfo * getSubtargetInfo() const
Retrieve the MCSubTargetInfo in effect when the instruction was encoded.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset) override
@ MCSA_Global
.type _foo, @gnu_unique_object
@ MCSA_WeakDefinition
.weak_definition (MachO)
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
void flushPendingLabels()
Create a data fragment for any pending labels across all Sections and Subsections.
void finishImpl() override
Streamer specific finalization.
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
MCContext & getContext() const
@ SymbolRef
References to labels and assigned expressions.
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a local common (.lcomm) symbol.
@ Unary
Unary expressions.
@ Constant
Constant expressions.
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
A raw_ostream that writes to an SmallVector or SmallString.
@ MCSA_PrivateExtern
.private_extern (MachO)
void finishImpl() override
Streamer specific finalization.
void emitFrames(MCAsmBackend *MAB)
Fragment for data and encoded instructions.
Generic base class for all target subtargets.
LLVM Value Representation.
Base class for the full range of assembler expressions which are needed for parsing.
SmallVectorImpl< char > & getContents()
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.