Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- MCWinCOFFStreamer.h - COFF 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_MCWINCOFFSTREAMER_H
0010 #define LLVM_MC_MCWINCOFFSTREAMER_H
0011 
0012 #include "llvm/MC/MCDirectives.h"
0013 #include "llvm/MC/MCObjectStreamer.h"
0014 
0015 namespace llvm {
0016 
0017 class MCAsmBackend;
0018 class MCContext;
0019 class MCCodeEmitter;
0020 class MCInst;
0021 class MCSection;
0022 class MCSubtargetInfo;
0023 class MCSymbol;
0024 class StringRef;
0025 class WinCOFFObjectWriter;
0026 class raw_pwrite_stream;
0027 
0028 class MCWinCOFFStreamer : public MCObjectStreamer {
0029 public:
0030   MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
0031                     std::unique_ptr<MCCodeEmitter> CE,
0032                     std::unique_ptr<MCObjectWriter> OW);
0033 
0034   /// state management
0035   void reset() override {
0036     CurSymbol = nullptr;
0037     MCObjectStreamer::reset();
0038   }
0039 
0040   WinCOFFObjectWriter &getWriter();
0041 
0042   /// \name MCStreamer interface
0043   /// \{
0044 
0045   void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override;
0046   void changeSection(MCSection *Section, uint32_t Subsection = 0) override;
0047   void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
0048   void emitAssemblerFlag(MCAssemblerFlag Flag) override;
0049   void emitThumbFunc(MCSymbol *Func) override;
0050   bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
0051   void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
0052   void beginCOFFSymbolDef(MCSymbol const *Symbol) override;
0053   void emitCOFFSymbolStorageClass(int StorageClass) override;
0054   void emitCOFFSymbolType(int Type) override;
0055   void endCOFFSymbolDef() override;
0056   void emitCOFFSafeSEH(MCSymbol const *Symbol) override;
0057   void emitCOFFSymbolIndex(MCSymbol const *Symbol) override;
0058   void emitCOFFSectionIndex(MCSymbol const *Symbol) override;
0059   void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
0060   void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
0061   void emitCOFFSecNumber(MCSymbol const *Symbol) override;
0062   void emitCOFFSecOffset(MCSymbol const *Symbol) override;
0063   void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
0064                         Align ByteAlignment) override;
0065   void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
0066                              Align ByteAlignment) override;
0067   void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
0068   void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
0069                     Align ByteAlignment, SMLoc Loc = SMLoc()) override;
0070   void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
0071                       Align ByteAlignment) override;
0072   void emitIdent(StringRef IdentString) override;
0073   void emitWinEHHandlerData(SMLoc Loc) override;
0074   void emitCGProfileEntry(const MCSymbolRefExpr *From,
0075                           const MCSymbolRefExpr *To, uint64_t Count) override;
0076   void finishImpl() override;
0077 
0078   /// \}
0079 
0080 protected:
0081   const MCSymbol *CurSymbol;
0082 
0083   void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
0084 
0085   void finalizeCGProfileEntry(const MCSymbolRefExpr *&S);
0086 
0087 private:
0088   void Error(const Twine &Msg) const;
0089 };
0090 
0091 } // end namespace llvm
0092 
0093 #endif // LLVM_MC_MCWINCOFFSTREAMER_H