Commit 71779375 authored by mtrofin's avatar mtrofin Committed by Commit bot

[turbofan] Re-wire greedy.

We completely un-wired the greedy allocator to focus on the
stackchecks in loops (splintering) work. This change re-wires greedy,
still behind its flag. For now, enabling the greedy allocator disables
the stackchecks in loops feature (and range splintering), so that we are
at the baseline we left it at.

The main contribution in this change is adapting the codebase after
the live range model refactoring, whereby RegisterAllocationData's
live_ranges() contains just top-level ranges, and children are accessed
via their parents.

BUG=

Review URL: https://codereview.chromium.org/1320363002

Cr-Commit-Position: refs/heads/master@{#30492}
parent 09bb401b
......@@ -164,8 +164,12 @@ void GreedyAllocator::PreallocateFixedRanges() {
void GreedyAllocator::ScheduleAllocationCandidates() {
for (auto range : data()->live_ranges()) {
if (CanProcessRange(range) && !range->spilled()) {
scheduler().Schedule(range);
if (CanProcessRange(range)) {
for (LiveRange* child = range; child != nullptr; child = child->next()) {
if (!child->spilled()) {
scheduler().Schedule(child);
}
}
}
}
}
......
......@@ -1354,9 +1354,13 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
Run<SplinterLiveRangesPhase>();
}
// TODO(mtrofin): re-enable greedy once we have bots for range preprocessing.
Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>();
Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>();
if (FLAG_turbo_greedy_regalloc) {
Run<AllocateGeneralRegistersPhase<GreedyAllocator>>();
Run<AllocateDoubleRegistersPhase<GreedyAllocator>>();
} else {
Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>();
Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>();
}
if (FLAG_turbo_preprocess_ranges) {
Run<MergeSplintersPhase>();
......
......@@ -409,10 +409,10 @@ DEFINE_BOOL(turbo_greedy_regalloc, false, "use the greedy register allocator")
DEFINE_BOOL(turbo_preprocess_ranges, true,
"run pre-register allocation heuristics")
DEFINE_BOOL(turbo_loop_stackcheck, true, "enable stack checks in loops")
// TODO(mtrofin): remove these implications, as they are here just for trybot
// purposes.
DEFINE_IMPLICATION(turbo_greedy_regalloc, turbo_preprocess_ranges)
DEFINE_IMPLICATION(turbo_greedy_regalloc, turbo_loop_stackcheck)
// TODO(mtrofin): remove the 2 implications.
DEFINE_NEG_IMPLICATION(turbo_greedy_regalloc, turbo_preprocess_ranges)
DEFINE_NEG_IMPLICATION(turbo_greedy_regalloc, turbo_loop_stackcheck)
DEFINE_IMPLICATION(turbo, turbo_asm_deoptimization)
DEFINE_STRING(turbo_filter, "~~", "optimization filter for TurboFan compiler")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment