]> granicus.if.org Git - llvm/commitdiff
[Hexagon] Move pre-RA DAG mutations to scheduler constructor
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 28 Aug 2017 15:52:54 +0000 (15:52 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Mon, 28 Aug 2017 15:52:54 +0000 (15:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311894 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonMachineScheduler.cpp
lib/Target/Hexagon/HexagonMachineScheduler.h
lib/Target/Hexagon/HexagonTargetMachine.cpp

index 1a26805d190d012b6cfd7b4a6b8fd68252c26b40..375a64de7f5532514943f8ade2572d0295aa2c30 100644 (file)
@@ -12,6 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "HexagonInstrInfo.h"
 #include "HexagonMachineScheduler.h"
 #include "HexagonSubtarget.h"
 #include "llvm/CodeGen/MachineLoopInfo.h"
@@ -51,16 +52,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "machine-scheduler"
 
-namespace {
-class HexagonCallMutation : public ScheduleDAGMutation {
-public:
-  void apply(ScheduleDAGInstrs *DAG) override;
-private:
-  bool shouldTFRICallBind(const HexagonInstrInfo &HII,
-                          const SUnit &Inst1, const SUnit &Inst2) const;
-};
-} // end anonymous namespace
-
 // Check if a call and subsequent A2_tfrpi instructions should maintain
 // scheduling affinity. We are looking for the TFRI to be consumed in
 // the next instruction. This should help reduce the instances of
@@ -336,9 +327,6 @@ void ConvergingVLIWScheduler::initialize(ScheduleDAGMI *dag) {
 
   assert((!llvm::ForceTopDown || !llvm::ForceBottomUp) &&
          "-misched-topdown incompatible with -misched-bottomup");
-
-  DAG->addMutation(make_unique<HexagonSubtarget::HexagonDAGMutation>());
-  DAG->addMutation(make_unique<HexagonCallMutation>());
 }
 
 void ConvergingVLIWScheduler::releaseTopNode(SUnit *SU) {
index 810abf38863dddc60e187c7924b9d714c352ff1d..0af29c22765da0638001753240e3f7f29f445b4c 100644 (file)
@@ -249,7 +249,14 @@ protected:
 #endif
 };
 
-} // namespace
+class HexagonCallMutation : public ScheduleDAGMutation {
+public:
+  void apply(ScheduleDAGInstrs *DAG) override;
+private:
+  bool shouldTFRICallBind(const HexagonInstrInfo &HII,
+                          const SUnit &Inst1, const SUnit &Inst2) const;
+};
 
+} // namespace
 
 #endif
index 01634756d0a2ad6c5dc1569bd96978b12979678a..405f44123efe75d069c9d09d5371e14fda872029 100644 (file)
@@ -100,7 +100,12 @@ extern "C" int HexagonTargetMachineModule;
 int HexagonTargetMachineModule = 0;
 
 static ScheduleDAGInstrs *createVLIWMachineSched(MachineSchedContext *C) {
-  return new VLIWMachineScheduler(C, make_unique<ConvergingVLIWScheduler>());
+  ScheduleDAGMILive *DAG =
+    new VLIWMachineScheduler(C, make_unique<ConvergingVLIWScheduler>());
+  DAG->addMutation(make_unique<HexagonSubtarget::HexagonDAGMutation>());
+  DAG->addMutation(make_unique<HexagonCallMutation>());
+  DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI));
+  return DAG;
 }
 
 static MachineSchedRegistry