summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit516cd40b5c6dd3f3c63c03b245b27a1a4fe8a094 (patch)
tree68d841ac090f1b61e52d3dcb32488f771fd1f092 /llvm/lib/CodeGen
parentebb1ad4382c1e8cf83e2f716436256dd8e12553f (diff)
downloadbcm5719-llvm-516cd40b5c6dd3f3c63c03b245b27a1a4fe8a094.tar.gz
bcm5719-llvm-516cd40b5c6dd3f3c63c03b245b27a1a4fe8a094.zip
Tighter data structure for deleted debug labels.
llvm-svn: 31152
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/DwarfWriter.cpp3
-rw-r--r--llvm/lib/CodeGen/MachineDebugInfo.cpp21
2 files changed, 20 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp
index c600edbdf83..7e3e4831d1e 100644
--- a/llvm/lib/CodeGen/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/DwarfWriter.cpp
@@ -2207,8 +2207,7 @@ void DwarfWriter::EmitDebugLines() const {
const SourceLineInfo &LineInfo = LineInfos[i];
unsigned LabelID = LineInfo.getLabelID();
- // Throw out line info if label is invalid.
- if (!DebugInfo->isLabelValid(LabelID)) continue;
+ // Source line labels are validated at the MachineDebugInfo level.
if (DwarfVerbose) {
unsigned SourceID = LineInfo.getSourceID();
diff --git a/llvm/lib/CodeGen/MachineDebugInfo.cpp b/llvm/lib/CodeGen/MachineDebugInfo.cpp
index 380b8a9656d..b895cd7727a 100644
--- a/llvm/lib/CodeGen/MachineDebugInfo.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud