[llvm] r184045 - DebugInfo: print DBG_VALUE MachineInstrs with [] for deref and drop the offset when it's zero
David Blaikie
dblaikie at gmail.com
Sat Jun 15 08:52:59 PDT 2013
Author: dblaikie
Date: Sat Jun 15 10:52:58 2013
New Revision: 184045
URL: http://llvm.org/viewvc/llvm-project?rev=184045&view=rev
Log:
DebugInfo: print DBG_VALUE MachineInstrs with [] for deref and drop the offset when it's zero
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/test/CodeGen/ARM/debug-info-arg.ll
llvm/trunk/test/CodeGen/ARM/debug-info-branch-folding.ll
llvm/trunk/test/CodeGen/X86/2010-05-28-Crash.ll
llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll
llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sat Jun 15 10:52:58 2013
@@ -569,6 +569,8 @@ static bool emitDebugValueComment(const
}
OS << V.getName() << " <- ";
+ int64_t Offset = MI->getOperand(1).getImm();
+ bool Deref = false;
// Register or immediate value. Register 0 means undef.
if (MI->getOperand(0).isFPImm()) {
APFloat APF = APFloat(MI->getOperand(0).getFPImm()->getValueAPF());
@@ -590,17 +592,25 @@ static bool emitDebugValueComment(const
MI->getOperand(0).getCImm()->getValue().print(OS, false /*isSigned*/);
} else {
assert(MI->getOperand(0).isReg() && "Unknown operand type");
- if (MI->getOperand(0).getReg() == 0) {
+ unsigned Reg = MI->getOperand(0).getReg();
+ if (Reg == 0) {
// Suppress offset, it is not meaningful here.
OS << "undef";
// NOTE: Want this comment at start of line, don't emit with AddComment.
AP.OutStreamer.EmitRawText(OS.str());
return true;
}
- OS << AP.TM.getRegisterInfo()->getName(MI->getOperand(0).getReg());
+ Deref = Offset != 0; // FIXME: use a better sentinel value so that deref of
+ // a reg with a zero offset is valid
+ if (Deref)
+ OS << '[';
+ OS << AP.TM.getRegisterInfo()->getName(Reg);
}
- OS << '+' << MI->getOperand(1).getImm();
+ if (Offset)
+ OS << '+' << Offset;
+ if (Deref)
+ OS << ']';
// NOTE: Want this comment at start of line, don't emit with AddComment.
AP.OutStreamer.EmitRawText(OS.str());
return true;
Modified: llvm/trunk/test/CodeGen/ARM/debug-info-arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-arg.ll?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/debug-info-arg.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/debug-info-arg.ll Sat Jun 15 10:52:58 2013
@@ -11,7 +11,7 @@ define void @foo(%struct.tag_s* nocaptur
tail call void @llvm.dbg.value(metadata !{%struct.tag_s* %c}, i64 0, metadata !13), !dbg !21
tail call void @llvm.dbg.value(metadata !{i64 %x}, i64 0, metadata !14), !dbg !22
tail call void @llvm.dbg.value(metadata !{i64 %y}, i64 0, metadata !17), !dbg !23
-;CHECK: @DEBUG_VALUE: foo:y <- R7+4294967295
+;CHECK: @DEBUG_VALUE: foo:y <- [R7+4294967295]
tail call void @llvm.dbg.value(metadata !{%struct.tag_s* %ptr1}, i64 0, metadata !18), !dbg !24
tail call void @llvm.dbg.value(metadata !{%struct.tag_s* %ptr2}, i64 0, metadata !19), !dbg !25
%1 = icmp eq %struct.tag_s* %c, null, !dbg !26
Modified: llvm/trunk/test/CodeGen/ARM/debug-info-branch-folding.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-branch-folding.ll?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/debug-info-branch-folding.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/debug-info-branch-folding.ll Sat Jun 15 10:52:58 2013
@@ -5,8 +5,8 @@ target triple = "thumbv7-apple-macosx10.
;CHECK: vadd.f32 q4, q8, q8
;CHECK-NEXT: LBB0_1
-;CHECK:@DEBUG_VALUE: x <- Q4+0
-;CHECK-NEXT:@DEBUG_VALUE: y <- Q4+0
+;CHECK:@DEBUG_VALUE: x <- Q4
+;CHECK-NEXT:@DEBUG_VALUE: y <- Q4
@.str = external constant [13 x i8]
Modified: llvm/trunk/test/CodeGen/X86/2010-05-28-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-05-28-Crash.ll?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-05-28-Crash.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-05-28-Crash.ll Sat Jun 15 10:52:58 2013
@@ -46,4 +46,4 @@ entry:
;CHECK: DEBUG_VALUE: bar:x <- E
;CHECK: Ltmp
-;CHECK: DEBUG_VALUE: foo:y <- 1+0
+;CHECK: DEBUG_VALUE: foo:y <- 1
Modified: llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll Sat Jun 15 10:52:58 2013
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-darwin10.2
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
define i32 @_ZN3foo3bazEi(%struct.foo* nocapture %this, i32 %x) nounwind readnone optsize noinline ssp align 2 {
-;CHECK: DEBUG_VALUE: baz:this <- RDI+0
+;CHECK: DEBUG_VALUE: baz:this <- RDI
entry:
tail call void @llvm.dbg.value(metadata !{%struct.foo* %this}, i64 0, metadata !15)
tail call void @llvm.dbg.value(metadata !{i32 %x}, i64 0, metadata !16)
Modified: llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll?rev=184045&r1=184044&r2=184045&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll Sat Jun 15 10:52:58 2013
@@ -16,7 +16,7 @@ entry:
call void @llvm.dbg.value(metadata !12, i64 0, metadata !13), !dbg !14
%tmp2 = load i32 addrspace(1)* %ip, align 4, !dbg !15
%tmp3 = add i32 0, %tmp2, !dbg !15
-; CHECK: ##DEBUG_VALUE: idx <- EAX+0
+; CHECK: ##DEBUG_VALUE: idx <- EAX
call void @llvm.dbg.value(metadata !{i32 %tmp3}, i64 0, metadata !13), !dbg
!15
%arrayidx = getelementptr i32 addrspace(1)* %ip, i32 %1, !dbg !16
More information about the llvm-commits
mailing list