summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-20 14:54:01 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-20 14:54:01 +0000
commit5ffd808a27ec8fe211b86310f74a3e3a5c8c1950 (patch)
tree098d4cbee7ba861221751b5d33c4482f36b250d8 /llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
parentad991868c1c4d4e778f41ebccc1b4ad8ce978d31 (diff)
downloadbcm5719-llvm-5ffd808a27ec8fe211b86310f74a3e3a5c8c1950.tar.gz
bcm5719-llvm-5ffd808a27ec8fe211b86310f74a3e3a5c8c1950.zip
[Hexagon] Improve scheduling heuristic for large basic blocks
This patch changes the isLatencyBound heuristic to look at the path length based upon the number of packets needed to schedule a basic block. For small basic blocks, the heuristic uses a small threshold for isLatencyBound. For large basic blocks, the heuristic uses a large threshold. The goal is to increase the priority of an instruction in a small basic block that has a large height or depth relative to the code size. For large functions, the height and depth are ignored because it increases the live range of a register and causes more spills. That is, for large functions, it is more important to schedule instructions when available, and attempt to keep the defs and uses closer together. Patch by Brendon Cahoon. llvm-svn: 327987
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp b/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
index d7f670c6233..8599c1a2b56 100644
--- a/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
@@ -473,7 +473,11 @@ SUnit *ConvergingVLIWScheduler::VLIWSchedBoundary::pickOnlyChoice() {
if (CheckPending)
releasePending();
- for (unsigned i = 0; Available.empty(); ++i) {
+ for (unsigned i = 0;
+ Available.empty() ||
+ (Available.size() == 1 &&
+ !ResourceModel->isResourceAvailable(*Available.begin(), isTop()));
+ ++i) {
assert(i <= (HazardRec->getMaxLookAhead() + MaxMinLatency) &&
"permanent hazard"); (void)i;
ResourceModel->reserveResources(nullptr, isTop());
@@ -625,6 +629,10 @@ int ConvergingVLIWScheduler::pressureChange(const SUnit *SU, bool isBotUp) {
return 0;
}
+static unsigned getWeakLeft(const SUnit *SU, bool IsTop) {
+ return (IsTop) ? SU->WeakPredsLeft : SU->WeakSuccsLeft;
+}
+
// Constants used to denote relative importance of
// heuristic components for cost computation.
static const unsigned PriorityOne = 200;
@@ -782,7 +790,7 @@ int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,
// Give preference to a zero latency instruction if the dependent
// instruction is in the current packet.
- if (Q.getID() == TopQID) {
+ if (Q.getID() == TopQID && getWeakLeft(SU, true) == 0) {
for (const SDep &PI : SU->Preds) {
if (!PI.getSUnit()->getInstr()->isPseudo() && PI.isAssignedRegDep() &&
PI.getLatency() == 0 &&
@@ -791,7 +799,7 @@ int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,
DEBUG(if (verbose) dbgs() << "Z|");
}
}
- } else {
+ } else if (Q.getID() == BotQID && getWeakLeft(SU, false) == 0) {
for (const SDep &SI : SU->Succs) {
if (!SI.getSUnit()->getInstr()->isPseudo() && SI.isAssignedRegDep() &&
SI.getLatency() == 0 &&
OpenPOWER on IntegriCloud