1 //===- MCWasmStreamer.h - MCStreamer Wasm Object File Interface -*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCWASMSTREAMER_H
10 #define LLVM_MC_MCWASMSTREAMER_H
12 #include "MCAsmBackend.h"
13 #include "MCCodeEmitter.h"
14 #include "llvm/MC/MCDirectives.h"
15 #include "llvm/MC/MCObjectStreamer.h"
16 #include "llvm/MC/MCObjectWriter.h"
17 #include "llvm/Support/DataTypes.h"
23 class MCWasmStreamer : public MCObjectStreamer {
25 MCWasmStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
26 std::unique_ptr<MCObjectWriter> OW,
27 std::unique_ptr<MCCodeEmitter> Emitter)
28 : MCObjectStreamer(Context, std::move(TAB), std::move(OW),
32 ~MCWasmStreamer() override;
35 void reset() override {
37 MCObjectStreamer::reset();
40 /// \name MCStreamer Interface
43 void changeSection(MCSection *Section, const MCExpr *Subsection) override;
44 void emitAssemblerFlag(MCAssemblerFlag Flag) override;
45 void emitThumbFunc(MCSymbol *Func) override;
46 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
47 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
48 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
49 void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
50 unsigned ByteAlignment) override;
52 void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
54 void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
55 unsigned ByteAlignment) override;
57 void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
58 uint64_t Size = 0, unsigned ByteAlignment = 0,
59 SMLoc Loc = SMLoc()) override;
60 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
61 unsigned ByteAlignment = 0) override;
62 void emitValueImpl(const MCExpr *Value, unsigned Size,
63 SMLoc Loc = SMLoc()) override;
65 void emitIdent(StringRef IdentString) override;
67 void emitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override;
69 void finishImpl() override;
72 void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &) override;
73 void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;
75 /// Merge the content of the fragment \p EF into the fragment \p DF.
76 void mergeFragment(MCDataFragment *, MCDataFragment *);
81 } // end namespace llvm