summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
diff options
context:
space:
mode:
authorDavid Stenberg <david.stenberg@ericsson.com>2019-04-10 09:07:43 +0000
committerDavid Stenberg <david.stenberg@ericsson.com>2019-04-10 09:07:43 +0000
commit6feef56d1bdb471d0415afedebfbe49c91ca1dce (patch)
treeda12c8ccca6014c4463a7d8e6699cfedc0e39766 /llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
parent3739979c2031ebcf0ed40d30d549cf82bb1a122c (diff)
downloadbcm5719-llvm-6feef56d1bdb471d0415afedebfbe49c91ca1dce.tar.gz
bcm5719-llvm-6feef56d1bdb471d0415afedebfbe49c91ca1dce.zip
[DebugInfo] Rename DbgValueHistoryMap::{InstrRange -> Entry}, NFC
Summary: In an upcoming commit the history map will be changed so that it contains explicit entries for instructions that clobber preceding debug values, rather than Begin- End range pairs, so generalize the name to "Entry". Also, prefix the iterator variable names in buildLocationList() with "E". In an upcoming commit the entry will have query functions such as "isD(e)b(u)gValue", which could at a glance make one confuse it for iterations over MachineInstrs, so make the iterator names a bit more distinct to avoid that. Reviewers: aprantl Reviewed By: aprantl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59939 llvm-svn: 358060
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
index bf510b9e21d..618fee9544d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -41,30 +41,28 @@ static unsigned isDescribedByReg(const MachineInstr &MI) {
return MI.getOperand(0).isReg() ? MI.getOperand(0).getReg() : 0;
}
-void DbgValueHistoryMap::startInstrRange(InlinedEntity Var,
- const MachineInstr &MI) {
+void DbgValueHistoryMap::startEntry(InlinedEntity Var, const MachineInstr &MI) {
// Instruction range should start with a DBG_VALUE instruction for the
// variable.
assert(MI.isDebugValue() && "not a DBG_VALUE");
- auto &Ranges = VarInstrRanges[Var];
- if (!Ranges.empty() && !Ranges.back().isClosed() &&
- Ranges.back().getBegin()->isIdenticalTo(MI)) {
+ auto &Entries = VarEntries[Var];
+ if (!Entries.empty() && !Entries.back().isClosed() &&
+ Entries.back().getBegin()->isIdenticalTo(MI)) {
LLVM_DEBUG(dbgs() << "Coalescing identical DBG_VALUE entries:\n"
- << "\t" << Ranges.back().getBegin() << "\t" << MI
+ << "\t" << Entries.back().getBegin() << "\t" << MI
<< "\n");
return;
}
- Ranges.emplace_back(&MI);
+ Entries.emplace_back(&MI);
}
-void DbgValueHistoryMap::endInstrRange(InlinedEntity Var,
- const MachineInstr &MI) {
- auto &Ranges = VarInstrRanges[Var];
- assert(!Ranges.empty() && "No range exists for variable!");
- Ranges.back().endRange(MI);
+void DbgValueHistoryMap::endEntry(InlinedEntity Var, const MachineInstr &MI) {
+ auto &Entries = VarEntries[Var];
+ assert(!Entries.empty() && "No range exists for variable!");
+ Entries.back().endEntry(MI);
}
-void DbgValueHistoryMap::InstrRange::endRange(const MachineInstr &MI) {
+void DbgValueHistoryMap::Entry::endEntry(const MachineInstr &MI) {
// For now, instruction ranges are not allowed to cross basic block
// boundaries.
assert(Begin->getParent() == MI.getParent());
@@ -73,13 +71,13 @@ void DbgValueHistoryMap::InstrRange::endRange(const MachineInstr &MI) {
}
unsigned DbgValueHistoryMap::getRegisterForVar(InlinedEntity Var) const {
- const auto &I = VarInstrRanges.find(Var);
- if (I == VarInstrRanges.end())
+ const auto &I = VarEntries.find(Var);
+ if (I == VarEntries.end())
return 0;
- const auto &Ranges = I->second;
- if (Ranges.empty() || Ranges.back().isClosed())
+ const auto &Entries = I->second;
+ if (Entries.empty() || Entries.back().isClosed())
return 0;
- return isDescribedByReg(*Ranges.back().getBegin());
+ return isDescribedByReg(*Entries.back().getBegin());
}
void DbgLabelInstrMap::addInstr(InlinedEntity Label, const MachineInstr &MI) {
@@ -127,7 +125,7 @@ static void clobberRegisterUses(RegDescribedVarsMap &RegVars,
// Iterate over all variables described by this register and add this
// instruction to their history, clobbering it.
for (const auto &Var : I->second)
- HistMap.endInstrRange(Var, ClobberingInstr);
+ HistMap.endEntry(Var, ClobberingInstr);
RegVars.erase(I);
}
@@ -257,7 +255,7 @@ void llvm::calculateDbgEntityHistory(const MachineFunction *MF,
if (unsigned PrevReg = DbgValues.getRegisterForVar(Var))
dropRegDescribedVar(RegVars, PrevReg, Var);
- DbgValues.startInstrRange(Var, MI);
+ DbgValues.startEntry(Var, MI);
if (unsigned NewReg = isDescribedByReg(MI))
addRegDescribedVar(RegVars, NewReg, Var);
@@ -293,7 +291,7 @@ LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const {
dbgs() << "DbgValueHistoryMap:\n";
for (const auto &VarRangePair : *this) {
const InlinedEntity &Var = VarRangePair.first;
- const InstrRanges &Ranges = VarRangePair.second;
+ const Entries &Entries = VarRangePair.second;
const DILocalVariable *LocalVar = cast<DILocalVariable>(Var.first);
const DILocation *Location = Var.second;
@@ -308,10 +306,10 @@ LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const {
dbgs() << " --\n";
- for (const InstrRange &Range : Ranges) {
- dbgs() << " Begin: " << *Range.getBegin();
- if (Range.getEnd())
- dbgs() << " End : " << *Range.getEnd();
+ for (const auto &Entry : Entries) {
+ dbgs() << " Begin: " << *Entry.getBegin();
+ if (Entry.getEnd())
+ dbgs() << " End : " << *Entry.getEnd();
dbgs() << "\n";
}
}
OpenPOWER on IntegriCloud