Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend.dart

Issue 1007103003: cps-ir: Merge variables based on set-based liveness and graph coloring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart_backend; 5 part of dart_backend;
6 6
7 // TODO(ahe): This class is simply wrong. This backend should use 7 // TODO(ahe): This class is simply wrong. This backend should use
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, 8 // elements when it can, not AST nodes. Perhaps a [Map<Element,
9 // TreeElements>] is what is needed. 9 // TreeElements>] is what is needed.
10 class ElementAst { 10 class ElementAst {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // types are correctly marked as instantiated (Issue 21880). 161 // types are correctly marked as instantiated (Issue 21880).
162 TypePropagator typePropagator = new TypePropagator( 162 TypePropagator typePropagator = new TypePropagator(
163 context.dartTypes, 163 context.dartTypes,
164 context.constantSystem, 164 context.constantSystem,
165 new UnitTypeSystem(), 165 new UnitTypeSystem(),
166 context.internalError); 166 context.internalError);
167 applyCpsPass(typePropagator); 167 applyCpsPass(typePropagator);
168 applyCpsPass(new RedundantPhiEliminator()); 168 applyCpsPass(new RedundantPhiEliminator());
169 applyCpsPass(new ShrinkingReducer()); 169 applyCpsPass(new ShrinkingReducer());
170 170
171 // Do not rewrite the IR after variable allocation. Allocation
172 // makes decisions based on an approximation of IR variable live
173 // ranges that can be invalidated by transforming the IR.
174 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition);
175
176 tree_builder.Builder builder = 171 tree_builder.Builder builder =
177 new tree_builder.Builder(context.internalError); 172 new tree_builder.Builder(context.internalError);
178 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); 173 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition);
179 assert(treeDefinition != null); 174 assert(treeDefinition != null);
180 context.traceGraph('Tree builder', treeDefinition); 175 context.traceGraph('Tree builder', treeDefinition);
181 assert(checkTreeIntegrity(treeDefinition)); 176 assert(checkTreeIntegrity(treeDefinition));
182 177
183 // Transformations on the Tree IR. 178 // Transformations on the Tree IR.
184 void applyTreePass(tree_opt.Pass pass) { 179 void applyTreePass(tree_opt.Pass pass) {
185 pass.rewrite(treeDefinition); 180 pass.rewrite(treeDefinition);
186 context.traceGraph(pass.passName, treeDefinition); 181 context.traceGraph(pass.passName, treeDefinition);
187 assert(checkTreeIntegrity(treeDefinition)); 182 assert(checkTreeIntegrity(treeDefinition));
188 } 183 }
189 184
190 applyTreePass(new StatementRewriter()); 185 applyTreePass(new StatementRewriter());
191 applyTreePass(new CopyPropagator()); 186 applyTreePass(new VariableMerger());
192 applyTreePass(new LoopRewriter()); 187 applyTreePass(new LoopRewriter());
193 applyTreePass(new LogicalRewriter()); 188 applyTreePass(new LogicalRewriter());
194 189
195 // Backend-specific transformations. 190 // Backend-specific transformations.
196 new backend_ast_emitter.UnshadowParameters().unshadow(treeDefinition); 191 new backend_ast_emitter.UnshadowParameters().unshadow(treeDefinition);
197 context.traceGraph('Unshadow parameters', treeDefinition); 192 context.traceGraph('Unshadow parameters', treeDefinition);
198 193
199 TreeElementMapping treeElements = new TreeElementMapping(element); 194 TreeElementMapping treeElements = new TreeElementMapping(element);
200 backend_ast.ExecutableDefinition backendAst = 195 backend_ast.ExecutableDefinition backendAst =
201 backend_ast_emitter.emit(treeDefinition); 196 backend_ast_emitter.emit(treeDefinition);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 557 }
563 558
564 void traceGraph(String title, var irObject) { 559 void traceGraph(String title, var irObject) {
565 compiler.tracer.traceGraph(title, irObject); 560 compiler.tracer.traceGraph(title, irObject);
566 } 561 }
567 562
568 DartTypes get dartTypes => compiler.types; 563 DartTypes get dartTypes => compiler.types;
569 564
570 InternalErrorFunction get internalError => compiler.internalError; 565 InternalErrorFunction get internalError => compiler.internalError;
571 } 566 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698