[llvm] r279325 - [Packetizer] Add debugging code to stop packetization after N instructions
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 14:12:52 PDT 2016
Author: kparzysz
Date: Fri Aug 19 16:12:52 2016
New Revision: 279325
URL: http://llvm.org/viewvc/llvm-project?rev=279325&view=rev
Log:
[Packetizer] Add debugging code to stop packetization after N instructions
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=279325&r1=279324&r2=279325&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DFAPacketizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/DFAPacketizer.cpp Fri Aug 19 16:12:52 2016
@@ -31,9 +31,14 @@
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Support/CommandLine.h"
using namespace llvm;
+static cl::opt<unsigned> InstrLimit("dfa-instr-limit", cl::Hidden,
+ cl::init(0), cl::desc("If present, stops packetizing after N instructions"));
+static unsigned InstrCount = 0;
+
// --------------------------------------------------------------------
// Definitions shared between DFAPacketizer.cpp and DFAPacketizerEmitter.cpp
@@ -218,6 +223,13 @@ VLIWPacketizerList::~VLIWPacketizerList(
// End the current packet, bundle packet instructions and reset DFA state.
void VLIWPacketizerList::endPacket(MachineBasicBlock *MBB,
MachineBasicBlock::iterator MI) {
+ DEBUG({
+ if (!CurrentPacketMIs.empty()) {
+ dbgs() << "Finalizing packet:\n";
+ for (MachineInstr *MI : CurrentPacketMIs)
+ dbgs() << " * " << *MI;
+ }
+ });
if (CurrentPacketMIs.size() > 1) {
MachineInstr &MIFirst = *CurrentPacketMIs.front();
finalizeBundle(*MBB, MIFirst.getIterator(), MI.getInstrIterator());
@@ -249,8 +261,17 @@ void VLIWPacketizerList::PacketizeMIs(Ma
for (SUnit &SU : VLIWScheduler->SUnits)
MIToSUnit[SU.getInstr()] = &SU;
+ bool LimitPresent = InstrLimit.getPosition();
+
// The main packetizer loop.
for (; BeginItr != EndItr; ++BeginItr) {
+ if (LimitPresent) {
+ if (InstrCount >= InstrLimit) {
+ EndItr = BeginItr;
+ break;
+ }
+ InstrCount++;
+ }
MachineInstr &MI = *BeginItr;
initPacketizerState();
More information about the llvm-commits
mailing list