Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //===- MCWinCOFFStreamer.h - COFF Object File Interface ---------*- C++ -*-===// |
| 2 | // |
||
| 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 |
||
| 6 | // |
||
| 7 | //===----------------------------------------------------------------------===// |
||
| 8 | |||
| 9 | #ifndef LLVM_MC_MCWINCOFFSTREAMER_H |
||
| 10 | #define LLVM_MC_MCWINCOFFSTREAMER_H |
||
| 11 | |||
| 12 | #include "llvm/MC/MCDirectives.h" |
||
| 13 | #include "llvm/MC/MCObjectStreamer.h" |
||
| 14 | |||
| 15 | namespace llvm { |
||
| 16 | |||
| 17 | class MCAsmBackend; |
||
| 18 | class MCContext; |
||
| 19 | class MCCodeEmitter; |
||
| 20 | class MCInst; |
||
| 21 | class MCSection; |
||
| 22 | class MCSubtargetInfo; |
||
| 23 | class MCSymbol; |
||
| 24 | class StringRef; |
||
| 25 | class raw_pwrite_stream; |
||
| 26 | |||
| 27 | class MCWinCOFFStreamer : public MCObjectStreamer { |
||
| 28 | public: |
||
| 29 | MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB, |
||
| 30 | std::unique_ptr<MCCodeEmitter> CE, |
||
| 31 | std::unique_ptr<MCObjectWriter> OW); |
||
| 32 | |||
| 33 | /// state management |
||
| 34 | void reset() override { |
||
| 35 | CurSymbol = nullptr; |
||
| 36 | MCObjectStreamer::reset(); |
||
| 37 | } |
||
| 38 | |||
| 39 | /// \name MCStreamer interface |
||
| 40 | /// \{ |
||
| 41 | |||
| 42 | void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override; |
||
| 43 | void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; |
||
| 44 | void emitAssemblerFlag(MCAssemblerFlag Flag) override; |
||
| 45 | void emitThumbFunc(MCSymbol *Func) override; |
||
| 46 | bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; |
||
| 47 | void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; |
||
| 48 | void beginCOFFSymbolDef(MCSymbol const *Symbol) override; |
||
| 49 | void emitCOFFSymbolStorageClass(int StorageClass) override; |
||
| 50 | void emitCOFFSymbolType(int Type) override; |
||
| 51 | void endCOFFSymbolDef() override; |
||
| 52 | void emitCOFFSafeSEH(MCSymbol const *Symbol) override; |
||
| 53 | void emitCOFFSymbolIndex(MCSymbol const *Symbol) override; |
||
| 54 | void emitCOFFSectionIndex(MCSymbol const *Symbol) override; |
||
| 55 | void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override; |
||
| 56 | void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override; |
||
| 57 | void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, |
||
| 58 | Align ByteAlignment) override; |
||
| 59 | void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, |
||
| 60 | Align ByteAlignment) override; |
||
| 61 | void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override; |
||
| 62 | void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, |
||
| 63 | Align ByteAlignment, SMLoc Loc = SMLoc()) override; |
||
| 64 | void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, |
||
| 65 | Align ByteAlignment) override; |
||
| 66 | void emitIdent(StringRef IdentString) override; |
||
| 67 | void emitWinEHHandlerData(SMLoc Loc) override; |
||
| 68 | void emitCGProfileEntry(const MCSymbolRefExpr *From, |
||
| 69 | const MCSymbolRefExpr *To, uint64_t Count) override; |
||
| 70 | void finishImpl() override; |
||
| 71 | |||
| 72 | /// \} |
||
| 73 | |||
| 74 | protected: |
||
| 75 | const MCSymbol *CurSymbol; |
||
| 76 | |||
| 77 | void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override; |
||
| 78 | |||
| 79 | void finalizeCGProfileEntry(const MCSymbolRefExpr *&S); |
||
| 80 | void finalizeCGProfile(); |
||
| 81 | |||
| 82 | private: |
||
| 83 | void Error(const Twine &Msg) const; |
||
| 84 | }; |
||
| 85 | |||
| 86 | } // end namespace llvm |
||
| 87 | |||
| 88 | #endif // LLVM_MC_MCWINCOFFSTREAMER_H |