diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-26 20:21:46 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-26 20:21:46 +0000 |
commit | b7050233fbb030d83377d0092a9bb940a2a2ea3b (patch) | |
tree | 102c3360f07b1ad7166982dc0668858e8a3515df /llvm/lib/CodeGen/MachineVerifier.cpp | |
parent | db594373bd2d48f515117698c374eeedb0b8ce04 (diff) | |
download | bcm5719-llvm-b7050233fbb030d83377d0092a9bb940a2a2ea3b.tar.gz bcm5719-llvm-b7050233fbb030d83377d0092a9bb940a2a2ea3b.zip |
Teach MachineBasicBlock::print() to annotate instructions and blocks with
SlotIndexes when available.
llvm-svn: 117392
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineVerifier.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index b79d68b9d10..d6d7dd45cc2 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -168,6 +168,7 @@ namespace { // Analysis information if available LiveVariables *LiveVars; const LiveIntervals *LiveInts; + SlotIndexes *Indexes; void visitMachineFunctionBefore(); void visitMachineBasicBlockBefore(const MachineBasicBlock *MBB); @@ -249,11 +250,13 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) { LiveVars = NULL; LiveInts = NULL; + Indexes = NULL; if (PASS) { LiveInts = PASS->getAnalysisIfAvailable<LiveIntervals>(); // We don't want to verify LiveVariables if LiveIntervals is available. if (!LiveInts) LiveVars = PASS->getAnalysisIfAvailable<LiveVariables>(); + Indexes = PASS->getAnalysisIfAvailable<SlotIndexes>(); } visitMachineFunctionBefore(); @@ -291,7 +294,7 @@ void MachineVerifier::report(const char *msg, const MachineFunction *MF) { assert(MF); *OS << '\n'; if (!foundErrors++) - MF->print(*OS); + MF->print(*OS, Indexes); *OS << "*** Bad machine code: " << msg << " ***\n" << "- function: " << MF->getFunction()->getNameStr() << "\n"; } @@ -301,13 +304,19 @@ void MachineVerifier::report(const char *msg, const MachineBasicBlock *MBB) { report(msg, MBB->getParent()); *OS << "- basic block: " << MBB->getName() << " " << (void*)MBB - << " (BB#" << MBB->getNumber() << ")\n"; + << " (BB#" << MBB->getNumber() << ")"; + if (Indexes) + *OS << " [" << Indexes->getMBBStartIdx(MBB) + << ';' << Indexes->getMBBEndIdx(MBB) << ')'; + *OS << '\n'; } void MachineVerifier::report(const char *msg, const MachineInstr *MI) { assert(MI); report(msg, MI->getParent()); *OS << "- instruction: "; + if (Indexes && Indexes->hasIndex(MI)) + *OS << Indexes->getInstructionIndex(MI) << '\t'; MI->print(*OS, TM); } |