[llvm] r290360 - Add the DAG mutation interface to the software pipeliner
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 11:21:21 PST 2016
Author: kparzysz
Date: Thu Dec 22 13:21:20 2016
New Revision: 290360
URL: http://llvm.org/viewvc/llvm-project?rev=290360&view=rev
Log:
Add the DAG mutation interface to the software pipeliner
Modified:
llvm/trunk/include/llvm/Target/TargetSubtargetInfo.h
llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
Modified: llvm/trunk/include/llvm/Target/TargetSubtargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSubtargetInfo.h?rev=290360&r1=290359&r2=290360&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetSubtargetInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetSubtargetInfo.h Thu Dec 22 13:21:20 2016
@@ -191,6 +191,12 @@ public:
std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
}
+ // \brief Provide an ordered list of schedule DAG mutations for the machine
+ // pipeliner.
+ virtual void getSMSMutations(
+ std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
+ }
+
// For use with PostRAScheduling: get the minimum optimization level needed
// to enable post-RA scheduling.
virtual CodeGenOpt::Level getOptLevelToEnablePostRAScheduler() const {
Modified: llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachinePipeliner.cpp?rev=290360&r1=290359&r2=290360&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachinePipeliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachinePipeliner.cpp Thu Dec 22 13:21:20 2016
@@ -89,6 +89,7 @@
#include "llvm/CodeGen/RegisterPressure.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
+#include "llvm/CodeGen/ScheduleDAGMutation.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCInstrItineraries.h"
@@ -256,6 +257,9 @@ class SwingSchedulerDAG : public Schedul
/// must be deleted when the pass is finished.
SmallPtrSet<MachineInstr *, 4> NewMIs;
+ /// Ordered list of DAG postprocessing steps.
+ std::vector<std::unique_ptr<ScheduleDAGMutation>> Mutations;
+
/// Helper class to implement Johnson's circuit finding algorithm.
class Circuits {
std::vector<SUnit> &SUnits;
@@ -287,7 +291,9 @@ public:
const RegisterClassInfo &rci)
: ScheduleDAGInstrs(*P.MF, P.MLI, false), Pass(P), MII(0),
Scheduled(false), Loop(L), LIS(lis), RegClassInfo(rci),
- Topo(SUnits, &ExitSU) {}
+ Topo(SUnits, &ExitSU) {
+ P.MF->getSubtarget().getSMSMutations(Mutations);
+ }
void schedule() override;
void finishBlock() override;
@@ -370,6 +376,10 @@ public:
return 0;
}
+ void addMutation(std::unique_ptr<ScheduleDAGMutation> Mutation) {
+ Mutations.push_back(std::move(Mutation));
+ }
+
private:
void addLoopCarriedDependences(AliasAnalysis *AA);
void updatePhiDependences();
@@ -438,6 +448,7 @@ private:
bool canUseLastOffsetValue(MachineInstr *MI, unsigned &BasePos,
unsigned &OffsetPos, unsigned &NewBase,
int64_t &NewOffset);
+ void postprocessDAG();
};
/// A NodeSet contains a set of SUnit DAG nodes with additional information
@@ -847,6 +858,7 @@ void SwingSchedulerDAG::schedule() {
addLoopCarriedDependences(AA);
updatePhiDependences();
Topo.InitDAGTopologicalSorting();
+ postprocessDAG();
changeDependences();
DEBUG({
for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
@@ -3474,6 +3486,11 @@ bool SwingSchedulerDAG::isLoopCarriedOrd
return true;
}
+void SwingSchedulerDAG::postprocessDAG() {
+ for (auto &M : Mutations)
+ M->apply(this);
+}
+
/// Try to schedule the node at the specified StartCycle and continue
/// until the node is schedule or the EndCycle is reached. This function
/// returns true if the node is scheduled. This routine may search either
More information about the llvm-commits
mailing list