[llvm] r207372 - Clarify the doxygen comment for AsmPrinter::EmitDwarfRegOpPiece and add

Adrian Prantl aprantl at apple.com
Sun Apr 27 11:50:45 PDT 2014


Author: adrian
Date: Sun Apr 27 13:50:45 2014
New Revision: 207372

URL: http://llvm.org/viewvc/llvm-project?rev=207372&view=rev
Log:
Clarify the doxygen comment for AsmPrinter::EmitDwarfRegOpPiece and add
default arguments to the function.

No functional change.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=207372&r1=207371&r2=207372&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sun Apr 27 13:50:45 2014
@@ -430,14 +430,21 @@ namespace llvm {
     /// encoding specified.
     virtual unsigned getISAEncoding() { return 0; }
 
-    /// \brief Emit a partial dwarf register operation.
+    /// \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.
+    ///
+    /// If size and offset is zero an operation for the entire
+    /// register is emitted: Some targets do not provide a DWARF
+    /// register number for every register.  If this is the case, this
+    /// function will attempt to emit a DWARF register by emitting a
+    /// piece of a super-register or by piecing together multiple
+    /// subregisters that alias the register.
     void EmitDwarfRegOpPiece(ByteStreamer &BS, const MachineLocation &MLoc,
-                             unsigned PieceSize,
-                             unsigned PieceOffset) const;
+                             unsigned PieceSize = 0,
+                             unsigned PieceOffset = 0) const;
 
     /// EmitDwarfRegOp - Emit dwarf register operation.
     /// \param Indirect   whether this is a register-indirect address

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=207372&r1=207371&r2=207372&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Sun Apr 27 13:50:45 2014
@@ -240,15 +240,15 @@ static void emitDwarfOpShr(ByteStreamer
   Streamer.EmitInt8(dwarf::DW_OP_shr, "DW_OP_shr");
 }
 
-/// Some targets do not provide a DWARF register number for every
-/// register.  This function attempts to emit a DWARF register by
-/// emitting a piece of a super-register or by piecing together
-/// multiple subregisters that alias the register.
+// Some targets do not provide a DWARF register number for every
+// register.  This function attempts to emit a DWARF register by
+// emitting a piece of a super-register or by piecing together
+// multiple subregisters that alias the register.
 void AsmPrinter::EmitDwarfRegOpPiece(ByteStreamer &Streamer,
                                      const MachineLocation &MLoc,
                                      unsigned PieceSizeInBits,
                                      unsigned PieceOffsetInBits) const {
-  assert(!MLoc.isIndirect());
+  assert(MLoc.isReg() && "MLoc must be a register");
   const TargetRegisterInfo *TRI = TM.getRegisterInfo();
   int Reg = TRI->getDwarfRegNum(MLoc.getReg(), false);
 
@@ -346,7 +346,7 @@ void AsmPrinter::EmitDwarfRegOp(ByteStre
     }
 
     // Attempt to find a valid super- or sub-register.
-    return EmitDwarfRegOpPiece(Streamer, MLoc, 0, 0);
+    return EmitDwarfRegOpPiece(Streamer, MLoc);
   }
 
   if (MLoc.isIndirect())





More information about the llvm-commits mailing list