Emit less labels for debug info and stop emitting .loc directives for DBG_VALUEs.
The .dot directives don't need labels, that is a leftover from when we created line number info manually. Instructions following a DBG_VALUE can share its label since the DBG_VALUE doesn't produce any code. llvm-svn: 128284
This commit is contained in:
parent
757ca69770
commit
1886a4c823
|
@ -2538,47 +2538,46 @@ const MCSymbol *DwarfDebug::getLabelAfterInsn(const MachineInstr *MI) {
|
||||||
|
|
||||||
/// beginInstruction - Process beginning of an instruction.
|
/// beginInstruction - Process beginning of an instruction.
|
||||||
void DwarfDebug::beginInstruction(const MachineInstr *MI) {
|
void DwarfDebug::beginInstruction(const MachineInstr *MI) {
|
||||||
if (InsnNeedsLabel.count(MI) == 0) {
|
// Check if source location changes, but ignore DBG_VALUE locations.
|
||||||
LabelsBeforeInsn[MI] = PrevLabel;
|
if (!MI->isDebugValue()) {
|
||||||
return;
|
DebugLoc DL = MI->getDebugLoc();
|
||||||
|
if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
|
||||||
|
PrevInstLoc = DL;
|
||||||
|
if (!DL.isUnknown()) {
|
||||||
|
const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
|
||||||
|
recordSourceLine(DL.getLine(), DL.getCol(), Scope);
|
||||||
|
} else
|
||||||
|
recordSourceLine(0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check location.
|
// Insert labels where requested.
|
||||||
DebugLoc DL = MI->getDebugLoc();
|
if (!InsnNeedsLabel.count(MI))
|
||||||
if (!DL.isUnknown()) {
|
|
||||||
const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
|
|
||||||
PrevLabel = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
|
|
||||||
PrevInstLoc = DL;
|
|
||||||
LabelsBeforeInsn[MI] = PrevLabel;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// If location is unknown then use temp label for this DBG_VALUE
|
if (!PrevLabel) {
|
||||||
// instruction.
|
|
||||||
if (MI->isDebugValue()) {
|
|
||||||
PrevLabel = MMI->getContext().CreateTempSymbol();
|
PrevLabel = MMI->getContext().CreateTempSymbol();
|
||||||
Asm->OutStreamer.EmitLabel(PrevLabel);
|
Asm->OutStreamer.EmitLabel(PrevLabel);
|
||||||
LabelsBeforeInsn[MI] = PrevLabel;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
LabelsBeforeInsn[MI] = PrevLabel;
|
||||||
if (UnknownLocations) {
|
|
||||||
PrevLabel = recordSourceLine(0, 0, 0);
|
|
||||||
LabelsBeforeInsn[MI] = PrevLabel;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert (0 && "Instruction is not processed!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// endInstruction - Process end of an instruction.
|
/// endInstruction - Process end of an instruction.
|
||||||
void DwarfDebug::endInstruction(const MachineInstr *MI) {
|
void DwarfDebug::endInstruction(const MachineInstr *MI) {
|
||||||
if (InsnsNeedsLabelAfter.count(MI) != 0) {
|
// Don't create a new label after DBG_VALUE instructions.
|
||||||
// Emit a label if this instruction ends a scope.
|
// They don't generate code.
|
||||||
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
|
if (!MI->isDebugValue())
|
||||||
Asm->OutStreamer.EmitLabel(Label);
|
PrevLabel = 0;
|
||||||
LabelsAfterInsn[MI] = Label;
|
|
||||||
|
if (!InsnsNeedsLabelAfter.count(MI))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// We need a label after this instruction.
|
||||||
|
if (!PrevLabel) {
|
||||||
|
PrevLabel = MMI->getContext().CreateTempSymbol();
|
||||||
|
Asm->OutStreamer.EmitLabel(PrevLabel);
|
||||||
}
|
}
|
||||||
|
LabelsAfterInsn[MI] = PrevLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
||||||
|
@ -2838,6 +2837,7 @@ void DwarfDebug::identifyScopeMarkers() {
|
||||||
RE = Ranges.end(); RI != RE; ++RI) {
|
RE = Ranges.end(); RI != RE; ++RI) {
|
||||||
assert(RI->first && "DbgRange does not have first instruction!");
|
assert(RI->first && "DbgRange does not have first instruction!");
|
||||||
assert(RI->second && "DbgRange does not have second instruction!");
|
assert(RI->second && "DbgRange does not have second instruction!");
|
||||||
|
InsnNeedsLabel.insert(RI->first);
|
||||||
InsnsNeedsLabelAfter.insert(RI->second);
|
InsnsNeedsLabelAfter.insert(RI->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2927,7 +2927,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||||
/// LiveUserVar - Map physreg numbers to the MDNode they contain.
|
/// LiveUserVar - Map physreg numbers to the MDNode they contain.
|
||||||
std::vector<const MDNode*> LiveUserVar(TRI->getNumRegs());
|
std::vector<const MDNode*> LiveUserVar(TRI->getNumRegs());
|
||||||
|
|
||||||
DebugLoc PrevLoc;
|
|
||||||
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
|
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
|
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
|
||||||
|
@ -2957,15 +2956,6 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||||
else if (!ProcessedArgs.insert(DV))
|
else if (!ProcessedArgs.insert(DV))
|
||||||
InsnNeedsLabel.insert(MI);
|
InsnNeedsLabel.insert(MI);
|
||||||
} else {
|
} else {
|
||||||
// If location is unknown then instruction needs a location only if
|
|
||||||
// UnknownLocations flag is set.
|
|
||||||
if (DL.isUnknown()) {
|
|
||||||
if (UnknownLocations && !PrevLoc.isUnknown())
|
|
||||||
InsnNeedsLabel.insert(MI);
|
|
||||||
} else if (DL != PrevLoc)
|
|
||||||
// Otherwise, instruction needs a location only if it is new location.
|
|
||||||
InsnNeedsLabel.insert(MI);
|
|
||||||
|
|
||||||
// Check if the instruction clobbers any registers with debug vars.
|
// Check if the instruction clobbers any registers with debug vars.
|
||||||
for (MachineInstr::const_mop_iterator MOI = MI->operands_begin(),
|
for (MachineInstr::const_mop_iterator MOI = MI->operands_begin(),
|
||||||
MOE = MI->operands_end(); MOI != MOE; ++MOI) {
|
MOE = MI->operands_end(); MOI != MOE; ++MOI) {
|
||||||
|
@ -2992,11 +2982,9 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DL.isUnknown() || UnknownLocations)
|
|
||||||
PrevLoc = DL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrevInstLoc = DebugLoc();
|
||||||
PrevLabel = FunctionBeginSym;
|
PrevLabel = FunctionBeginSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3112,8 +3100,7 @@ DbgScope *DwarfDebug::findDbgScope(const MachineInstr *MInsn) {
|
||||||
/// recordSourceLine - Register a source line with debug info. Returns the
|
/// recordSourceLine - Register a source line with debug info. Returns the
|
||||||
/// unique label that was emitted and which provides correspondence to
|
/// unique label that was emitted and which provides correspondence to
|
||||||
/// the source line list.
|
/// the source line list.
|
||||||
MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col,
|
void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S){
|
||||||
const MDNode *S) {
|
|
||||||
StringRef Fn;
|
StringRef Fn;
|
||||||
StringRef Dir;
|
StringRef Dir;
|
||||||
unsigned Src = 1;
|
unsigned Src = 1;
|
||||||
|
@ -3144,10 +3131,6 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col,
|
||||||
|
|
||||||
Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, DWARF2_FLAG_IS_STMT,
|
Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, DWARF2_FLAG_IS_STMT,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
|
|
||||||
Asm->OutStreamer.EmitLabel(Label);
|
|
||||||
return Label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -536,7 +536,7 @@ private:
|
||||||
/// recordSourceLine - Register a source line with debug info. Returns the
|
/// recordSourceLine - Register a source line with debug info. Returns the
|
||||||
/// unique label that was emitted and which provides correspondence to
|
/// unique label that was emitted and which provides correspondence to
|
||||||
/// the source line list.
|
/// the source line list.
|
||||||
MCSymbol *recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope);
|
void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope);
|
||||||
|
|
||||||
/// recordVariableFrameIndex - Record a variable's index.
|
/// recordVariableFrameIndex - Record a variable's index.
|
||||||
void recordVariableFrameIndex(const DbgVariable *V, int Index);
|
void recordVariableFrameIndex(const DbgVariable *V, int Index);
|
||||||
|
|
|
@ -55,12 +55,21 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
|
||||||
!29 = metadata !{i32 524299, metadata !9, i32 17, i32 0} ; [ DW_TAG_lexical_block ]
|
!29 = metadata !{i32 524299, metadata !9, i32 17, i32 0} ; [ DW_TAG_lexical_block ]
|
||||||
!30 = metadata !{i32 19, i32 0, metadata !29, null}
|
!30 = metadata !{i32 19, i32 0, metadata !29, null}
|
||||||
|
|
||||||
|
; The variable bar:myvar changes registers after the first movq.
|
||||||
|
; It is cobbered by popq %rbx
|
||||||
|
; CHECK: movq
|
||||||
|
; CHECK-NEXT: [[LABEL:Ltmp[0-9]*]]
|
||||||
|
; CHECK: .loc 1 19 0
|
||||||
|
; CHECK: popq
|
||||||
|
; CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]]
|
||||||
|
|
||||||
|
|
||||||
; CHECK: Ldebug_loc0:
|
; CHECK: Ldebug_loc0:
|
||||||
; CHECK-NEXT: .quad Lfunc_begin0
|
; CHECK-NEXT: .quad Lfunc_begin0
|
||||||
; CHECK-NEXT: .quad Ltmp3
|
; CHECK-NEXT: .quad [[LABEL]]
|
||||||
; CHECK-NEXT: .short 1
|
; CHECK-NEXT: .short 1
|
||||||
; CHECK-NEXT: .byte 85
|
; CHECK-NEXT: .byte 85
|
||||||
; CHECK-NEXT: .quad Ltmp3
|
; CHECK-NEXT: .quad [[LABEL]]
|
||||||
; CHECK-NEXT: .quad Ltmp6
|
; CHECK-NEXT: .quad [[CLOBBER]]
|
||||||
; CHECK-NEXT: .short 1
|
; CHECK-NEXT: .short 1
|
||||||
; CHECK-NEXT: .byte 83
|
; CHECK-NEXT: .byte 83
|
||||||
|
|
|
@ -45,13 +45,13 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
|
||||||
; The variable is in %rdi which is clobbered by 'movl %ebx, %edi'
|
; The variable is in %rdi which is clobbered by 'movl %ebx, %edi'
|
||||||
; Here Ltmp7 is the end of the location range.
|
; Here Ltmp7 is the end of the location range.
|
||||||
|
|
||||||
;CHECK:Ltmp6
|
;CHECK: .loc 1 7 2
|
||||||
;CHECK-NEXT: movl
|
;CHECK: movl
|
||||||
;CHECK-NEXT: Ltmp7
|
;CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]]
|
||||||
|
|
||||||
;CHECK:Ldebug_loc0:
|
;CHECK:Ldebug_loc0:
|
||||||
;CHECK-NEXT: .quad Ltmp
|
;CHECK-NEXT: .quad
|
||||||
;CHECK-NEXT: .quad Ltmp7
|
;CHECK-NEXT: .quad [[CLOBBER]]
|
||||||
;CHECK-NEXT: .short 1
|
;CHECK-NEXT: .short 1
|
||||||
;CHECK-NEXT: .byte 85
|
;CHECK-NEXT: .byte 85
|
||||||
;CHECK-NEXT: .quad 0
|
;CHECK-NEXT: .quad 0
|
||||||
|
|
|
@ -4,16 +4,11 @@
|
||||||
; represent this in the debug information. This is done by setting line
|
; represent this in the debug information. This is done by setting line
|
||||||
; and column to 0
|
; and column to 0
|
||||||
|
|
||||||
; CHECK: leal (%rdi,%rsi), %eax
|
; CHECK: leal
|
||||||
; CHECK-NEXT: .loc 1 0 0
|
; CHECK-NEXT: .loc 1 0 0
|
||||||
; CHECK-NEXT: Ltmp
|
; CHECK: cltd
|
||||||
; CHECK-NEXT: cltd
|
; CHECK-NEXT: idivl
|
||||||
; CHECK-NEXT: idivl %r8d
|
|
||||||
; CHECK-NEXT: .loc 2 4 3
|
; CHECK-NEXT: .loc 2 4 3
|
||||||
; CHECK-NEXT: Ltmp
|
|
||||||
; CHECK-NEXT: addl %ecx, %eax
|
|
||||||
; CHECK-NEXT: ret
|
|
||||||
; CHECK-NEXT: Ltmp
|
|
||||||
|
|
||||||
define i32 @foo(i32 %w, i32 %x, i32 %y, i32 %z) nounwind {
|
define i32 @foo(i32 %w, i32 %x, i32 %y, i32 %z) nounwind {
|
||||||
entry:
|
entry:
|
||||||
|
|
Loading…
Reference in New Issue