File indexing completed on 2026-05-10 08:44:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_MC_MCWASMSTREAMER_H
0010 #define LLVM_MC_MCWASMSTREAMER_H
0011
0012 #include "MCAsmBackend.h"
0013 #include "MCCodeEmitter.h"
0014 #include "llvm/MC/MCDirectives.h"
0015 #include "llvm/MC/MCObjectStreamer.h"
0016 #include "llvm/MC/MCObjectWriter.h"
0017 #include "llvm/Support/DataTypes.h"
0018
0019 namespace llvm {
0020 class MCExpr;
0021 class MCInst;
0022
0023 class MCWasmStreamer : public MCObjectStreamer {
0024 public:
0025 MCWasmStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
0026 std::unique_ptr<MCObjectWriter> OW,
0027 std::unique_ptr<MCCodeEmitter> Emitter)
0028 : MCObjectStreamer(Context, std::move(TAB), std::move(OW),
0029 std::move(Emitter)),
0030 SeenIdent(false) {}
0031
0032 ~MCWasmStreamer() override;
0033
0034
0035 void reset() override {
0036 SeenIdent = false;
0037 MCObjectStreamer::reset();
0038 }
0039
0040
0041
0042
0043 void changeSection(MCSection *Section, uint32_t Subsection) override;
0044 void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
0045 void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F,
0046 uint64_t Offset) override;
0047 void emitAssemblerFlag(MCAssemblerFlag Flag) override;
0048 void emitThumbFunc(MCSymbol *Func) override;
0049 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
0050 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
0051 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
0052 void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
0053 Align ByteAlignment) override;
0054
0055 void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
0056
0057 void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
0058 Align ByteAlignment) override;
0059
0060 void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
0061 uint64_t Size = 0, Align ByteAlignment = Align(1),
0062 SMLoc Loc = SMLoc()) override;
0063 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
0064 Align ByteAlignment = Align(1)) override;
0065
0066 void emitIdent(StringRef IdentString) override;
0067
0068 void finishImpl() override;
0069
0070 private:
0071 void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &) override;
0072 void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;
0073
0074 void fixSymbolsInTLSFixups(const MCExpr *expr);
0075
0076 bool SeenIdent;
0077 };
0078
0079 }
0080
0081 #endif