Debug info: Refactor EmitDwarfRegOpPiece to be a member function of
[oota-llvm.git] / include / llvm / CodeGen / AsmPrinter.h
index f83d96783c7ada5cb5323674dd5509d6a873d26d..f40f3337c7bdf0a5f3efebce7127676cc417b732 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef LLVM_CODEGEN_ASMPRINTER_H
 #define LLVM_CODEGEN_ASMPRINTER_H
 
+#include "llvm/ADT/Twine.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/IR/InlineAsm.h"
 #include "llvm/Support/DataTypes.h"
@@ -24,6 +25,7 @@
 namespace llvm {
   class AsmPrinterHandler;
   class BlockAddress;
+  class ByteStreamer;
   class GCStrategy;
   class Constant;
   class ConstantArray;
@@ -134,7 +136,7 @@ namespace llvm {
   public:
     virtual ~AsmPrinter();
 
-    const DwarfDebug *getDwarfDebug() const { return DD; }
+    DwarfDebug *getDwarfDebug() { return DD; }
 
     /// isVerbose - Return true if assembly output should contain comments.
     ///
@@ -161,6 +163,9 @@ namespace llvm {
     /// getCurrentSection() - Return the current section we are emitting to.
     const MCSection *getCurrentSection() const;
 
+    void getNameWithPrefix(SmallVectorImpl<char> &Name,
+                           const GlobalValue *GV) const;
+
     MCSymbol *getSymbol(const GlobalValue *GV) const;
 
     //===------------------------------------------------------------------===//
@@ -169,20 +174,20 @@ namespace llvm {
 
     /// getAnalysisUsage - Record analysis usage.
     ///
-    void getAnalysisUsage(AnalysisUsage &AU) const;
+    void getAnalysisUsage(AnalysisUsage &AU) const override;
 
     /// doInitialization - Set up the AsmPrinter when we are working on a new
     /// module.  If your pass overrides this, it must make sure to explicitly
     /// call this implementation.
-    bool doInitialization(Module &M);
+    bool doInitialization(Module &M) override;
 
     /// doFinalization - Shut down the asmprinter.  If you override this in your
     /// pass, you must make sure to call it explicitly.
-    bool doFinalization(Module &M);
+    bool doFinalization(Module &M) override;
 
     /// runOnMachineFunction - Emit the specified function out to the
     /// OutStreamer.
-    virtual bool runOnMachineFunction(MachineFunction &MF) {
+    bool runOnMachineFunction(MachineFunction &MF) override {
       SetupMachineFunction(MF);
       EmitFunctionHeader();
       EmitFunctionBody();
@@ -205,7 +210,7 @@ namespace llvm {
     /// function.
     void EmitFunctionBody();
 
-    void emitPrologLabel(const MachineInstr &MI);
+    void emitCFIInstruction(const MachineInstr &MI);
 
     enum CFIMoveType {
       CFI_M_None,
@@ -242,12 +247,12 @@ namespace llvm {
     /// an explicit alignment requested, it will override the alignment request
     /// if required for correctness.
     ///
-    void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const;
+    void EmitAlignment(unsigned NumBits, const GlobalValue *GV = nullptr) const;
 
     /// EmitBasicBlockStart - This method prints the label for the specified
     /// MachineBasicBlock, an alignment (if present) and a comment describing
     /// it if appropriate.
-    void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
+    void EmitBasicBlockStart(const MachineBasicBlock &MBB) const;
 
     /// \brief Print a general LLVM constant to the .s file.
     void EmitGlobalConstant(const Constant *CV);
@@ -281,6 +286,9 @@ namespace llvm {
       llvm_unreachable("EmitInstruction not implemented");
     }
 
+    /// GetCPISymbol - Return the symbol for the specified constant pool entry.
+    virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
+
     virtual void EmitFunctionEntryLabel();
 
     virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
@@ -309,11 +317,11 @@ namespace llvm {
 
     /// GetTempSymbol - Return the MCSymbol corresponding to the assembler
     /// temporary label with the specified stem and unique ID.
-    MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const;
+    MCSymbol *GetTempSymbol(Twine Name, unsigned ID) const;
 
     /// GetTempSymbol - Return an assembler temporary label with the specified
     /// stem.
-    MCSymbol *GetTempSymbol(StringRef Name) const;
+    MCSymbol *GetTempSymbol(Twine Name) const;
 
     /// Return the MCSymbol for a private symbol with global value name as its
     /// base, with the specified suffix.
@@ -324,9 +332,6 @@ namespace llvm {
     /// ExternalSymbol.
     MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const;
 
-    /// GetCPISymbol - Return the symbol for the specified constant pool entry.
-    MCSymbol *GetCPISymbol(unsigned CPID) const;
-
     /// GetJTISymbol - Return the symbol for the specified jump table entry.
     MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
 
@@ -390,10 +395,10 @@ namespace llvm {
     //===------------------------------------------------------------------===//
 
     /// EmitSLEB128 - emit the specified signed leb128 value.
-    void EmitSLEB128(int64_t Value, const char *Desc = 0) const;
+    void EmitSLEB128(int64_t Value, const char *Desc = nullptr) const;
 
     /// EmitULEB128 - emit the specified unsigned leb128 value.
-    void EmitULEB128(uint64_t Value, const char *Desc = 0,
+    void EmitULEB128(uint64_t Value, const char *Desc = nullptr,
                      unsigned PadTo = 0) const;
 
     /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
@@ -403,7 +408,7 @@ namespace llvm {
     /// encoding.  If verbose assembly output is enabled, we output comments
     /// describing the encoding.  Desc is a string saying what the encoding is
     /// specifying (e.g. "LSDA").
-    void EmitEncodingByte(unsigned Val, const char *Desc = 0) const;
+    void EmitEncodingByte(unsigned Val, const char *Desc = nullptr) const;
 
     /// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
     unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
@@ -425,8 +430,18 @@ namespace llvm {
     /// encoding specified.
     virtual unsigned getISAEncoding() { return 0; }
 
+    /// \brief Emit a partial dwarf register operation.
+    /// \param MLoc             the register
+    /// \param PieceSizeInBits  size and
+    /// \param PieceOffsetBits  offset of the piece in bits, if this is one
+    ///                         piece of an aggregate value.
+    void EmitDwarfRegOpPiece(ByteStreamer &BS, const MachineLocation &MLoc,
+                             unsigned PieceSize,
+                             unsigned PieceOffset) const;
+
     /// EmitDwarfRegOp - Emit dwarf register operation.
-    virtual void EmitDwarfRegOp(const MachineLocation &MLoc,
+    /// \param Indirect   whether this is a register-indirect address
+    virtual void EmitDwarfRegOp(ByteStreamer &BS, const MachineLocation &MLoc,
                                 bool Indirect) const;
 
     //===------------------------------------------------------------------===//
@@ -475,7 +490,7 @@ namespace llvm {
     /// \p EndInfo   - the final subtarget info after parsing the inline asm,
     ///                or NULL if the value is unknown.
     virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
-                                  MCSubtargetInfo *EndInfo) const;
+                                  const MCSubtargetInfo *EndInfo) const;
 
   private:
     /// Private state for PrintSpecial()
@@ -486,7 +501,7 @@ namespace llvm {
     mutable unsigned SetCounter;
 
     /// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
-    void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = 0,
+    void EmitInlineAsm(StringRef Str, const MDNode *LocMDNode = nullptr,
                        InlineAsm::AsmDialect AsmDialect =
                            InlineAsm::AD_ATT) const;
 
@@ -511,7 +526,7 @@ namespace llvm {
     /// Emit llvm.ident metadata in an '.ident' directive.
     void EmitModuleIdents(Module &M);
     void EmitXXStructorList(const Constant *List, bool isCtor);
-    GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
+    GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy &C);
   };
 }