diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-12-22 19:21:20 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-12-22 19:21:20 +0000 |
commit | 88391248485102a5b1c01f59a1ed9840d91ecddf (patch) | |
tree | 58946d330bd4ce61e1f2f35c0ebd1d5988cda1d2 /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | 63dea591040f8dad31a1b3942afcb5b12537ef90 (diff) | |
download | llvm-88391248485102a5b1c01f59a1ed9840d91ecddf.zip llvm-88391248485102a5b1c01f59a1ed9840d91ecddf.tar.gz llvm-88391248485102a5b1c01f59a1ed9840d91ecddf.tar.bz2 |
Add the DAG mutation interface to the software pipeliner
llvm-svn: 290360
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index d9528cd..43a1809 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -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 ScheduleDAGInstrs { /// 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::isLoopCarriedOrder(SUnit *Source, const SDep &Dep, 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 |