Setting up the stage for heuristics that preprocess live ranges before register allocation, and are independent of register allocation - e.g. the deferred blocks heuristic, or the split at call sites heuristic.
Added a separate flag for this, since we intend to enable it for the linear allocator as well. Currently, the option is "on" for greedy, as a point in time to enable its testing (through the greedy allocator bots). BUG= Review URL: https://codereview.chromium.org/1256313003 Cr-Commit-Position: refs/heads/master@{#30005}
This commit is contained in:
parent
34bd773eb6
commit
c11ab6f7e5
2
BUILD.gn
2
BUILD.gn
@ -782,6 +782,8 @@ source_set("v8_base") {
|
||||
"src/compiler/pipeline.h",
|
||||
"src/compiler/pipeline-statistics.cc",
|
||||
"src/compiler/pipeline-statistics.h",
|
||||
"src/compiler/preprocess-live-ranges.cc",
|
||||
"src/compiler/preprocess-live-ranges.h",
|
||||
"src/compiler/raw-machine-assembler.cc",
|
||||
"src/compiler/raw-machine-assembler.h",
|
||||
"src/compiler/register-allocator.cc",
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "src/compiler/move-optimizer.h"
|
||||
#include "src/compiler/osr.h"
|
||||
#include "src/compiler/pipeline-statistics.h"
|
||||
#include "src/compiler/preprocess-live-ranges.h"
|
||||
#include "src/compiler/register-allocator.h"
|
||||
#include "src/compiler/register-allocator-verifier.h"
|
||||
#include "src/compiler/schedule.h"
|
||||
@ -785,6 +786,17 @@ struct BuildLiveRangesPhase {
|
||||
};
|
||||
|
||||
|
||||
struct PreprocessLiveRangesPhase {
|
||||
static const char* phase_name() { return "preprocess live ranges"; }
|
||||
|
||||
void Run(PipelineData* data, Zone* temp_zone) {
|
||||
PreprocessLiveRanges live_range_preprocessor(
|
||||
data->register_allocation_data(), temp_zone);
|
||||
live_range_preprocessor.PreprocessRanges();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename RegAllocator>
|
||||
struct AllocateGeneralRegistersPhase {
|
||||
static const char* phase_name() { return "allocate general registers"; }
|
||||
@ -1320,6 +1332,11 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
|
||||
if (verifier != nullptr) {
|
||||
CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition());
|
||||
}
|
||||
|
||||
if (FLAG_turbo_preprocess_ranges) {
|
||||
Run<PreprocessLiveRangesPhase>();
|
||||
}
|
||||
|
||||
if (FLAG_turbo_greedy_regalloc) {
|
||||
Run<AllocateGeneralRegistersPhase<GreedyAllocator>>();
|
||||
Run<AllocateDoubleRegistersPhase<GreedyAllocator>>();
|
||||
|
29
src/compiler/preprocess-live-ranges.cc
Normal file
29
src/compiler/preprocess-live-ranges.cc
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/compiler/preprocess-live-ranges.h"
|
||||
#include "src/compiler/register-allocator.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
|
||||
#define TRACE(...) \
|
||||
do { \
|
||||
if (FLAG_trace_alloc) PrintF(__VA_ARGS__); \
|
||||
} while (false)
|
||||
|
||||
|
||||
void PreprocessLiveRanges::PreprocessRanges() {
|
||||
SplitRangesAroundDeferredBlocks();
|
||||
}
|
||||
|
||||
|
||||
void PreprocessLiveRanges::SplitRangesAroundDeferredBlocks() {}
|
||||
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
35
src/compiler/preprocess-live-ranges.h
Normal file
35
src/compiler/preprocess-live-ranges.h
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_PREPROCESS_LIVE_RANGES_H_
|
||||
#define V8_PREPROCESS_LIVE_RANGES_H_
|
||||
|
||||
#include "src/compiler/register-allocator.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
|
||||
class PreprocessLiveRanges final {
|
||||
public:
|
||||
PreprocessLiveRanges(RegisterAllocationData* data, Zone* zone)
|
||||
: data_(data), zone_(zone) {}
|
||||
void PreprocessRanges();
|
||||
|
||||
private:
|
||||
void SplitRangesAroundDeferredBlocks();
|
||||
|
||||
RegisterAllocationData* data() { return data_; }
|
||||
Zone* zone() { return zone_; }
|
||||
|
||||
RegisterAllocationData* data_;
|
||||
Zone* zone_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
#endif // V8_PREPROCESS_LIVE_RANGES_H_
|
@ -397,6 +397,9 @@ DEFINE_BOOL(omit_map_checks_for_leaf_maps, true,
|
||||
DEFINE_BOOL(turbo, false, "enable TurboFan compiler")
|
||||
DEFINE_BOOL(turbo_shipping, true, "enable TurboFan compiler on subset")
|
||||
DEFINE_BOOL(turbo_greedy_regalloc, false, "use the greedy register allocator")
|
||||
DEFINE_BOOL(turbo_preprocess_ranges, false,
|
||||
"run pre-register allocation heuristics")
|
||||
DEFINE_IMPLICATION(turbo_greedy_regalloc, turbo_preprocess_ranges)
|
||||
DEFINE_IMPLICATION(turbo, turbo_asm_deoptimization)
|
||||
DEFINE_STRING(turbo_filter, "~~", "optimization filter for TurboFan compiler")
|
||||
DEFINE_BOOL(trace_turbo, false, "trace generated TurboFan IR")
|
||||
|
@ -575,6 +575,8 @@
|
||||
'../../src/compiler/pipeline.h',
|
||||
'../../src/compiler/pipeline-statistics.cc',
|
||||
'../../src/compiler/pipeline-statistics.h',
|
||||
'../../src/compiler/preprocess-live-ranges.cc',
|
||||
'../../src/compiler/preprocess-live-ranges.h',
|
||||
'../../src/compiler/raw-machine-assembler.cc',
|
||||
'../../src/compiler/raw-machine-assembler.h',
|
||||
'../../src/compiler/register-allocator.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user