[llvm] r275455 - Add debugging code to the packetizer
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 12:04:26 PDT 2016
Author: kparzysz
Date: Thu Jul 14 14:04:26 2016
New Revision: 275455
URL: http://llvm.org/viewvc/llvm-project?rev=275455&view=rev
Log:
Add debugging code to the packetizer
Modified:
llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
Modified: llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DFAPacketizer.cpp?rev=275455&r1=275454&r2=275455&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DFAPacketizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/DFAPacketizer.cpp Thu Jul 14 14:04:26 2016
@@ -23,6 +23,8 @@
//
//===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "packets"
+
#include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
@@ -222,6 +224,7 @@ void VLIWPacketizerList::endPacket(Machi
}
CurrentPacketMIs.clear();
ResourceTracker->clearResources();
+ DEBUG(dbgs() << "End packet\n");
}
@@ -235,6 +238,12 @@ void VLIWPacketizerList::PacketizeMIs(Ma
std::distance(BeginItr, EndItr));
VLIWScheduler->schedule();
+ DEBUG({
+ dbgs() << "Scheduling DAG of the packetize region\n";
+ for (SUnit &SU : VLIWScheduler->SUnits)
+ SU.dumpAll(VLIWScheduler);
+ });
+
// Generate MI -> SU map.
MIToSUnit.clear();
for (SUnit &SU : VLIWScheduler->SUnits)
@@ -259,30 +268,46 @@ void VLIWPacketizerList::PacketizeMIs(Ma
assert(SUI && "Missing SUnit Info!");
// Ask DFA if machine resource is available for MI.
+ DEBUG(dbgs() << "Checking resources for adding MI to packet " << MI);
+
bool ResourceAvail = ResourceTracker->canReserveResources(MI);
+ DEBUG({
+ if (ResourceAvail)
+ dbgs() << " Resources are available for adding MI to packet\n";
+ else
+ dbgs() << " Resources NOT available\n";
+ });
if (ResourceAvail && shouldAddToPacket(MI)) {
// Dependency check for MI with instructions in CurrentPacketMIs.
for (auto MJ : CurrentPacketMIs) {
SUnit *SUJ = MIToSUnit[MJ];
assert(SUJ && "Missing SUnit Info!");
+ DEBUG(dbgs() << " Checking against MJ " << *MJ);
// Is it legal to packetize SUI and SUJ together.
if (!isLegalToPacketizeTogether(SUI, SUJ)) {
+ DEBUG(dbgs() << " Not legal to add MI, try to prune\n");
// Allow packetization if dependency can be pruned.
if (!isLegalToPruneDependencies(SUI, SUJ)) {
// End the packet if dependency cannot be pruned.
+ DEBUG(dbgs() << " Could not prune dependencies for adding MI\n");
endPacket(MBB, MI);
break;
}
+ DEBUG(dbgs() << " Pruned dependence for adding MI\n");
}
}
} else {
+ DEBUG(if (ResourceAvail)
+ dbgs() << "Resources are available, but instruction should not be "
+ "added to packet\n " << MI);
// End the packet if resource is not available, or if the instruction
// shoud not be added to the current packet.
endPacket(MBB, MI);
}
// Add MI to the current packet.
+ DEBUG(dbgs() << "* Adding MI to packet " << MI << '\n');
BeginItr = addToPacket(MI);
} // For all instructions in the packetization range.
More information about the llvm-commits
mailing list