[llvm] r201253 - Debug info: Bugfix for r201190: DW_OP_piece takes bytes, not bits.

Adrian Prantl aprantl at apple.com
Wed Feb 12 11:34:44 PST 2014


Author: adrian
Date: Wed Feb 12 13:34:44 2014
New Revision: 201253

URL: http://llvm.org/viewvc/llvm-project?rev=201253&view=rev
Log:
Debug info: Bugfix for r201190: DW_OP_piece takes bytes, not bits.
rdar://problem/16015314

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/test/DebugInfo/X86/subreg.ll
    llvm/trunk/test/DebugInfo/X86/subregisters.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=201253&r1=201252&r2=201253&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Feb 12 13:34:44 2014
@@ -931,8 +931,9 @@ void AsmPrinter::EmitDwarfRegOp(const Ma
     } else {
       OutStreamer.AddComment("DW_OP_piece");
       EmitInt8(dwarf::DW_OP_piece);
-      OutStreamer.AddComment(Twine(Size));
-      EmitULEB128(Size);
+      unsigned ByteSize = Size / 8; // Assuming 8 bits per byte.
+      OutStreamer.AddComment(Twine(ByteSize));
+      EmitULEB128(ByteSize);
     }
   }
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=201253&r1=201252&r2=201253&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Wed Feb 12 13:34:44 2014
@@ -470,8 +470,9 @@ void DwarfUnit::addRegisterOp(DIEBlock *
       addUInt(TheDie, dwarf::DW_FORM_data1, Size);
       addUInt(TheDie, dwarf::DW_FORM_data1, Offset);
     } else {
+      unsigned ByteSize = Size / 8; // Assuming 8 bits per byte.
       addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_piece);
-      addUInt(TheDie, dwarf::DW_FORM_data1, Size);
+      addUInt(TheDie, dwarf::DW_FORM_data1, ByteSize);
     }
   }
 }

Modified: llvm/trunk/test/DebugInfo/X86/subreg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/subreg.ll?rev=201253&r1=201252&r2=201253&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/subreg.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/subreg.ll Wed Feb 12 13:34:44 2014
@@ -5,7 +5,7 @@
 
 ; CHECK: .byte   80                      # DW_OP_reg0
 ; CHECK: .byte   147                     # DW_OP_piece
-; CHECK: .byte   16                      # 16
+; CHECK: .byte   2                       # 2
 
 define i16 @f(i16 signext %zzz) nounwind {
 entry:

Modified: llvm/trunk/test/DebugInfo/X86/subregisters.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/subregisters.ll?rev=201253&r1=201252&r2=201253&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/subregisters.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/subregisters.ll Wed Feb 12 13:34:44 2014
@@ -7,7 +7,7 @@
 ; rdar://problem/16015314
 ;
 ; CHECK:  DW_AT_name [DW_FORM_strp]{{.*}} "a"
-; CHECK:    DW_AT_location [DW_FORM_block1]       (<0x03> 54 93 20 )
+; CHECK:    DW_AT_location [DW_FORM_block1]       (<0x03> 54 93 04 )
 ;
 ; struct bar {
 ;   int a;





More information about the llvm-commits mailing list