Commit 5e11acc9 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Reorganize the pipeline around the 2nd scheduler approach.

The JavaScript pipeline now consists of the following steps:

 1. Typed lowering.
 2. Representation selection (actually SimplifiedLowering).
 3. Early optimization pass (incl. JSGenericLowering).
 4. Effect control linearization (not for asm.js).
 5. Late optimization pass (incl. ChangeLowering).
 6. Real scheduling.

We should further cleanup the passes and restrict type and
representation information usage to appropriate parts of the pipeline.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#35702}
parent 4d824551
...@@ -771,16 +771,22 @@ struct EscapeAnalysisPhase { ...@@ -771,16 +771,22 @@ struct EscapeAnalysisPhase {
} }
}; };
struct RepresentationSelectionPhase {
struct SimplifiedLoweringPhase { static const char* phase_name() { return "representation selection"; }
static const char* phase_name() { return "simplified lowering"; }
void Run(PipelineData* data, Zone* temp_zone) { void Run(PipelineData* data, Zone* temp_zone) {
SimplifiedLowering lowering(data->jsgraph(), temp_zone, SimplifiedLowering lowering(data->jsgraph(), temp_zone,
data->source_positions()); data->source_positions());
lowering.LowerAllNodes(); lowering.LowerAllNodes();
}
};
struct EarlyOptimizationPhase {
static const char* phase_name() { return "early optimization"; }
void Run(PipelineData* data, Zone* temp_zone) {
JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
JSGenericLowering generic_lowering(data->jsgraph());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common()); data->common());
SimplifiedOperatorReducer simple_reducer(data->jsgraph()); SimplifiedOperatorReducer simple_reducer(data->jsgraph());
...@@ -790,6 +796,7 @@ struct SimplifiedLoweringPhase { ...@@ -790,6 +796,7 @@ struct SimplifiedLoweringPhase {
data->common(), data->machine()); data->common(), data->machine());
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &simple_reducer); AddReducer(data, &graph_reducer, &simple_reducer);
AddReducer(data, &graph_reducer, &generic_lowering);
AddReducer(data, &graph_reducer, &value_numbering); AddReducer(data, &graph_reducer, &value_numbering);
AddReducer(data, &graph_reducer, &machine_reducer); AddReducer(data, &graph_reducer, &machine_reducer);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
...@@ -797,7 +804,6 @@ struct SimplifiedLoweringPhase { ...@@ -797,7 +804,6 @@ struct SimplifiedLoweringPhase {
} }
}; };
struct ControlFlowOptimizationPhase { struct ControlFlowOptimizationPhase {
static const char* phase_name() { return "control flow optimization"; } static const char* phase_name() { return "control flow optimization"; }
...@@ -838,8 +844,8 @@ struct EffectControlLinearizationPhase { ...@@ -838,8 +844,8 @@ struct EffectControlLinearizationPhase {
} }
}; };
struct ChangeLoweringPhase { struct LateOptimizationPhase {
static const char* phase_name() { return "change lowering"; } static const char* phase_name() { return "late optimization"; }
void Run(PipelineData* data, Zone* temp_zone) { void Run(PipelineData* data, Zone* temp_zone) {
JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
...@@ -851,12 +857,17 @@ struct ChangeLoweringPhase { ...@@ -851,12 +857,17 @@ struct ChangeLoweringPhase {
MachineOperatorReducer machine_reducer(data->jsgraph()); MachineOperatorReducer machine_reducer(data->jsgraph());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine()); data->common(), data->machine());
SelectLowering select_lowering(data->jsgraph()->graph(),
data->jsgraph()->common());
TailCallOptimization tco(data->common(), data->graph());
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &simple_reducer); AddReducer(data, &graph_reducer, &simple_reducer);
AddReducer(data, &graph_reducer, &value_numbering); AddReducer(data, &graph_reducer, &value_numbering);
AddReducer(data, &graph_reducer, &lowering); AddReducer(data, &graph_reducer, &lowering);
AddReducer(data, &graph_reducer, &machine_reducer); AddReducer(data, &graph_reducer, &machine_reducer);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &select_lowering);
AddReducer(data, &graph_reducer, &tco);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
} }
}; };
...@@ -898,29 +909,6 @@ struct StressLoopPeelingPhase { ...@@ -898,29 +909,6 @@ struct StressLoopPeelingPhase {
}; };
struct GenericLoweringPhase {
static const char* phase_name() { return "generic lowering"; }
void Run(PipelineData* data, Zone* temp_zone) {
JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine());
JSGenericLowering generic_lowering(data->jsgraph());
SelectLowering select_lowering(data->jsgraph()->graph(),
data->jsgraph()->common());
TailCallOptimization tco(data->common(), data->graph());
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &generic_lowering);
AddReducer(data, &graph_reducer, &select_lowering);
AddReducer(data, &graph_reducer, &tco);
graph_reducer.ReduceGraph();
}
};
struct ComputeSchedulePhase { struct ComputeSchedulePhase {
static const char* phase_name() { return "scheduling"; } static const char* phase_name() { return "scheduling"; }
...@@ -1284,9 +1272,13 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -1284,9 +1272,13 @@ Handle<Code> Pipeline::GenerateCode() {
RunPrintAndVerify("Escape Analysed"); RunPrintAndVerify("Escape Analysed");
} }
// Lower simplified operators and insert changes. // Select representations.
Run<SimplifiedLoweringPhase>(); Run<RepresentationSelectionPhase>();
RunPrintAndVerify("Lowered simplified"); RunPrintAndVerify("Representations selected");
// Run early optimization pass.
Run<EarlyOptimizationPhase>();
RunPrintAndVerify("Early optimized");
if (info()->is_effect_scheduling_enabled()) { if (info()->is_effect_scheduling_enabled()) {
// TODO(jarin) Run value numbering for the representation changes. // TODO(jarin) Run value numbering for the representation changes.
...@@ -1304,14 +1296,9 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -1304,14 +1296,9 @@ Handle<Code> Pipeline::GenerateCode() {
} }
// Lower changes that have been inserted before. // Lower changes that have been inserted before.
Run<ChangeLoweringPhase>(); Run<LateOptimizationPhase>();
// TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
RunPrintAndVerify("Lowered changes", true);
// Lower any remaining generic JSOperators.
Run<GenericLoweringPhase>();
// TODO(jarin, rossberg): Remove UNTYPED once machine typing works. // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
RunPrintAndVerify("Lowered generic", true); RunPrintAndVerify("Late optimized", true);
Run<LateGraphTrimmingPhase>(); Run<LateGraphTrimmingPhase>();
// TODO(jarin, rossberg): Remove UNTYPED once machine typing works. // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
......
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