]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blobdiff - lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Debug Info: Move support for constants into DwarfExpression.
[opencl/llvm.git] / lib / CodeGen / AsmPrinter / AsmPrinterDwarf.cpp
index ce4aae3d319db74c1e8fa86712a63e27fb5b6467..5d6a03080c4f92683052c90bcd544ebb731fb85e 100644 (file)
@@ -32,30 +32,23 @@ using namespace llvm;
 
 #define DEBUG_TYPE "asm-printer"
 
-/// DwarfExpression implementation for .debug_loc entries.
-class DebugLocDwarfExpression : public DwarfExpression {
-  ByteStreamer &BS;
-public:
-  DebugLocDwarfExpression(TargetMachine &TM, ByteStreamer &BS)
-    : DwarfExpression(TM), BS(BS) {}
-
-  void EmitOp(uint8_t Op, const char* Comment) override;
-  void EmitSigned(int Value) override;
-  void EmitUnsigned(unsigned Value) override;
-};
-
-void DebugLocDwarfExpression::EmitOp(uint8_t Op, const char* Comment) {
-  BS.EmitInt8(Op, Comment
-    ? Twine(Comment)+Twine(" ")+Twine(dwarf::OperationEncodingString(Op))
-    : dwarf::OperationEncodingString(Op));
+void DebugLocDwarfExpression::EmitOp(uint8_t Op, const char *Comment) {
+  BS.EmitInt8(
+      Op, Comment ? Twine(Comment) + " " + dwarf::OperationEncodingString(Op)
+                  : dwarf::OperationEncodingString(Op));
 }
+
 void DebugLocDwarfExpression::EmitSigned(int Value) {
   BS.EmitSLEB128(Value, Twine(Value));
 }
+
 void DebugLocDwarfExpression::EmitUnsigned(unsigned Value) {
   BS.EmitULEB128(Value, Twine(Value));
 }
 
+unsigned DebugLocDwarfExpression::getFrameRegister() {
+ llvm_unreachable("not available");
+}
 
 //===----------------------------------------------------------------------===//
 // Dwarf Emission Helper Routines
@@ -221,14 +214,14 @@ void AsmPrinter::EmitDwarfRegOpPiece(ByteStreamer &Streamer,
                                      unsigned PieceSizeInBits,
                                      unsigned PieceOffsetInBits) const {
   assert(MLoc.isReg() && "MLoc must be a register");
-  DebugLocDwarfExpression Expr(TM, Streamer);
+  DebugLocDwarfExpression Expr(*this, Streamer);
   Expr.AddMachineRegPiece(MLoc.getReg(), PieceSizeInBits, PieceOffsetInBits);
 }
 
 void AsmPrinter::EmitDwarfOpPiece(ByteStreamer &Streamer,
                                   unsigned PieceSizeInBits,
                                   unsigned PieceOffsetInBits) const {
-  DebugLocDwarfExpression Expr(TM, Streamer);
+  DebugLocDwarfExpression Expr(*this, Streamer);
   Expr.AddOpPiece(PieceSizeInBits, PieceOffsetInBits);
 }
 
@@ -236,7 +229,7 @@ void AsmPrinter::EmitDwarfOpPiece(ByteStreamer &Streamer,
 void AsmPrinter::EmitDwarfRegOp(ByteStreamer &Streamer,
                                 const MachineLocation &MLoc,
                                 bool Indirect) const {
-  DebugLocDwarfExpression Expr(TM, Streamer);
+  DebugLocDwarfExpression Expr(*this, Streamer);
   const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();
   int Reg = TRI->getDwarfRegNum(MLoc.getReg(), false);
   if (Reg < 0) {
@@ -246,8 +239,8 @@ void AsmPrinter::EmitDwarfRegOp(ByteStreamer &Streamer,
       // caller might be in the middle of a dwarf expression. We should
       // probably assert that Reg >= 0 once debug info generation is more
       // mature.
-    return Expr.EmitOp(dwarf::DW_OP_nop,
-                       "nop (could not find a dwarf register number)");
+      return Expr.EmitOp(dwarf::DW_OP_nop,
+                         "nop (could not find a dwarf register number)");
 
     // Attempt to find a valid super- or sub-register.
     return Expr.AddMachineRegPiece(MLoc.getReg());