MCWinCOFFStreamer.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- MCWinCOFFStreamer.h - COFF Object File Interface ---------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCWINCOFFSTREAMER_H
  14. #define LLVM_MC_MCWINCOFFSTREAMER_H
  15. #include "llvm/MC/MCDirectives.h"
  16. #include "llvm/MC/MCObjectStreamer.h"
  17. namespace llvm {
  18. class MCAsmBackend;
  19. class MCContext;
  20. class MCCodeEmitter;
  21. class MCInst;
  22. class MCSection;
  23. class MCSubtargetInfo;
  24. class MCSymbol;
  25. class StringRef;
  26. class raw_pwrite_stream;
  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. /// state management
  33. void reset() override {
  34. CurSymbol = nullptr;
  35. MCObjectStreamer::reset();
  36. }
  37. /// \name MCStreamer interface
  38. /// \{
  39. void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override;
  40. void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
  41. void emitAssemblerFlag(MCAssemblerFlag Flag) override;
  42. void emitThumbFunc(MCSymbol *Func) override;
  43. bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
  44. void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
  45. void beginCOFFSymbolDef(MCSymbol const *Symbol) override;
  46. void emitCOFFSymbolStorageClass(int StorageClass) override;
  47. void emitCOFFSymbolType(int Type) override;
  48. void endCOFFSymbolDef() override;
  49. void emitCOFFSafeSEH(MCSymbol const *Symbol) override;
  50. void emitCOFFSymbolIndex(MCSymbol const *Symbol) override;
  51. void emitCOFFSectionIndex(MCSymbol const *Symbol) override;
  52. void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
  53. void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
  54. void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
  55. Align ByteAlignment) override;
  56. void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
  57. Align ByteAlignment) override;
  58. void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
  59. void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
  60. Align ByteAlignment, SMLoc Loc = SMLoc()) override;
  61. void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
  62. Align ByteAlignment) override;
  63. void emitIdent(StringRef IdentString) override;
  64. void emitWinEHHandlerData(SMLoc Loc) override;
  65. void emitCGProfileEntry(const MCSymbolRefExpr *From,
  66. const MCSymbolRefExpr *To, uint64_t Count) override;
  67. void finishImpl() override;
  68. /// \}
  69. protected:
  70. const MCSymbol *CurSymbol;
  71. void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
  72. void finalizeCGProfileEntry(const MCSymbolRefExpr *&S);
  73. void finalizeCGProfile();
  74. private:
  75. void Error(const Twine &Msg) const;
  76. };
  77. } // end namespace llvm
  78. #endif // LLVM_MC_MCWINCOFFSTREAMER_H
  79. #ifdef __GNUC__
  80. #pragma GCC diagnostic pop
  81. #endif