summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff options
context:
space:
mode:
authorQingShan Zhang <qshanz@cn.ibm.com>2019-03-27 03:50:16 +0000
committerQingShan Zhang <qshanz@cn.ibm.com>2019-03-27 03:50:16 +0000
commit5321dcd608a1d9b1b172b33838f1cfd29e0fed10 (patch)
treedb395673aef535641d46eebf839f943268cd8b61 /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
parent06cdd7e48862b926d453447d051aff518b3205a8 (diff)
downloadbcm5719-llvm-5321dcd608a1d9b1b172b33838f1cfd29e0fed10.tar.gz
bcm5719-llvm-5321dcd608a1d9b1b172b33838f1cfd29e0fed10.zip
[NFC][PowerPC] Custom PowerPC specific machine-scheduler
This patch lays the groundwork for extending the generic machine scheduler by providing a PPC-specific implementation. There are no functional changes as this is an incremental patch that simply provides the necessary overrides which just encapsulate the behavior of the generic scheduler. Subsequent patches will add specific behavior. Differential Revision: https://reviews.llvm.org/D59284 llvm-svn: 357047
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index 58057d37b55..444a3a587a4 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -13,6 +13,7 @@
#include "PPCTargetMachine.h"
#include "MCTargetDesc/PPCMCTargetDesc.h"
#include "PPC.h"
+#include "PPCMachineScheduler.h"
#include "PPCSubtarget.h"
#include "PPCTargetObjectFile.h"
#include "PPCTargetTransformInfo.h"
@@ -237,6 +238,23 @@ static CodeModel::Model getEffectivePPCCodeModel(const Triple &TT,
return CodeModel::Small;
}
+
+static ScheduleDAGInstrs *createPPCMachineScheduler(MachineSchedContext *C) {
+ ScheduleDAGMILive *DAG =
+ new ScheduleDAGMILive(C, llvm::make_unique<PPCPreRASchedStrategy>(C));
+ // add DAG Mutations here.
+ DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI));
+ return DAG;
+}
+
+static ScheduleDAGInstrs *createPPCPostMachineScheduler(
+ MachineSchedContext *C) {
+ ScheduleDAGMI *DAG =
+ new ScheduleDAGMI(C, llvm::make_unique<PPCPostRASchedStrategy>(C), true);
+ // add DAG Mutations here.
+ return DAG;
+}
+
// The FeatureString here is a little subtle. We are modifying the feature
// string with what are (currently) non-function specific overrides as it goes
// into the LLVMTargetMachine constructor and then using the stored value in the
@@ -330,6 +348,20 @@ public:
void addPreRegAlloc() override;
void addPreSched2() override;
void addPreEmitPass() override;
+ ScheduleDAGInstrs *
+ createMachineScheduler(MachineSchedContext *C) const override {
+ const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
+ if (ST.usePPCPreRASchedStrategy())
+ return createPPCMachineScheduler(C);
+ return nullptr;
+ }
+ ScheduleDAGInstrs *
+ createPostMachineScheduler(MachineSchedContext *C) const override {
+ const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
+ if (ST.usePPCPostRASchedStrategy())
+ return createPPCPostMachineScheduler(C);
+ return nullptr;
+ }
};
} // end anonymous namespace
@@ -468,3 +500,13 @@ TargetTransformInfo
PPCTargetMachine::getTargetTransformInfo(const Function &F) {
return TargetTransformInfo(PPCTTIImpl(this, F));
}
+
+static MachineSchedRegistry
+PPCPreRASchedRegistry("ppc-prera",
+ "Run PowerPC PreRA specific scheduler",
+ createPPCMachineScheduler);
+
+static MachineSchedRegistry
+PPCPostRASchedRegistry("ppc-postra",
+ "Run PowerPC PostRA specific scheduler",
+ createPPCPostMachineScheduler);
OpenPOWER on IntegriCloud