Reviewers: Benedikt Meurer, Jarin (OOO - vacation),
Description:
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=
Please review this at https://codereview.chromium.org/1256313003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+88, -0 lines):
M BUILD.gn
M src/compiler/pipeline.cc
A src/compiler/preprocess-live-ranges.h
A src/compiler/preprocess-live-ranges.cc
M src/flag-definitions.h
M tools/gyp/v8.gyp
Index: BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
index
d194d63256cdeecbe177cc13719aa865f08d91b3..45dbb5cc1afd26bc07a225b0120a346502a35677
100644
--- a/BUILD.gn
+++ b/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",
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
d2c5fa6f35c3e2b465df7d6d07daab2b52df8187..f55b4d35125e2380bc1d94106c531ba548aa8c65
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.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>>();
Index: src/compiler/preprocess-live-ranges.cc
diff --git a/src/compiler/preprocess-live-ranges.cc
b/src/compiler/preprocess-live-ranges.cc
new file mode 100644
index
0000000000000000000000000000000000000000..81283a898a0f778658dc4b74a980556fb1e5d418
--- /dev/null
+++ b/src/compiler/preprocess-live-ranges.cc
@@ -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
Index: src/compiler/preprocess-live-ranges.h
diff --git a/src/compiler/preprocess-live-ranges.h
b/src/compiler/preprocess-live-ranges.h
new file mode 100644
index
0000000000000000000000000000000000000000..aa852fc7ca40606959596efd900ab67fbad234c0
--- /dev/null
+++ b/src/compiler/preprocess-live-ranges.h
@@ -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_
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
acc7edaa6eb1a638fdf71bd370d063d224823395..1e59f00de1e6d8544b4d2e1746e87bbd64318d9b
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.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")
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index
8141265609aeb62854896962e6c379a8772dc447..ee72961067c6641e517e4fc109bb1d71e79d616b
100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -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',
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.