[PATCH] D39907: Move declaration of MCAsmStreamer to include, NFC.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 14:22:49 PST 2017


My main concern is not having both delegation an inheritance.

Ideally extend the existing delegation system. If that is not
appropriate, move everything to inheritance.

Cheers,
Rafael

Alexey Bataev <a.bataev at hotmail.com> writes:

> In short, need to override several member functions completely because of the limitations of PTX format. I can move them to TargetStreamer completely, probably. Will be able provide more info on Monday.
>
> Best regards,
> Alexey Bataev
>
> 10 нояб. 2017 г., в 16:58, Rafael Avila de Espindola <rafael.espindola at gmail.com<mailto:rafael.espindola at gmail.com>> написал(а):
>
> The existing and support way of doing target specific things is via
> TargetStreamer. What prevents you from using it?
>
> Cheers,
> Rafael
>
> Alexey Bataev via Phabricator via llvm-commits
> <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> writes:
>
> ABataev created this revision.
> Herald added a subscriber: aprantl.
>
> Declaration of MCAsmStreamer is moved to include directory to make it
> possible to override it. Required for implementing of debug info for
> Cuda/NVPTX.
>
>
> https://reviews.llvm.org/D39907
>
> Files:
>  include/llvm/MC/MCAsmStreamer.h
>  include/llvm/Support/TargetRegistry.h
>  lib/MC/MCAsmStreamer.cpp
>
> Index: lib/MC/MCAsmStreamer.cpp
> ===================================================================
> --- lib/MC/MCAsmStreamer.cpp
> +++ lib/MC/MCAsmStreamer.cpp
> @@ -8,23 +8,20 @@
> //===----------------------------------------------------------------------===//
>
> #include "llvm/ADT/STLExtras.h"
> -#include "llvm/ADT/SmallString.h"
> #include "llvm/ADT/StringExtras.h"
> #include "llvm/ADT/Twine.h"
> #include "llvm/MC/MCAsmBackend.h"
> +#include "llvm/MC/MCAsmStreamer.h"
> #include "llvm/MC/MCAsmInfo.h"
> #include "llvm/MC/MCCodeEmitter.h"
> #include "llvm/MC/MCCodeView.h"
> -#include "llvm/MC/MCContext.h"
> #include "llvm/MC/MCExpr.h"
> #include "llvm/MC/MCFixupKindInfo.h"
> #include "llvm/MC/MCInst.h"
> -#include "llvm/MC/MCInstPrinter.h"
> #include "llvm/MC/MCObjectFileInfo.h"
> #include "llvm/MC/MCRegisterInfo.h"
> #include "llvm/MC/MCSectionCOFF.h"
> #include "llvm/MC/MCSectionMachO.h"
> -#include "llvm/MC/MCStreamer.h"
> #include "llvm/MC/MCSymbolELF.h"
> #include "llvm/Support/ErrorHandling.h"
> #include "llvm/Support/Format.h"
> @@ -37,279 +34,17 @@
>
> using namespace llvm;
>
> -namespace {
> -
> -class MCAsmStreamer final : public MCStreamer {
> -  std::unique_ptr<formatted_raw_ostream> OSOwner;
> -  formatted_raw_ostream &OS;
> -  const MCAsmInfo *MAI;
> -  std::unique_ptr<MCInstPrinter> InstPrinter;
> -  std::unique_ptr<MCCodeEmitter> Emitter;
> -  std::unique_ptr<MCAsmBackend> AsmBackend;
> -
> -  SmallString<128> ExplicitCommentToEmit;
> -  SmallString<128> CommentToEmit;
> -  raw_svector_ostream CommentStream;
> -
> -  unsigned IsVerboseAsm : 1;
> -  unsigned ShowInst : 1;
> -  unsigned UseDwarfDirectory : 1;
> -
> -  void EmitRegisterName(int64_t Register);
> -  void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
> -  void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
> -
> -public:
> -  MCAsmStreamer(MCContext &Context, std::unique_ptr<formatted_raw_ostream> os,
> -                bool isVerboseAsm, bool useDwarfDirectory,
> -                MCInstPrinter *printer, MCCodeEmitter *emitter,
> -                MCAsmBackend *asmbackend, bool showInst)
> -      : MCStreamer(Context), OSOwner(std::move(os)), OS(*OSOwner),
> -        MAI(Context.getAsmInfo()), InstPrinter(printer), Emitter(emitter),
> -        AsmBackend(asmbackend), CommentStream(CommentToEmit),
> -        IsVerboseAsm(isVerboseAsm), ShowInst(showInst),
> -        UseDwarfDirectory(useDwarfDirectory) {
> -    assert(InstPrinter);
> -    if (IsVerboseAsm)
> -        InstPrinter->setCommentStream(CommentStream);
> -  }
> -
> -  inline void EmitEOL() {
> -    // Dump Explicit Comments here.
> -    emitExplicitComments();
> -    // If we don't have any comments, just emit a \n.
> -    if (!IsVerboseAsm) {
> -      OS << '\n';
> -      return;
> -    }
> -    EmitCommentsAndEOL();
> -  }
> -
> -  void EmitSyntaxDirective() override;
> -
> -  void EmitCommentsAndEOL();
> -
> -  /// isVerboseAsm - Return true if this streamer supports verbose assembly at
> -  /// all.
> -  bool isVerboseAsm() const override { return IsVerboseAsm; }
> -
> -  /// hasRawTextSupport - We support EmitRawText.
> -  bool hasRawTextSupport() const override { return true; }
> -
> -  /// AddComment - Add a comment that can be emitted to the generated .s
> -  /// file if applicable as a QoI issue to make the output of the compiler
> -  /// more readable.  This only affects the MCAsmStreamer, and only when
> -  /// verbose assembly output is enabled.
> -  void AddComment(const Twine &T, bool EOL = true) override;
> -
> -  /// AddEncodingComment - Add a comment showing the encoding of an instruction.
> -  /// If PrintSchedInfo - is true then the comment sched:[x:y] should
> -  //    be added to output if it's being supported by target
> -  void AddEncodingComment(const MCInst &Inst, const MCSubtargetInfo &,
> -                          bool PrintSchedInfo);
> -
> -  /// GetCommentOS - Return a raw_ostream that comments can be written to.
> -  /// Unlike AddComment, you are required to terminate comments with \n if you
> -  /// use this method.
> -  raw_ostream &GetCommentOS() override {
> -    if (!IsVerboseAsm)
> -      return nulls();  // Discard comments unless in verbose asm mode.
> -    return CommentStream;
> -  }
> -
> -  void emitRawComment(const Twine &T, bool TabPrefix = true) override;
> -
> -  void addExplicitComment(const Twine &T) override;
> -  void emitExplicitComments() override;
> -
> -  /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
> -  void AddBlankLine() override {
> -    EmitEOL();
> +/// Emit End-Of-Line symbol.
> +inline void MCAsmStreamer::EmitEOL() {
> +  // Dump Explicit Comments here.
> +  emitExplicitComments();
> +  // If we don't have any comments, just emit a \n.
> +  if (!IsVerboseAsm) {
> +    OS << '\n';
> +    return;
>   }
> -
> -  /// @name MCStreamer Interface
> -  /// @{
> -
> -  void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
> -
> -  void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
> -  void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
> -
> -  void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
> -  void EmitLinkerOptions(ArrayRef<std::string> Options) override;
> -  void EmitDataRegion(MCDataRegionType Kind) override;
> -  void EmitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor,
> -                      unsigned Update) override;
> -  void EmitThumbFunc(MCSymbol *Func) override;
> -
> -  void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
> -  void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
> -  bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
> -
> -  void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
> -  void BeginCOFFSymbolDef(const MCSymbol *Symbol) override;
> -  void EmitCOFFSymbolStorageClass(int StorageClass) override;
> -  void EmitCOFFSymbolType(int Type) override;
> -  void EndCOFFSymbolDef() override;
> -  void EmitCOFFSafeSEH(MCSymbol const *Symbol) override;
> -  void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
> -  void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
> -  void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
> -  void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
> -                        unsigned ByteAlignment) override;
> -
> -  /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
> -  ///
> -  /// @param Symbol - The common symbol to emit.
> -  /// @param Size - The size of the common symbol.
> -  /// @param ByteAlignment - The alignment of the common symbol in bytes.
> -  void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
> -                             unsigned ByteAlignment) override;
> -
> -  void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
> -                    uint64_t Size = 0, unsigned ByteAlignment = 0) override;
> -
> -  void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
> -                      unsigned ByteAlignment = 0) override;
> -
> -  void EmitBinaryData(StringRef Data) override;
> -
> -  void EmitBytes(StringRef Data) override;
> -
> -  void EmitValueImpl(const MCExpr *Value, unsigned Size,
> -                     SMLoc Loc = SMLoc()) override;
> -  void EmitIntValue(uint64_t Value, unsigned Size) override;
> -
> -  void EmitULEB128Value(const MCExpr *Value) override;
> -
> -  void EmitSLEB128Value(const MCExpr *Value) override;
> -
> -  void EmitDTPRel32Value(const MCExpr *Value) override;
> -  void EmitDTPRel64Value(const MCExpr *Value) override;
> -  void EmitTPRel32Value(const MCExpr *Value) override;
> -  void EmitTPRel64Value(const MCExpr *Value) override;
> -
> -  void EmitGPRel64Value(const MCExpr *Value) override;
> -
> -  void EmitGPRel32Value(const MCExpr *Value) override;
> -
> -
> -  void emitFill(uint64_t NumBytes, uint8_t FillValue) override;
> -
> -  void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
> -                SMLoc Loc = SMLoc()) override;
> -
> -  void emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) override;
> -
> -  void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
> -                SMLoc Loc = SMLoc()) override;
> -
> -  void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
> -                            unsigned ValueSize = 1,
> -                            unsigned MaxBytesToEmit = 0) override;
> -
> -  void EmitCodeAlignment(unsigned ByteAlignment,
> -                         unsigned MaxBytesToEmit = 0) override;
> -
> -  void emitValueToOffset(const MCExpr *Offset,
> -                         unsigned char Value,
> -                         SMLoc Loc) override;
> -
> -  void EmitFileDirective(StringRef Filename) override;
> -  unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
> -                                  StringRef Filename,
> -                                  unsigned CUID = 0) override;
> -  void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
> -                             unsigned Column, unsigned Flags,
> -                             unsigned Isa, unsigned Discriminator,
> -                             StringRef FileName) override;
> -  MCSymbol *getDwarfLineTableSymbol(unsigned CUID) override;
> -
> -  bool EmitCVFileDirective(unsigned FileNo, StringRef Filename,
> -                           ArrayRef<uint8_t> Checksum,
> -                           unsigned ChecksumKind) override;
> -  bool EmitCVFuncIdDirective(unsigned FuncId) override;
> -  bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc,
> -                                   unsigned IAFile, unsigned IALine,
> -                                   unsigned IACol, SMLoc Loc) override;
> -  void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line,
> -                          unsigned Column, bool PrologueEnd, bool IsStmt,
> -                          StringRef FileName, SMLoc Loc) override;
> -  void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart,
> -                                const MCSymbol *FnEnd) override;
> -  void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
> -                                      unsigned SourceFileId,
> -                                      unsigned SourceLineNum,
> -                                      const MCSymbol *FnStartSym,
> -                                      const MCSymbol *FnEndSym) override;
> -  void EmitCVDefRangeDirective(
> -      ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
> -      StringRef FixedSizePortion) override;
> -  void EmitCVStringTableDirective() override;
> -  void EmitCVFileChecksumsDirective() override;
> -  void EmitCVFileChecksumOffsetDirective(unsigned FileNo) override;
> -  void EmitCVFPOData(const MCSymbol *ProcSym, SMLoc L) override;
> -
> -  void EmitIdent(StringRef IdentString) override;
> -  void EmitCFISections(bool EH, bool Debug) override;
> -  void EmitCFIDefCfa(int64_t Register, int64_t Offset) override;
> -  void EmitCFIDefCfaOffset(int64_t Offset) override;
> -  void EmitCFIDefCfaRegister(int64_t Register) override;
> -  void EmitCFIOffset(int64_t Register, int64_t Offset) override;
> -  void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding) override;
> -  void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) override;
> -  void EmitCFIRememberState() override;
> -  void EmitCFIRestoreState() override;
> -  void EmitCFIRestore(int64_t Register) override;
> -  void EmitCFISameValue(int64_t Register) override;
> -  void EmitCFIRelOffset(int64_t Register, int64_t Offset) override;
> -  void EmitCFIAdjustCfaOffset(int64_t Adjustment) override;
> -  void EmitCFIEscape(StringRef Values) override;
> -  void EmitCFIGnuArgsSize(int64_t Size) override;
> -  void EmitCFISignalFrame() override;
> -  void EmitCFIUndefined(int64_t Register) override;
> -  void EmitCFIRegister(int64_t Register1, int64_t Register2) override;
> -  void EmitCFIWindowSave() override;
> -  void EmitCFIReturnColumn(int64_t Register) override;
> -
> -  void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc) override;
> -  void EmitWinCFIEndProc(SMLoc Loc) override;
> -  void EmitWinCFIStartChained(SMLoc Loc) override;
> -  void EmitWinCFIEndChained(SMLoc Loc) override;
> -  void EmitWinCFIPushReg(unsigned Register, SMLoc Loc) override;
> -  void EmitWinCFISetFrame(unsigned Register, unsigned Offset,
> -                          SMLoc Loc) override;
> -  void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc) override;
> -  void EmitWinCFISaveReg(unsigned Register, unsigned Offset,
> -                         SMLoc Loc) override;
> -  void EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
> -                         SMLoc Loc) override;
> -  void EmitWinCFIPushFrame(bool Code, SMLoc Loc) override;
> -  void EmitWinCFIEndProlog(SMLoc Loc) override;
> -
> -  void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except,
> -                        SMLoc Loc) override;
> -  void EmitWinEHHandlerData(SMLoc Loc) override;
> -
> -  void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
> -                       bool PrintSchedInfo) override;
> -
> -  void EmitBundleAlignMode(unsigned AlignPow2) override;
> -  void EmitBundleLock(bool AlignToEnd) override;
> -  void EmitBundleUnlock() override;
> -
> -  bool EmitRelocDirective(const MCExpr &Offset, StringRef Name,
> -                          const MCExpr *Expr, SMLoc Loc) override;
> -
> -  /// EmitRawText - If this file is backed by an assembly streamer, this dumps
> -  /// the specified string in the output .s file.  This capability is
> -  /// indicated by the hasRawTextSupport() predicate.
> -  void EmitRawTextImpl(StringRef String) override;
> -
> -  void FinishImpl() override;
> -};
> -
> -} // end anonymous namespace.
> +  EmitCommentsAndEOL();
> +}
>
> /// AddComment - Add a comment that can be emitted to the generated .s
> /// file if applicable as a QoI issue to make the output of the compiler
> Index: include/llvm/Support/TargetRegistry.h
> ===================================================================
> --- include/llvm/Support/TargetRegistry.h
> +++ include/llvm/Support/TargetRegistry.h
> @@ -164,6 +164,10 @@
>   using AsmTargetStreamerCtorTy = MCTargetStreamer *(*)(
>       MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint,
>       bool IsVerboseAsm);
> +  using AsmStreamerCtorTy = MCStreamer
> +      *(*)(MCContext &Context, std::unique_ptr<formatted_raw_ostream> OS,
> +           bool isVerboseAsm, bool useDwarfDirectory, MCInstPrinter *IP,
> +           MCCodeEmitter *CE, MCAsmBackend *MAB, bool ShowInst);
>   using ObjectTargetStreamerCtorTy = MCTargetStreamer *(*)(
>       MCStreamer &S, const MCSubtargetInfo &STI);
>   using MCRelocationInfoCtorTy = MCRelocationInfo *(*)(const Triple &TT,
> @@ -252,6 +256,9 @@
>   /// registered (default = nullptr).
>   AsmTargetStreamerCtorTy AsmTargetStreamerCtorFn = nullptr;
>
> +  /// Construction function for common asm streamer.
> +  AsmStreamerCtorTy AsmStreamerCtorFn = nullptr;
> +
>   /// Construction function for this target's obj TargetStreamer, if
>   /// registered (default = nullptr).
>   ObjectTargetStreamerCtorTy ObjectTargetStreamerCtorFn = nullptr;
> @@ -492,9 +499,11 @@
>                                 MCInstPrinter *InstPrint, MCCodeEmitter *CE,
>                                 MCAsmBackend *TAB, bool ShowInst) const {
>     formatted_raw_ostream &OSRef = *OS;
> -    MCStreamer *S = llvm::createAsmStreamer(Ctx, std::move(OS), IsVerboseAsm,
> -                                            UseDwarfDirectory, InstPrint, CE,
> -                                            TAB, ShowInst);
> +    AsmStreamerCtorTy Streamer =
> +        AsmStreamerCtorFn ? AsmStreamerCtorFn : llvm::createAsmStreamer;
> +    MCStreamer *S = Streamer(Ctx, std::move(OS), IsVerboseAsm,
> +                             UseDwarfDirectory, InstPrint, CE, TAB, ShowInst);
> +
>     createAsmTargetStreamer(*S, OSRef, InstPrint, IsVerboseAsm);
>     return S;
>   }
> @@ -830,6 +839,10 @@
>     T.AsmTargetStreamerCtorFn = Fn;
>   }
>
> +  static void RegisterAsmStreamer(Target &T, Target::AsmStreamerCtorTy Fn) {
> +    T.AsmStreamerCtorFn = Fn;
> +  }
> +
>   static void
>   RegisterObjectTargetStreamer(Target &T,
>                                Target::ObjectTargetStreamerCtorTy Fn) {
> Index: include/llvm/MC/MCAsmStreamer.h
> ===================================================================
> --- /dev/null
> +++ include/llvm/MC/MCAsmStreamer.h
> @@ -0,0 +1,284 @@
> +//===- lib/MC/MCAsmStreamer.h - Text Assembly Output ------------*- C++ -*-===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===----------------------------------------------------------------------===//
> +
> +#include "llvm/ADT/SmallString.h"
> +#include "llvm/MC/MCContext.h"
> +#include "llvm/MC/MCInstPrinter.h"
> +#include "llvm/MC/MCStreamer.h"
> +
> +namespace llvm {
> +class Twine;
> +class MCAsmBackend;
> +class MCAsmInfo;
> +class MCCodeEmitter;
> +class MCExpr;
> +class MCInst;
> +
> +class MCAsmStreamer final : public MCStreamer {
> +  std::unique_ptr<formatted_raw_ostream> OSOwner;
> +  formatted_raw_ostream &OS;
> +  const MCAsmInfo *MAI;
> +  std::unique_ptr<MCInstPrinter> InstPrinter;
> +  std::unique_ptr<MCCodeEmitter> Emitter;
> +  std::unique_ptr<MCAsmBackend> AsmBackend;
> +
> +  SmallString<128> ExplicitCommentToEmit;
> +  SmallString<128> CommentToEmit;
> +  raw_svector_ostream CommentStream;
> +
> +  unsigned IsVerboseAsm : 1;
> +  unsigned ShowInst : 1;
> +  unsigned UseDwarfDirectory : 1;
> +
> +  void EmitRegisterName(int64_t Register);
> +  void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
> +  void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
> +
> +public:
> +  MCAsmStreamer(MCContext &Context, std::unique_ptr<formatted_raw_ostream> os,
> +                bool isVerboseAsm, bool useDwarfDirectory,
> +                MCInstPrinter *printer, MCCodeEmitter *emitter,
> +                MCAsmBackend *asmbackend, bool showInst)
> +      : MCStreamer(Context), OSOwner(std::move(os)), OS(*OSOwner),
> +        MAI(Context.getAsmInfo()), InstPrinter(printer), Emitter(emitter),
> +        AsmBackend(asmbackend), CommentStream(CommentToEmit),
> +        IsVerboseAsm(isVerboseAsm), ShowInst(showInst),
> +        UseDwarfDirectory(useDwarfDirectory) {
> +    assert(InstPrinter);
> +    if (IsVerboseAsm)
> +        InstPrinter->setCommentStream(CommentStream);
> +  }
> +
> +  void EmitEOL();
> +
> +  void EmitSyntaxDirective() override;
> +
> +  void EmitCommentsAndEOL();
> +
> +  /// isVerboseAsm - Return true if this streamer supports verbose assembly at
> +  /// all.
> +  bool isVerboseAsm() const override { return IsVerboseAsm; }
> +
> +  /// hasRawTextSupport - We support EmitRawText.
> +  bool hasRawTextSupport() const override { return true; }
> +
> +  /// AddComment - Add a comment that can be emitted to the generated .s
> +  /// file if applicable as a QoI issue to make the output of the compiler
> +  /// more readable.  This only affects the MCAsmStreamer, and only when
> +  /// verbose assembly output is enabled.
> +  void AddComment(const Twine &T, bool EOL = true) override;
> +
> +  /// AddEncodingComment - Add a comment showing the encoding of an instruction.
> +  /// If PrintSchedInfo - is true then the comment sched:[x:y] should
> +  //    be added to output if it's being supported by target
> +  void AddEncodingComment(const MCInst &Inst, const MCSubtargetInfo &,
> +                          bool PrintSchedInfo);
> +
> +  /// GetCommentOS - Return a raw_ostream that comments can be written to.
> +  /// Unlike AddComment, you are required to terminate comments with \n if you
> +  /// use this method.
> +  raw_ostream &GetCommentOS() override {
> +    if (!IsVerboseAsm)
> +      return nulls();  // Discard comments unless in verbose asm mode.
> +    return CommentStream;
> +  }
> +
> +  void emitRawComment(const Twine &T, bool TabPrefix = true) override;
> +
> +  void addExplicitComment(const Twine &T) override;
> +  void emitExplicitComments() override;
> +
> +  /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
> +  void AddBlankLine() override {
> +    EmitEOL();
> +  }
> +
> +  /// @name MCStreamer Interface
> +  /// @{
> +
> +  void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
> +
> +  void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
> +  void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
> +
> +  void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
> +  void EmitLinkerOptions(ArrayRef<std::string> Options) override;
> +  void EmitDataRegion(MCDataRegionType Kind) override;
> +  void EmitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor,
> +                      unsigned Update) override;
> +  void EmitThumbFunc(MCSymbol *Func) override;
> +
> +  void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
> +  void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
> +  bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
> +
> +  void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
> +  void BeginCOFFSymbolDef(const MCSymbol *Symbol) override;
> +  void EmitCOFFSymbolStorageClass(int StorageClass) override;
> +  void EmitCOFFSymbolType(int Type) override;
> +  void EndCOFFSymbolDef() override;
> +  void EmitCOFFSafeSEH(MCSymbol const *Symbol) override;
> +  void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
> +  void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
> +  void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
> +  void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
> +                        unsigned ByteAlignment) override;
> +
> +  /// EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
> +  ///
> +  /// @param Symbol - The common symbol to emit.
> +  /// @param Size - The size of the common symbol.
> +  /// @param ByteAlignment - The alignment of the common symbol in bytes.
> +  void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
> +                             unsigned ByteAlignment) override;
> +
> +  void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
> +                    uint64_t Size = 0, unsigned ByteAlignment = 0) override;
> +
> +  void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
> +                      unsigned ByteAlignment = 0) override;
> +
> +  void EmitBinaryData(StringRef Data) override;
> +
> +  void EmitBytes(StringRef Data) override;
> +
> +  void EmitValueImpl(const MCExpr *Value, unsigned Size,
> +                     SMLoc Loc = SMLoc()) override;
> +  void EmitIntValue(uint64_t Value, unsigned Size) override;
> +
> +  void EmitULEB128Value(const MCExpr *Value) override;
> +
> +  void EmitSLEB128Value(const MCExpr *Value) override;
> +
> +  void EmitDTPRel32Value(const MCExpr *Value) override;
> +  void EmitDTPRel64Value(const MCExpr *Value) override;
> +  void EmitTPRel32Value(const MCExpr *Value) override;
> +  void EmitTPRel64Value(const MCExpr *Value) override;
> +
> +  void EmitGPRel64Value(const MCExpr *Value) override;
> +
> +  void EmitGPRel32Value(const MCExpr *Value) override;
> +
> +
> +  void emitFill(uint64_t NumBytes, uint8_t FillValue) override;
> +
> +  void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
> +                SMLoc Loc = SMLoc()) override;
> +
> +  void emitFill(uint64_t NumValues, int64_t Size, int64_t Expr) override;
> +
> +  void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
> +                SMLoc Loc = SMLoc()) override;
> +
> +  void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
> +                            unsigned ValueSize = 1,
> +                            unsigned MaxBytesToEmit = 0) override;
> +
> +  void EmitCodeAlignment(unsigned ByteAlignment,
> +                         unsigned MaxBytesToEmit = 0) override;
> +
> +  void emitValueToOffset(const MCExpr *Offset,
> +                         unsigned char Value,
> +                         SMLoc Loc) override;
> +
> +  void EmitFileDirective(StringRef Filename) override;
> +  unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
> +                                  StringRef Filename,
> +                                  unsigned CUID = 0) override;
> +  void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
> +                             unsigned Column, unsigned Flags,
> +                             unsigned Isa, unsigned Discriminator,
> +                             StringRef FileName) override;
> +  MCSymbol *getDwarfLineTableSymbol(unsigned CUID) override;
> +
> +  bool EmitCVFileDirective(unsigned FileNo, StringRef Filename,
> +                           ArrayRef<uint8_t> Checksum,
> +                           unsigned ChecksumKind) override;
> +  bool EmitCVFuncIdDirective(unsigned FuncId) override;
> +  bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc,
> +                                   unsigned IAFile, unsigned IALine,
> +                                   unsigned IACol, SMLoc Loc) override;
> +  void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line,
> +                          unsigned Column, bool PrologueEnd, bool IsStmt,
> +                          StringRef FileName, SMLoc Loc) override;
> +  void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart,
> +                                const MCSymbol *FnEnd) override;
> +  void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
> +                                      unsigned SourceFileId,
> +                                      unsigned SourceLineNum,
> +                                      const MCSymbol *FnStartSym,
> +                                      const MCSymbol *FnEndSym) override;
> +  void EmitCVDefRangeDirective(
> +      ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
> +      StringRef FixedSizePortion) override;
> +  void EmitCVStringTableDirective() override;
> +  void EmitCVFileChecksumsDirective() override;
> +  void EmitCVFileChecksumOffsetDirective(unsigned FileNo) override;
> +  void EmitCVFPOData(const MCSymbol *ProcSym, SMLoc L) override;
> +
> +  void EmitIdent(StringRef IdentString) override;
> +  void EmitCFISections(bool EH, bool Debug) override;
> +  void EmitCFIDefCfa(int64_t Register, int64_t Offset) override;
> +  void EmitCFIDefCfaOffset(int64_t Offset) override;
> +  void EmitCFIDefCfaRegister(int64_t Register) override;
> +  void EmitCFIOffset(int64_t Register, int64_t Offset) override;
> +  void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding) override;
> +  void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding) override;
> +  void EmitCFIRememberState() override;
> +  void EmitCFIRestoreState() override;
> +  void EmitCFIRestore(int64_t Register) override;
> +  void EmitCFISameValue(int64_t Register) override;
> +  void EmitCFIRelOffset(int64_t Register, int64_t Offset) override;
> +  void EmitCFIAdjustCfaOffset(int64_t Adjustment) override;
> +  void EmitCFIEscape(StringRef Values) override;
> +  void EmitCFIGnuArgsSize(int64_t Size) override;
> +  void EmitCFISignalFrame() override;
> +  void EmitCFIUndefined(int64_t Register) override;
> +  void EmitCFIRegister(int64_t Register1, int64_t Register2) override;
> +  void EmitCFIWindowSave() override;
> +  void EmitCFIReturnColumn(int64_t Register) override;
> +
> +  void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc) override;
> +  void EmitWinCFIEndProc(SMLoc Loc) override;
> +  void EmitWinCFIStartChained(SMLoc Loc) override;
> +  void EmitWinCFIEndChained(SMLoc Loc) override;
> +  void EmitWinCFIPushReg(unsigned Register, SMLoc Loc) override;
> +  void EmitWinCFISetFrame(unsigned Register, unsigned Offset,
> +                          SMLoc Loc) override;
> +  void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc) override;
> +  void EmitWinCFISaveReg(unsigned Register, unsigned Offset,
> +                         SMLoc Loc) override;
> +  void EmitWinCFISaveXMM(unsigned Register, unsigned Offset,
> +                         SMLoc Loc) override;
> +  void EmitWinCFIPushFrame(bool Code, SMLoc Loc) override;
> +  void EmitWinCFIEndProlog(SMLoc Loc) override;
> +
> +  void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except,
> +                        SMLoc Loc) override;
> +  void EmitWinEHHandlerData(SMLoc Loc) override;
> +
> +  void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
> +                       bool PrintSchedInfo) override;
> +
> +  void EmitBundleAlignMode(unsigned AlignPow2) override;
> +  void EmitBundleLock(bool AlignToEnd) override;
> +  void EmitBundleUnlock() override;
> +
> +  bool EmitRelocDirective(const MCExpr &Offset, StringRef Name,
> +                          const MCExpr *Expr, SMLoc Loc) override;
> +
> +  /// EmitRawText - If this file is backed by an assembly streamer, this dumps
> +  /// the specified string in the output .s file.  This capability is
> +  /// indicated by the hasRawTextSupport() predicate.
> +  void EmitRawTextImpl(StringRef String) override;
> +
> +  void FinishImpl() override;
> +};
> +
> +} // end namespace llvm
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list