[PATCH] D139767: [DFAPacketizer] Move DefaultVLIWScheduler class declaration to header file

Darshan Bhat via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 21:43:41 PST 2022


DarshanRamakant created this revision.
DarshanRamakant added reviewers: slarin, samsonov, atrick, chandlerc, dblaikie, dfukalov, dexonsmith, echristo, Eugene.Zelenko, jmolloy, kazu, kparzysz, MatzeB, Nicola, rnk, SirishP.
DarshanRamakant added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
DarshanRamakant requested review of this revision.
Herald added a subscriber: llvm-commits.

This change moves "DefaultVLIWScheduler" class declaration from
DFAPacketizer.cpp to DFAPacketizer.h.
This is needed because there is a protected class member of
type "DefaultVLIWScheduler*" in "VLIWPacketizerList" class.
The derived classes cannot use this memeber unless declaration
is available to it. More specifically :

// Without this change

class HexagonPacketizerList : public VLIWPacketizerList {

  public :

HexagonPacketizerList() {
	// Below line will cause incomplete class error since
	// declaration was not available through header.
	VLIWScheduler->schedule();

  }

}


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139767

Files:
  llvm/include/llvm/CodeGen/DFAPacketizer.h
  llvm/lib/CodeGen/DFAPacketizer.cpp


Index: llvm/lib/CodeGen/DFAPacketizer.cpp
===================================================================
--- llvm/lib/CodeGen/DFAPacketizer.cpp
+++ llvm/lib/CodeGen/DFAPacketizer.cpp
@@ -29,8 +29,6 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineInstrBundle.h"
 #include "llvm/CodeGen/ScheduleDAG.h"
-#include "llvm/CodeGen/ScheduleDAGInstrs.h"
-#include "llvm/CodeGen/ScheduleDAGMutation.h"
 #include "llvm/CodeGen/TargetInstrInfo.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/MC/MCInstrDesc.h"
@@ -98,34 +96,6 @@
   return RS[InstIdx] ^ RS[InstIdx - 1];
 }
 
-namespace llvm {
-
-// This class extends ScheduleDAGInstrs and overrides the schedule method
-// to build the dependence graph.
-class DefaultVLIWScheduler : public ScheduleDAGInstrs {
-private:
-  AAResults *AA;
-  /// Ordered list of DAG postprocessing steps.
-  std::vector<std::unique_ptr<ScheduleDAGMutation>> Mutations;
-
-public:
-  DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI,
-                       AAResults *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();
-};
-
-} // end namespace llvm
-
 DefaultVLIWScheduler::DefaultVLIWScheduler(MachineFunction &MF,
                                            MachineLoopInfo &MLI,
                                            AAResults *AA)
Index: llvm/include/llvm/CodeGen/DFAPacketizer.h
===================================================================
--- llvm/include/llvm/CodeGen/DFAPacketizer.h
+++ llvm/include/llvm/CodeGen/DFAPacketizer.h
@@ -26,6 +26,8 @@
 #define LLVM_CODEGEN_DFAPACKETIZER_H
 
 #include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/ScheduleDAGInstrs.h"
+#include "llvm/CodeGen/ScheduleDAGMutation.h"
 #include "llvm/Support/Automaton.h"
 #include <cstdint>
 #include <map>
@@ -35,7 +37,6 @@
 
 namespace llvm {
 
-class DefaultVLIWScheduler;
 class ScheduleDAGMutation;
 class InstrItineraryData;
 class MachineFunction;
@@ -45,6 +46,30 @@
 class SUnit;
 class TargetInstrInfo;
 
+// This class extends ScheduleDAGInstrs and overrides the schedule method
+// to build the dependence graph.
+class DefaultVLIWScheduler : public ScheduleDAGInstrs {
+private:
+  AAResults *AA;
+  /// Ordered list of DAG postprocessing steps.
+  std::vector<std::unique_ptr<ScheduleDAGMutation>> Mutations;
+
+public:
+  DefaultVLIWScheduler(MachineFunction &MF, MachineLoopInfo &MLI,
+                       AAResults *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();
+};
+
 class DFAPacketizer {
 private:
   const InstrItineraryData *InstrItins;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139767.481826.patch
Type: text/x-patch
Size: 3055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221210/a839305f/attachment.bin>


More information about the llvm-commits mailing list