[llvm] r262930 - Add DAG mutation interface to the DFA packetizer

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 07:33:52 PST 2016


Author: kparzysz
Date: Tue Mar  8 09:33:51 2016
New Revision: 262930

URL: http://llvm.org/viewvc/llvm-project?rev=262930&view=rev
Log:
Add DAG mutation interface to the DFA packetizer

Modified:
    llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h
    llvm/trunk/lib/CodeGen/DFAPacketizer.cpp

Modified: llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h?rev=262930&r1=262929&r2=262930&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DFAPacketizer.h Tue Mar  8 09:33:51 2016
@@ -28,6 +28,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/ScheduleDAGMutation.h"
 #include <map>
 
 namespace llvm {
@@ -199,6 +200,9 @@ public:
   virtual bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) {
     return false;
   }
+
+  // Add a DAG mutation to be done before the packetization begins.
+  void addMutation(std::unique_ptr<ScheduleDAGMutation> Mutation);
 };
 
 } // namespace llvm

Modified: llvm/trunk/lib/CodeGen/DFAPacketizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DFAPacketizer.cpp?rev=262930&r1=262929&r2=262930&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DFAPacketizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/DFAPacketizer.cpp Tue Mar  8 09:33:51 2016
@@ -155,11 +155,20 @@ namespace llvm {
 class DefaultVLIWScheduler : public ScheduleDAGInstrs {
 private:
   AliasAnalysis *AA;
+  /// Ordered list of DAG postprocessing steps.
+  std::vector<std::unique_ptr<ScheduleDAGMutation>> Mutations;
 public:
   DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI,
                        AliasAnalysis *AA);
   // Actual scheduling work.
   void schedule() override;
+
+  /// DefaultVLIWScheduler takes ownership of the Mutation object.
+  void addMutation(std::unique_ptr<ScheduleDAGMutation> Mutation) {
+    Mutations.push_back(std::move(Mutation));
+  }
+protected:
+  void postprocessDAG();
 };
 }
 
@@ -172,9 +181,17 @@ DefaultVLIWScheduler::DefaultVLIWSchedul
 }
 
 
+/// Apply each ScheduleDAGMutation step in order.
+void DefaultVLIWScheduler::postprocessDAG() {
+  for (auto &M : Mutations)
+    M->apply(this);
+}
+
+
 void DefaultVLIWScheduler::schedule() {
   // Build the scheduling graph.
   buildSchedGraph(AA);
+  postprocessDAG();
 }
 
 
@@ -272,3 +289,10 @@ void VLIWPacketizerList::PacketizeMIs(Ma
   VLIWScheduler->exitRegion();
   VLIWScheduler->finishBlock();
 }
+
+
+// Add a DAG mutation object to the ordered list.
+void VLIWPacketizerList::addMutation(
+      std::unique_ptr<ScheduleDAGMutation> Mutation) {
+  VLIWScheduler->addMutation(std::move(Mutation));
+}




More information about the llvm-commits mailing list