aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-05-21 18:49:09 +0000
committerDevang Patel <dpatel@apple.com>2010-05-21 18:49:09 +0000
commit379fe83dda937658b6b08d3c531f0db6c25b7dd7 (patch)
tree7823356a395ce10ed3889a28dff6a5a2233fcae8 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parentacbf6348b1a3503531f7fb0c9f180d149e9927be (diff)
Simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp67
1 files changed, 23 insertions, 44 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 2eb6f3acd0..1788e0de88 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2183,59 +2183,34 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
void DwarfDebug::beginScope(const MachineInstr *MI) {
// Check location.
DebugLoc DL = MI->getDebugLoc();
- if (DL.isUnknown()) {
- if (UnknownLocations) {
- // This instruction has no debug location. If the preceding instruction
- // did, emit debug location information to indicate that the debug
- // location is now unknown.
- MCSymbol *Label = NULL;
- if (DL == PrevInstLoc)
- Label = PrevLabel;
- else {
- Label = recordSourceLine(DL.getLine(), DL.getCol(), 0);
- PrevInstLoc = DL;
- PrevLabel = Label;
- }
-
- // If this instruction begins a scope then note down corresponding label
- // even if previous label is reused.
- if (InsnsBeginScopeSet.count(MI) != 0)
- LabelsBeforeInsn[MI] = Label;
- }
-
+ if (DL.isUnknown() && !UnknownLocations)
return;
- }
-
- const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
-
- // FIXME: Should only verify each scope once!
- if (!DIScope(Scope).Verify())
- return;
-
- // DBG_VALUE instruction establishes new value.
+
+ DbgVariable *LocalVar = NULL;
if (MI->isDebugValue()) {
DenseMap<const MachineInstr *, DbgVariable *>::iterator DI
= DbgValueStartMap.find(MI);
- if (DI != DbgValueStartMap.end()) {
- MCSymbol *Label = NULL;
- if (DL == PrevInstLoc)
- Label = PrevLabel;
- else {
- Label = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
- PrevInstLoc = DL;
- PrevLabel = Label;
- }
- DbgVariableLabelsMap[DI->second] = Label;
- }
- return;
+ if (DI != DbgValueStartMap.end())
+ LocalVar = DI->second;
}
- // Emit a label to indicate location change. This is used for line
- // table even if this instruction does not start a new scope.
MCSymbol *Label = NULL;
if (DL == PrevInstLoc)
Label = PrevLabel;
- else {
+ // Do not emit line number entry for arguments.
+ else if (!MI->isDebugValue() || LocalVar) {
+ const MDNode *Scope = 0;
+ if (DL.isUnknown() == false) {
+ Scope = DL.getScope(Asm->MF->getFunction()->getContext());
+ // FIXME: Should only verify each scope once!
+ if (!DIScope(Scope).Verify())
+ return;
+ }
+ // else ...
+ // This instruction has no debug location. If the preceding instruction
+ // did, emit debug location information to indicate that the debug
+ // location is now unknown.
+
Label = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
PrevInstLoc = DL;
PrevLabel = Label;
@@ -2245,6 +2220,10 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
// even if previous label is reused.
if (InsnsBeginScopeSet.count(MI) != 0)
LabelsBeforeInsn[MI] = Label;
+
+ // If this is a DBG_VALUE instruction then record label to identify variable.
+ if (LocalVar)
+ DbgVariableLabelsMap[LocalVar] = Label;
}
/// endScope - Process end of a scope.