Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:15

0001 //===- MCWasmStreamer.h - MCStreamer Wasm Object File Interface -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
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   /// state management
0035   void reset() override {
0036     SeenIdent = false;
0037     MCObjectStreamer::reset();
0038   }
0039 
0040   /// \name MCStreamer Interface
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 } // end namespace llvm
0080 
0081 #endif