[llvm] 19c42f6 - [DFAPacketizer] Move DefaultVLIWScheduler class declaration to header file
Shivam Gupta via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 11 01:02:14 PST 2023
Author: Darshan Bhat
Date: 2023-02-11T14:31:58+05:30
New Revision: 19c42f672f942518b4d711a0c734693a9244f78c
URL: https://github.com/llvm/llvm-project/commit/19c42f672f942518b4d711a0c734693a9244f78c
DIFF: https://github.com/llvm/llvm-project/commit/19c42f672f942518b4d711a0c734693a9244f78c.diff
LOG: [DFAPacketizer] Move DefaultVLIWScheduler class declaration to header file
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();
}
}
```
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D139767
Added:
Modified:
llvm/include/llvm/CodeGen/DFAPacketizer.h
llvm/lib/CodeGen/DFAPacketizer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/DFAPacketizer.h b/llvm/include/llvm/CodeGen/DFAPacketizer.h
index aba6503a6a1f2..296586c6279fa 100644
--- a/llvm/include/llvm/CodeGen/DFAPacketizer.h
+++ b/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 MCInstrDesc;
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;
diff --git a/llvm/lib/CodeGen/DFAPacketizer.cpp b/llvm/lib/CodeGen/DFAPacketizer.cpp
index 34fb1d286a582..cf02918b9376f 100644
--- a/llvm/lib/CodeGen/DFAPacketizer.cpp
+++ b/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 @@ unsigned DFAPacketizer::getUsedResources(unsigned InstIdx) {
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)
More information about the llvm-commits
mailing list