aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineDebugInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-10-24 11:50:43 +0000
committerJim Laskey <jlaskey@mac.com>2006-10-24 11:50:43 +0000
commitfcc1d9473ee6dbc79128561449ff8d603a846f92 (patch)
treeea712217faf538761ef8f48cbf7548188d2c5bfe /lib/CodeGen/MachineDebugInfo.cpp
parentae5d51c9c915f93fbf9b3e644a165c96d6b0ddbd (diff)
Tighter data structure for deleted debug labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r--lib/CodeGen/MachineDebugInfo.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp
index 380b8a9656..b895cd7727 100644
--- a/lib/CodeGen/MachineDebugInfo.cpp
+++ b/lib/CodeGen/MachineDebugInfo.cpp
@@ -1544,16 +1544,33 @@ unsigned MachineDebugInfo::RecordLabel(unsigned Line, unsigned Column,
return ID;
}
+static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) {
+ return LI.getLabelID() < UID;
+}
+
/// InvalidateLabel - Inhibit use of the specified label # from
/// MachineDebugInfo, for example because the code was deleted.
void MachineDebugInfo::InvalidateLabel(unsigned LabelID) {
- DeletedLabelIDs.insert(LabelID);
+ // Check source line list first. SourceLineInfo is sorted by LabelID.
+ std::vector<SourceLineInfo>::iterator I =
+ std::lower_bound(Lines.begin(), Lines.end(), LabelID, LabelUIDComparison);
+ if (I != Lines.end() && I->getLabelID() == LabelID) {
+ Lines.erase(I);
+ return;
+ }
+
+ // Otherwise add for use by isLabelValid.
+ std::vector<unsigned>::iterator J =
+ std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID);
+ DeletedLabelIDs.insert(J, LabelID);
}
/// isLabelValid - Check to make sure the label is still valid before
/// attempting to use.
bool MachineDebugInfo::isLabelValid(unsigned LabelID) {
- return DeletedLabelIDs.find(LabelID) == DeletedLabelIDs.end();
+ std::vector<unsigned>::iterator I =
+ std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID);
+ return I != DeletedLabelIDs.end() && *I == LabelID;
}
/// RecordSource - Register a source file with debug info. Returns an source