[llvm] r259457 - MachineVerifier: Use report_context() instead of ad-hoc messages.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 18:44:26 PST 2016
Author: matze
Date: Mon Feb 1 20:44:25 2016
New Revision: 259457
URL: http://llvm.org/viewvc/llvm-project?rev=259457&view=rev
Log:
MachineVerifier: Use report_context() instead of ad-hoc messages.
Modified:
llvm/trunk/lib/CodeGen/MachineVerifier.cpp
Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=259457&r1=259456&r2=259457&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Mon Feb 1 20:44:25 2016
@@ -217,6 +217,9 @@ namespace {
LaneBitmask LaneMask) const;
void report_context(const LiveRange::Segment &S) const;
void report_context(const VNInfo &VNI) const;
+ void report_context(SlotIndex Pos) const;
+ void report_context_liverange(const LiveRange &LR) const;
+ void report_context_regunit(unsigned RegUnit) const;
void verifyInlineAsm(const MachineInstr *MI);
@@ -435,16 +438,20 @@ void MachineVerifier::report(const char
errs() << "\n";
}
+void MachineVerifier::report_context(SlotIndex Pos) const {
+ errs() << "- at: " << Pos << '\n';
+}
+
void MachineVerifier::report_context(const LiveInterval &LI) const {
errs() << "- interval: " << LI << '\n';
}
void MachineVerifier::report_context(const LiveRange &LR, unsigned Reg,
LaneBitmask LaneMask) const {
+ report_context_liverange(LR);
errs() << "- register: " << PrintReg(Reg, TRI) << '\n';
if (LaneMask != 0)
errs() << "- lanemask: " << PrintLaneMask(LaneMask) << '\n';
- errs() << "- liverange: " << LR << '\n';
}
void MachineVerifier::report_context(const LiveRange::Segment &S) const {
@@ -455,6 +462,14 @@ void MachineVerifier::report_context(con
errs() << "- ValNo: " << VNI.id << " (def " << VNI.def << ")\n";
}
+void MachineVerifier::report_context_liverange(const LiveRange &LR) const {
+ errs() << "- liverange: " << LR << '\n';
+}
+
+void MachineVerifier::report_context_regunit(unsigned RegUnit) const {
+ errs() << "- regunit: " << PrintRegUnit(RegUnit, TRI) << '\n';
+}
+
void MachineVerifier::markReachable(const MachineBasicBlock *MBB) {
BBInfo &MInfo = MBBInfoMap[MBB];
if (!MInfo.reachable) {
@@ -1057,12 +1072,15 @@ void MachineVerifier::checkLiveness(cons
LiveQueryResult LRQ = LR->Query(UseIdx);
if (!LRQ.valueIn()) {
report("No live segment at use", MO, MONum);
- errs() << UseIdx << " is not live in " << PrintRegUnit(*Units, TRI)
- << ' ' << *LR << '\n';
+ report_context_liverange(*LR);
+ report_context_regunit(*Units);
+ report_context(UseIdx);
}
if (MO->isKill() && !LRQ.isKill()) {
report("Live range continues after kill flag", MO, MONum);
- errs() << PrintRegUnit(*Units, TRI) << ' ' << *LR << '\n';
+ report_context_liverange(*LR);
+ report_context_regunit(*Units);
+ report_context(UseIdx);
}
}
}
@@ -1075,13 +1093,15 @@ void MachineVerifier::checkLiveness(cons
LiveQueryResult LRQ = LI.Query(UseIdx);
if (!LRQ.valueIn()) {
report("No live segment at use", MO, MONum);
- errs() << UseIdx << " is not live in " << LI << '\n';
+ report_context(LI);
+ report_context(UseIdx);
}
// Check for extra kill flags.
// Note that we allow missing kill flags for now.
if (MO->isKill() && !LRQ.isKill()) {
report("Live range continues after kill flag", MO, MONum);
- errs() << "Live range: " << LI << '\n';
+ report_context(LI);
+ report_context(UseIdx);
}
} else {
report("Virtual register has no live interval", MO, MONum);
@@ -1164,19 +1184,21 @@ void MachineVerifier::checkLiveness(cons
assert(VNI && "NULL valno is not allowed");
if (VNI->def != DefIdx) {
report("Inconsistent valno->def", MO, MONum);
- errs() << "Valno " << VNI->id << " is not defined at "
- << DefIdx << " in " << LI << '\n';
+ report_context(LI);
+ report_context(*VNI);
+ report_context(DefIdx);
}
} else {
report("No live segment at def", MO, MONum);
- errs() << DefIdx << " is not live in " << LI << '\n';
+ report_context(LI);
+ report_context(DefIdx);
}
// Check that, if the dead def flag is present, LiveInts agree.
if (MO->isDead()) {
LiveQueryResult LRQ = LI.Query(DefIdx);
if (!LRQ.isDeadDef()) {
report("Live range continues after dead def flag", MO, MONum);
- errs() << "Live range: " << LI << '\n';
+ report_context(LI);
}
}
} else {
More information about the llvm-commits
mailing list